diff options
Diffstat (limited to 'src/platformsupport/themes/genericunix/qgenericunixthemes.cpp')
-rw-r--r-- | src/platformsupport/themes/genericunix/qgenericunixthemes.cpp | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index e66fdeb7c3..1060ff283b 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -135,6 +135,11 @@ QStringList QGenericUnixTheme::xdgIconThemePaths() if (xdgIconsDir.isDir()) paths.append(xdgIconsDir.absoluteFilePath()); } + + const QFileInfo pixmapsIconsDir(QStringLiteral("/usr/share/pixmaps")); + if (pixmapsIconsDir.isDir()) + paths.append(pixmapsIconsDir.absoluteFilePath()); + return paths; } @@ -170,6 +175,7 @@ public: , toolButtonStyle(Qt::ToolButtonTextBesideIcon) , toolBarIconSize(0) , singleClick(true) + , wheelScrollLines(3) { } static QString kdeGlobals(const QString &kdeDir) @@ -193,6 +199,7 @@ public: int toolButtonStyle; int toolBarIconSize; bool singleClick; + int wheelScrollLines; }; void QKdeThemePrivate::refresh() @@ -242,6 +249,10 @@ void QKdeThemePrivate::refresh() toolButtonStyle = Qt::ToolButtonTextUnderIcon; } + const QVariant wheelScrollLinesValue = readKdeSetting(QStringLiteral("KDE/WheelScrollLines"), kdeDirs, kdeSettings); + if (wheelScrollLinesValue.isValid()) + wheelScrollLines = wheelScrollLinesValue.toInt(); + // Read system font, ignore 'smallestReadableFont' if (QFont *systemFont = kdeFont(readKdeSetting(QStringLiteral("font"), kdeDirs, kdeSettings))) resources.fonts[QPlatformTheme::SystemFont] = systemFont; @@ -428,6 +439,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const return QVariant(int(KdeKeyboardScheme)); case QPlatformTheme::ItemViewActivateItemOnSingleClick: return QVariant(d->singleClick); + case QPlatformTheme::WheelScrollLines: + return QVariant(d->wheelScrollLines); default: break; } @@ -624,20 +637,25 @@ QStringList QGenericUnixTheme::themeNames() QStringList result; if (QGuiApplication::desktopSettingsAware()) { const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - if (desktopEnvironment == "KDE") { + QList<QByteArray> gtkBasedEnvironments; + gtkBasedEnvironments << "GNOME" + << "X-CINNAMON" + << "UNITY" + << "MATE" + << "XFCE" + << "LXDE"; + QList<QByteArray> desktopNames = desktopEnvironment.split(':'); + Q_FOREACH (const QByteArray &desktopName, desktopNames) { + if (desktopEnvironment == "KDE") { #ifndef QT_NO_SETTINGS - result.push_back(QLatin1String(QKdeTheme::name)); + result.push_back(QLatin1String(QKdeTheme::name)); #endif - } else if (desktopEnvironment == "GNOME" || - desktopEnvironment == "X-CINNAMON" || - desktopEnvironment == "UNITY" || - desktopEnvironment == "MATE" || - desktopEnvironment == "XFCE" || - desktopEnvironment == "LXDE") { // Gtk-based desktops - // prefer the GTK2 theme implementation with native dialogs etc. - result.push_back(QStringLiteral("gtk2")); - // fallback to the generic Gnome theme if loading the GTK2 theme fails - result.push_back(QLatin1String(QGnomeTheme::name)); + } else if (gtkBasedEnvironments.contains(desktopName)) { + // prefer the GTK2 theme implementation with native dialogs etc. + result.push_back(QStringLiteral("gtk2")); + // fallback to the generic Gnome theme if loading the GTK2 theme fails + result.push_back(QLatin1String(QGnomeTheme::name)); + } } const QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION")); if (!session.isEmpty() && session != QLatin1String("default") && !result.contains(session)) |