From d04e06dc3279bd812d5a060c3f045b84ea345f35 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Tue, 29 May 2012 10:21:13 +0900 Subject: Remove Library dependency on Settings made QLibraryInfo available with QT_NO_SETTINGS. QKdeTheme is removed when QT_NO_SETTINGS is defined. Change-Id: I63d619bb305e6c23985d9ea50c72d39a697b7a4b Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qfeatures.h | 5 ----- src/corelib/global/qfeatures.txt | 2 +- src/corelib/global/qlibraryinfo.cpp | 8 +++++--- src/corelib/global/qlibraryinfo.h | 5 ----- src/corelib/kernel/qcoreapplication.cpp | 4 ++-- src/gui/image/qicon.cpp | 4 ++-- src/gui/kernel/qplatformintegrationfactory.cpp | 6 +++--- src/gui/kernel/qplatformthemefactory.cpp | 6 +++--- src/gui/text/qfontengine_qpf.cpp | 2 -- src/gui/text/qplatformfontdatabase.cpp | 2 -- src/platformsupport/themes/genericunix/qgenericunixthemes.cpp | 8 ++++++++ src/platformsupport/themes/genericunix/qgenericunixthemes_p.h | 2 ++ src/printsupport/kernel/qplatformprintplugin.cpp | 2 +- src/widgets/styles/qstylefactory.cpp | 4 ++-- 14 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 7d1551aab6..c51b090a6c 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -302,11 +302,6 @@ #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 diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 564884c381..f0b3e4e071 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -188,7 +188,7 @@ SeeAlso: ??? Feature: LIBRARY Description: Supports a shared library wrapper. Section: File I/O -Requires: SETTINGS +Requires: Name: QLibrary SeeAlso: ??? diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1bd17ce9ff..9953eef5e1 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -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) diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 5861b4b8bd..1b7ff2bfa3 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -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 diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e714067cb3..d24cbc7d58 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -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(); diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 9cfc8476aa..3916672c85 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -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) { diff --git a/src/gui/kernel/qplatformintegrationfactory.cpp b/src/gui/kernel/qplatformintegrationfactory.cpp index 886f50bdc6..d1860da126 100644 --- a/src/gui/kernel/qplatformintegrationfactory.cpp +++ b/src/gui/kernel/qplatformintegrationfactory.cpp @@ -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); diff --git a/src/gui/kernel/qplatformthemefactory.cpp b/src/gui/kernel/qplatformthemefactory.cpp index cc203991db..031e3e1b39 100644 --- a/src/gui/kernel/qplatformthemefactory.cpp +++ b/src/gui/kernel/qplatformthemefactory.cpp @@ -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()) { diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 23f263b0bd..3299dc1e0d 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -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); diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 7e2b890483..a101165aad 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -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; diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index d4826fb542..970b57de63 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -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)); } diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h index a1b50865ed..64b2db0a10 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h @@ -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 { diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp index 854d8810cc..d4685e264e 100644 --- a/src/printsupport/kernel/qplatformprintplugin.cpp +++ b/src/printsupport/kernel/qplatformprintplugin.cpp @@ -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 diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index 479cc1aab9..450ad20bca 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -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(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 PluginKeyMap; typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; -- cgit v1.2.3