summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-11-12 09:40:47 +0100
committerLiang Qi <liang.qi@qt.io>2018-11-15 17:20:15 +0000
commit527406cbd99f44470ef87468b73c18df949e8ac7 (patch)
tree4ee73cffee4bf8699ce45d902aa9b30c6ebb1cc4 /src/platformsupport
parentcd201b2c2c2849fea0c5a38ffd979cd9d5b24997 (diff)
Modernize the "settings" feature
Change-Id: I9b8a61ecb1413b513ae5c9e77d3ee1b3e8b6562c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm18
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm2
-rw-r--r--src/platformsupport/services/genericunix/qgenericunixservices.cpp4
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp10
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes_p.h4
5 files changed, 25 insertions, 13 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 91c2dc8cf0..898432e602 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -50,7 +50,9 @@
#include "qcoretextfontdatabase_p.h"
#include "qfontengine_coretext_p.h"
+#if QT_CONFIG(settings)
#include <QtCore/QSettings>
+#endif
#include <QtCore/QtEndian>
#ifndef QT_NO_FREETYPE
#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h>
@@ -116,21 +118,25 @@ QCoreTextFontDatabase::QCoreTextFontDatabase()
: m_hasPopulatedAliases(false)
{
#ifdef Q_OS_MACX
- QSettings appleSettings(QLatin1String("apple.com"));
- QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold"));
- if (appleValue.isValid())
- QCoreTextFontEngine::antialiasingThreshold = appleValue.toInt();
-
/*
font_smoothing = 0 means no smoothing, while 1-3 means subpixel
antialiasing with different hinting styles (but we don't care about the
exact value, only if subpixel rendering is available or not)
*/
int font_smoothing = 0;
+
+#if QT_CONFIG(settings)
+ QSettings appleSettings(QLatin1String("apple.com"));
+ QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold"));
+ if (appleValue.isValid())
+ QCoreTextFontEngine::antialiasingThreshold = appleValue.toInt();
+
appleValue = appleSettings.value(QLatin1String("AppleFontSmoothing"));
if (appleValue.isValid()) {
font_smoothing = appleValue.toInt();
- } else {
+ } else
+#endif // settings
+ {
// non-Apple displays do not provide enough information about subpixel rendering so
// draw text with cocoa and compare pixel colors to see if subpixel rendering is enabled
int w = 10;
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 98b753eff9..57ae622891 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -41,7 +41,9 @@
#include <qpa/qplatformfontdatabase.h>
#include <QtCore/qendian.h>
+#if QT_CONFIG(settings)
#include <QtCore/qsettings.h>
+#endif
#include <private/qimage_p.h>
diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
index cb1e367b9f..e63eb3b5b2 100644
--- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp
+++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
@@ -45,7 +45,9 @@
#if QT_CONFIG(process)
# include <QtCore/QProcess>
#endif
+#if QT_CONFIG(settings)
#include <QtCore/QSettings>
+#endif
#include <QtCore/QStandardPaths>
#include <QtCore/QUrl>
@@ -93,7 +95,7 @@ static inline QByteArray detectDesktopEnvironment()
// This can be a path in /usr/share/xsessions
int slash = desktopSession.lastIndexOf('/');
if (slash != -1) {
-#ifndef QT_NO_SETTINGS
+#if QT_CONFIG(settings)
QSettings desktopFile(QFile::decodeName(desktopSession + ".desktop"), QSettings::IniFormat);
desktopFile.beginGroup(QStringLiteral("Desktop Entry"));
QByteArray desktopName = desktopFile.value(QStringLiteral("DesktopNames")).toByteArray();
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 43d49cbbc8..1003812767 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -53,7 +53,9 @@
#include <QtCore/QMimeDatabase>
#endif
#include <QtCore/QLoggingCategory>
+#if QT_CONFIG(settings)
#include <QtCore/QSettings>
+#endif
#include <QtCore/QVariant>
#include <QtCore/QStandardPaths>
#include <QtCore/QStringList>
@@ -261,7 +263,7 @@ static QIcon xdgFileIcon(const QFileInfo &fileInfo)
}
#endif
-#ifndef QT_NO_SETTINGS
+#if QT_CONFIG(settings)
class QKdeThemePrivate : public QPlatformThemePrivate
{
public:
@@ -688,7 +690,7 @@ QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const
}
#endif
-#endif // QT_NO_SETTINGS
+#endif // settings
/*!
\class QGnomeTheme
@@ -834,7 +836,7 @@ QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)
{
if (name == QLatin1String(QGenericUnixTheme::name))
return new QGenericUnixTheme;
-#ifndef QT_NO_SETTINGS
+#if QT_CONFIG(settings)
if (name == QLatin1String(QKdeTheme::name))
if (QPlatformTheme *kdeTheme = QKdeTheme::createKdeTheme())
return kdeTheme;
@@ -859,7 +861,7 @@ QStringList QGenericUnixTheme::themeNames()
const QList<QByteArray> desktopNames = desktopEnvironment.split(':');
for (const QByteArray &desktopName : desktopNames) {
if (desktopEnvironment == "KDE") {
-#ifndef QT_NO_SETTINGS
+#if QT_CONFIG(settings)
result.push_back(QLatin1String(QKdeTheme::name));
#endif
} else if (gtkBasedEnvironments.contains(desktopName)) {
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
index 865a624694..a5963b79ea 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
@@ -96,7 +96,7 @@ public:
static const char *name;
};
-#ifndef QT_NO_SETTINGS
+#if QT_CONFIG(settings)
class QKdeThemePrivate;
class QKdeTheme : public QPlatformTheme
@@ -123,7 +123,7 @@ public:
static const char *name;
};
-#endif // QT_NO_SETTINGS
+#endif // settings
class QGnomeThemePrivate;