diff options
Diffstat (limited to 'src/corelib/global/qlibraryinfo.cpp')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1c3b09f602..6ad94b5067 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qdir.h" +#include "qstringlist.h" #include "qfile.h" #include "qsettings.h" #include "qlibraryinfo.h" @@ -113,6 +114,8 @@ public: } }; +static const char platformsSection[] = "Platforms"; + QLibrarySettings::QLibrarySettings() : settings(QLibraryInfoPrivate::findConfiguration()) { @@ -132,7 +135,8 @@ QLibrarySettings::QLibrarySettings() haveEffectivePaths = children.contains(QLatin1String("EffectivePaths")); #endif // Backwards compat: an existing but empty file is claimed to contain the Paths section. - havePaths = !haveEffectivePaths || children.contains(QLatin1String("Paths")); + havePaths = (!haveEffectivePaths && !children.contains(QLatin1String(platformsSection))) + || children.contains(QLatin1String("Paths")); #ifndef QT_BOOTSTRAPPED if (!havePaths) settings.reset(0); @@ -156,23 +160,23 @@ QSettings *QLibraryInfoPrivate::findConfiguration() #else if (!QFile::exists(qtconfig) && QCoreApplication::instance()) { #ifdef Q_OS_MAC - CFBundleRef bundleRef = CFBundleGetMainBundle(); + CFBundleRef bundleRef = CFBundleGetMainBundle(); if (bundleRef) { - QCFType<CFURLRef> urlRef = CFBundleCopyResourceURL(bundleRef, - QCFString(QLatin1String("qt.conf")), - 0, - 0); - if (urlRef) { - QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); - qtconfig = QDir::cleanPath(path); - } - } - if (qtconfig.isEmpty()) + QCFType<CFURLRef> urlRef = CFBundleCopyResourceURL(bundleRef, + QCFString(QLatin1String("qt.conf")), + 0, + 0); + if (urlRef) { + QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); + qtconfig = QDir::cleanPath(path); + } + } + if (qtconfig.isEmpty()) #endif { QDir pwd(QCoreApplication::applicationDirPath()); qtconfig = pwd.filePath(QLatin1String("qt.conf")); - } + } } #endif if (QFile::exists(qtconfig)) @@ -466,6 +470,33 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) } /*! + Returns additional arguments to the platform plugin matching + \a platformName which can be specified as a string list using + the key \c Arguments in a group called \c Platforms of the + \c qt.conf file. + + sa {Using qt.conf} + + \internal + + \since 5.3 +*/ + +QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) +{ +#ifndef QT_BOOTSTRAPPED + if (const QSettings *settings = QLibraryInfoPrivate::findConfiguration()) { + QString key = QLatin1String(platformsSection); + key += QLatin1Char('/'); + key += platformName; + key += QLatin1String("Arguments"); + return settings->value(key).toStringList(); + } +#endif // !QT_BOOTSTRAPPED + return QStringList(); +} + +/*! \enum QLibraryInfo::LibraryLocation \keyword library location |