Remove Library dependency on Settings
authorTasuku Suzuki <tasuku.suzuki@nokia.com>
Tue, 29 May 2012 01:21:13 +0000 (10:21 +0900)
committerQt by Nokia <qt-info@nokia.com>
Mon, 9 Jul 2012 09:18:17 +0000 (11:18 +0200)
made QLibraryInfo available with QT_NO_SETTINGS.
QKdeTheme is removed when QT_NO_SETTINGS is defined.

Change-Id: I63d619bb305e6c23985d9ea50c72d39a697b7a4b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
14 files changed:
src/corelib/global/qfeatures.h
src/corelib/global/qfeatures.txt
src/corelib/global/qlibraryinfo.cpp
src/corelib/global/qlibraryinfo.h
src/corelib/kernel/qcoreapplication.cpp
src/gui/image/qicon.cpp
src/gui/kernel/qplatformintegrationfactory.cpp
src/gui/kernel/qplatformthemefactory.cpp
src/gui/text/qfontengine_qpf.cpp
src/gui/text/qplatformfontdatabase.cpp
src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
src/printsupport/kernel/qplatformprintplugin.cpp
src/widgets/styles/qstylefactory.cpp

index 7d1551a..c51b090 100644 (file)
 #define QT_NO_ICONV
 #endif
 
-// QLibrary
-#if !defined(QT_NO_LIBRARY) && (defined(QT_NO_SETTINGS))
-#define QT_NO_LIBRARY
-#endif
-
 // QMenu
 #if !defined(QT_NO_MENU) && (defined(QT_NO_ACTION))
 #define QT_NO_MENU
index 564884c..f0b3e4e 100644 (file)
@@ -188,7 +188,7 @@ SeeAlso: ???
 Feature: LIBRARY
 Description: Supports a shared library wrapper.
 Section: File I/O
-Requires: SETTINGS
+Requires:
 Name: QLibrary
 SeeAlso: ???
 
index 1bd17ce..9953eef 100644 (file)
@@ -162,6 +162,8 @@ QSettings *QLibraryInfoPrivate::findConfiguration()
     return 0;     //no luck
 }
 
+#endif // QT_NO_SETTINGS
+
 /*!
     \class QLibraryInfo
     \brief The QLibraryInfo class provides information about the Qt library.
@@ -306,7 +308,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
     if (!QLibraryInfoPrivate::haveGroup(group)
         && (group == FinalPaths
             || !(group = FinalPaths, QLibraryInfoPrivate::haveGroup(FinalPaths))))
-#else
+#elif !defined(QT_NO_SETTINGS)
     if (!QLibraryInfoPrivate::configuration())
 #endif
     {
@@ -320,6 +322,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
 
         if (path)
             ret = QString::fromLocal8Bit(path);
+#ifndef QT_NO_SETTINGS
     } else {
         QString key;
         QString defaultValue;
@@ -362,6 +365,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
 
             ret = QDir::fromNativeSeparators(ret);
         }
+#endif // QT_NO_SETTINGS
     }
 
     if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
@@ -427,8 +431,6 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
     \sa location()
 */
 
-#endif // QT_NO_SETTINGS
-
 QT_END_NAMESPACE
 
 #if defined(Q_CC_GNU) && defined(ELF_INTERPRETER)
index 5861b4b..1b7ff2b 100644 (file)
@@ -49,9 +49,6 @@ QT_BEGIN_HEADER
 
 QT_BEGIN_NAMESPACE
 
-
-#ifndef QT_NO_SETTINGS
-
 class Q_CORE_EXPORT QLibraryInfo
 {
 public:
@@ -98,8 +95,6 @@ private:
     QLibraryInfo();
 };
 
-#endif /* QT_NO_SETTINGS */
-
 QT_END_NAMESPACE
 
 QT_END_HEADER
index e714067..d24cbc7 100644 (file)
@@ -402,7 +402,7 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)
 
 void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
 {
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
     QStringList *app_libpaths = coreappdata()->app_libpaths;
     Q_ASSERT(app_libpaths);
     QString app_location( QCoreApplication::applicationFilePath() );
@@ -589,7 +589,7 @@ void QCoreApplication::init()
 
     d->threadData->eventDispatcher = QCoreApplicationPrivate::eventDispatcher;
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
     if (!coreappdata()->app_libpaths) {
         // make sure that library paths is initialized
         libraryPaths();
index 9cfc847..3916672 100644 (file)
@@ -826,7 +826,7 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
     if (fileName.isEmpty())
         return;
     if (!d) {
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
         QFileInfo info(fileName);
         QString suffix = info.suffix();
         if (!suffix.isEmpty()) {
@@ -1085,7 +1085,7 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
             QIconEngine *engine = new QIconLoaderEngine();
             icon.d->engine = engine;
             engine->read(s);
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
         } else {
             const int index = loader()->indexOf(key);
             if (index != -1) {
index 886f50b..d1860da 100644 (file)
@@ -50,7 +50,7 @@
 
 QT_BEGIN_NAMESPACE
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
     (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive))
 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
@@ -62,7 +62,7 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key, co
     QStringList paramList = key.split(QLatin1Char(':'));
     const QString platform = paramList.takeFirst().toLower();
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
     // Try loading the plugin from platformPluginPath first:
     if (!platformPluginPath.isEmpty()) {
         QCoreApplication::addLibraryPath(platformPluginPath);
@@ -84,7 +84,7 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key, co
 
 QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)
 {
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
     QStringList list;
     if (!platformPluginPath.isEmpty()) {
         QCoreApplication::addLibraryPath(platformPluginPath);
index cc20399..031e3e1 100644 (file)
@@ -50,7 +50,7 @@
 
 QT_BEGIN_NAMESPACE
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
     (QPlatformThemeFactoryInterface_iid, QLatin1String("/platformthemes"), Qt::CaseInsensitive))
 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
@@ -62,7 +62,7 @@ QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString
     QStringList paramList = key.split(QLatin1Char(':'));
     const QString platform = paramList.takeFirst().toLower();
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
     // Try loading the plugin from platformPluginPath first:
     if (!platformPluginPath.isEmpty()) {
         QCoreApplication::addLibraryPath(platformPluginPath);
@@ -83,7 +83,7 @@ QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString
 */
 QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath)
 {
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
     QStringList list;
 
     if (!platformPluginPath.isEmpty()) {
index 23f263b..3299dc1 100644 (file)
@@ -449,9 +449,7 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng
     freetype = QFreetypeFace::getFace(face_id);
     if (!freetype) {
         QString newPath =
-#ifndef QT_NO_SETTINGS
             QLibraryInfo::location(QLibraryInfo::LibrariesPath) +
-#endif
                           QLatin1String("/fonts/") +
                           QFileInfo(QFile::decodeName(face_id.filename)).fileName();
         face_id.filename = QFile::encodeName(newPath);
index 7e2b890..a101165 100644 (file)
@@ -353,10 +353,8 @@ QString QPlatformFontDatabase::fontDir() const
 {
     QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR"));
     if (fontpath.isEmpty()) {
-#ifndef QT_NO_SETTINGS
         fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
         fontpath += QLatin1String("/fonts");
-#endif
     }
 
     return fontpath;
index d4826fb..970b57d 100644 (file)
@@ -124,6 +124,8 @@ QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const
     return QPlatformTheme::themeHint(hint);
 }
 
+#ifndef QT_NO_SETTINGS
+
 // Reads the color from the KDE configuration, and store it in the
 // palette with the given color role if found.
 static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role,
@@ -326,6 +328,8 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
      return 0;
 }
 
+#endif // QT_NO_SETTINGS
+
 /*!
     \class QGnomeTheme
     \brief QGnomeTheme is a theme implementation for the Gnome desktop.
@@ -369,9 +373,11 @@ QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)
 {
     if (name == QLatin1String(QGenericUnixTheme::name))
         return new QGenericUnixTheme;
+#ifndef QT_NO_SETTINGS
     if (name == QLatin1String(QKdeTheme::name))
         if (QPlatformTheme *kdeTheme = QKdeTheme::createKdeTheme())
             return kdeTheme;
+#endif
     if (name == QLatin1String(QGnomeTheme::name))
         return new QGnomeTheme;
     return new QGenericUnixTheme;
@@ -382,7 +388,9 @@ QStringList QGenericUnixTheme::themeNames()
     QStringList result;
     if (QGuiApplication::desktopSettingsAware()) {
         if (QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment() == QByteArray("KDE")) {
+#ifndef QT_NO_SETTINGS
             result.push_back(QLatin1String(QKdeTheme::name));
+#endif
         } else if (QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment() == QByteArray("GNOME")) {
             result.push_back(QLatin1String(QGnomeTheme::name));
         }
index a1b5086..64b2db0 100644 (file)
@@ -77,6 +77,7 @@ public:
     static const char *name;
 };
 
+#ifndef QT_NO_SETTINGS
 class QKdeTheme : public QPlatformTheme
 {
     QKdeTheme(const QString &kdeHome, int kdeVersion);
@@ -107,6 +108,7 @@ private:
     int m_toolButtonStyle;
     int m_toolBarIconSize;
 };
+#endif // QT_NO_SETTINGS
 
 class QGnomeTheme : public QPlatformTheme
 {
index 854d881..d4685e2 100644 (file)
@@ -44,7 +44,7 @@
 
 QT_BEGIN_NAMESPACE
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
     (QPlatformPrinterSupportFactoryInterface_iid, QLatin1String("/printsupport"), Qt::CaseInsensitive))
 #endif
index 479cc1a..450ad20 100644 (file)
@@ -180,7 +180,7 @@ QStyle *QStyleFactory::create(const QString& key)
     } else
 #endif
     { } // Keep these here - they make the #ifdefery above work
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
     if (!ret)
         ret = qLoadPlugin<QStyle, QStylePlugin>(loader(), style);
 #endif
@@ -198,7 +198,7 @@ QStyle *QStyleFactory::create(const QString& key)
 QStringList QStyleFactory::keys()
 {
     QStringList list;
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+#ifndef QT_NO_LIBRARY
     typedef QMultiMap<int, QString> PluginKeyMap;
     typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;