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 <oswald.buddenhagen@nokia.com>
This commit is contained in:
Tasuku Suzuki 2012-05-29 10:21:13 +09:00 committed by Qt by Nokia
parent 5b0273fc7a
commit d04e06dc32
14 changed files with 29 additions and 31 deletions

View File

@ -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

View File

@ -188,7 +188,7 @@ SeeAlso: ???
Feature: LIBRARY
Description: Supports a shared library wrapper.
Section: File I/O
Requires: SETTINGS
Requires:
Name: QLibrary
SeeAlso: ???

View 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)

View 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

View 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();

View 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) {

View 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);

View 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()) {

View 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);

View 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;

View 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));
}

View 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
{

View 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

View 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;