diff options
author | Liang Qi <liang.qi@qt.io> | 2018-11-12 09:40:47 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-11-15 17:20:15 +0000 |
commit | 527406cbd99f44470ef87468b73c18df949e8ac7 (patch) | |
tree | 4ee73cffee4bf8699ce45d902aa9b30c6ebb1cc4 /src/corelib | |
parent | cd201b2c2c2849fea0c5a38ffd979cd9d5b24997 (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/corelib')
-rw-r--r-- | src/corelib/global/qconfig-bootstrapped.h | 2 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 14 | ||||
-rw-r--r-- | src/corelib/io/io.pri | 26 | ||||
-rw-r--r-- | src/corelib/io/qsettings.cpp | 4 | ||||
-rw-r--r-- | src/corelib/io/qsettings.h | 7 | ||||
-rw-r--r-- | src/corelib/io/qsettings_mac.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qsettings_win.cpp | 3 | ||||
-rw-r--r-- | src/corelib/io/qsettings_winrt.cpp | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_p.h | 2 |
9 files changed, 31 insertions, 32 deletions
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 229b4d17a1..f62137fe66 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -126,11 +126,13 @@ #define QT_FEATURE_commandlineparser -1 #define QT_NO_COMPRESS #define QT_JSON_READONLY +#define QT_FEATURE_settings 1 #define QT_NO_STANDARDPATHS #define QT_FEATURE_textcodec -1 #else #define QT_FEATURE_codecs -1 #define QT_FEATURE_commandlineparser 1 +#define QT_FEATURE_settings -1 #define QT_FEATURE_textcodec 1 #endif diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index e727f00c8e..4119012d85 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -41,7 +41,9 @@ #include "qdir.h" #include "qstringlist.h" #include "qfile.h" +#if QT_CONFIG(settings) #include "qsettings.h" +#endif #include "qlibraryinfo.h" #include "qscopedpointer.h" @@ -67,7 +69,7 @@ QT_BEGIN_NAMESPACE extern void qDumpCPUFeatures(); // in qsimd.cpp -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) struct QLibrarySettings { @@ -204,7 +206,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration() return 0; //no luck } -#endif // QT_NO_SETTINGS +#endif // settings /*! \class QLibraryInfo @@ -464,7 +466,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) #endif // QT_BUILD_QMAKE, started inside location ! QString ret; bool fromConf = false; -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) #ifdef QT_BUILD_QMAKE // Logic for choosing the right data source: if EffectivePaths are requested // and qt.conf with that section is present, use it, otherwise fall back to @@ -547,7 +549,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) ret = QDir::fromNativeSeparators(ret); } } -#endif // QT_NO_SETTINGS +#endif // settings #ifndef QT_BUILD_QMAKE_BOOTSTRAP if (!fromConf) { @@ -646,7 +648,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) { -#if !defined(QT_BUILD_QMAKE) && !defined(QT_NO_SETTINGS) +#if !defined(QT_BUILD_QMAKE) && QT_CONFIG(settings) QScopedPointer<const QSettings> settings(QLibraryInfoPrivate::findConfiguration()); if (!settings.isNull()) { const QString key = QLatin1String(platformsSection) @@ -657,7 +659,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) } #else Q_UNUSED(platformName); -#endif // !QT_BUILD_QMAKE && !QT_NO_SETTINGS +#endif // !QT_BUILD_QMAKE && settings return QStringList(); } diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index c6a5407e51..086d642c26 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -34,8 +34,6 @@ HEADERS += \ io/qurlquery.h \ io/qurltlds_p.h \ io/qtldurl_p.h \ - io/qsettings.h \ - io/qsettings_p.h \ io/qfsfileengine_p.h \ io/qfsfileengine_iterator_p.h \ io/qfilesystementry_p.h \ @@ -73,7 +71,6 @@ SOURCES += \ io/qurlidna.cpp \ io/qurlquery.cpp \ io/qurlrecode.cpp \ - io/qsettings.cpp \ io/qfsfileengine.cpp \ io/qfsfileengine_iterator.cpp \ io/qfilesystementry.cpp \ @@ -121,6 +118,24 @@ qtConfig(processenvironment) { SOURCES += io/qprocess_unix.cpp } +qtConfig(settings) { + SOURCES += \ + io/qsettings.cpp + HEADERS += \ + io/qsettings.h \ + io/qsettings_p.h + + win32 { + !winrt { + SOURCES += io/qsettings_win.cpp + } else { + SOURCES += io/qsettings_winrt.cpp + } + } else: darwin:!nacl { + SOURCES += io/qsettings_mac.cpp + } +} + win32 { SOURCES += io/qfsfileengine_win.cpp SOURCES += io/qlockfile_win.cpp @@ -136,7 +151,6 @@ win32 { io/qwindowspipewriter_p.h SOURCES += \ - io/qsettings_win.cpp \ io/qstandardpaths_win.cpp \ io/qstorageinfo_win.cpp \ io/qwindowspipereader.cpp \ @@ -146,7 +160,6 @@ win32 { } else { SOURCES += \ io/qstandardpaths_winrt.cpp \ - io/qsettings_winrt.cpp \ io/qstorageinfo_stub.cpp } } else:unix { @@ -162,9 +175,6 @@ win32 { ../3rdparty/forkfd/forkfd.h INCLUDEPATH += ../3rdparty/forkfd } - !nacl:mac: { - SOURCES += io/qsettings_mac.cpp - } mac { SOURCES += io/qstorageinfo_mac.cpp qtConfig(processenvironment): \ diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 580fe6caf3..68e77c4167 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -41,8 +41,6 @@ #include "qplatformdefs.h" #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qcache.h" #include "qfile.h" @@ -3573,5 +3571,3 @@ QT_END_NAMESPACE #ifndef QT_BOOTSTRAPPED #include "moc_qsettings.cpp" #endif - -#endif // QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h index ccfec787a6..7a9eebe11b 100644 --- a/src/corelib/io/qsettings.h +++ b/src/corelib/io/qsettings.h @@ -45,10 +45,7 @@ #include <QtCore/qstring.h> #include <QtCore/qscopedpointer.h> -QT_BEGIN_NAMESPACE -QT_END_NAMESPACE - -#ifndef QT_NO_SETTINGS +QT_REQUIRE_CONFIG(settings); #include <ctype.h> @@ -208,6 +205,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_SETTINGS - #endif // QSETTINGS_H diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index aa14d8435a..9a1b578f7e 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qsettings.h" -#ifndef QT_NO_SETTINGS #include "qsettings_p.h" #include "qdatetime.h" @@ -664,4 +663,3 @@ bool QConfFileSettingsPrivate::writePlistFile(QIODevice &file, const ParsedSetti } QT_END_NAMESPACE -#endif //QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index edcae16776..bbaf45a95b 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -39,8 +39,6 @@ #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qvector.h" #include "qmap.h" @@ -859,4 +857,3 @@ QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::F } QT_END_NAMESPACE -#endif // QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp index 209b56d920..c54e5861f0 100644 --- a/src/corelib/io/qsettings_winrt.cpp +++ b/src/corelib/io/qsettings_winrt.cpp @@ -39,8 +39,6 @@ #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qvector.h" #include "qmap.h" @@ -690,4 +688,3 @@ QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::F } QT_END_NAMESPACE -#endif // QT_NO_SETTINGS diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index cd995c17f1..b3479414ab 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -53,7 +53,9 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qtranslator.h" +#if QT_CONFIG(settings) #include "QtCore/qsettings.h" +#endif #ifndef QT_NO_QOBJECT #include "private/qobject_p.h" #endif |