Update icon theme

main 0.5
reionwong 4 years ago
parent ec96e040fe
commit 3e80e6f04e

@ -31,7 +31,14 @@ HintsSettings::HintsSettings(QObject *parent)
: QObject(parent), : QObject(parent),
m_settings(new QSettings(QSettings::UserScope, "cutefishos", "theme")) m_settings(new QSettings(QSettings::UserScope, "cutefishos", "theme"))
{ {
m_iconTheme = m_settings->value("IconTheme", "Crule").toString();
if (m_iconTheme.contains("Crule"))
m_hints[QPlatformTheme::SystemIconThemeName] = darkMode() ? s_darkIconName : s_lightIconName; m_hints[QPlatformTheme::SystemIconThemeName] = darkMode() ? s_darkIconName : s_lightIconName;
else
m_hints[QPlatformTheme::SystemIconThemeName] = m_iconTheme;
m_hints[QPlatformTheme::SystemIconFallbackThemeName] = s_lightIconName;
m_hints[QPlatformTheme::StyleNames] = "cutefish"; m_hints[QPlatformTheme::StyleNames] = "cutefish";
m_hints[QPlatformTheme::SystemIconFallbackThemeName] = QStringLiteral("hicolor"); m_hints[QPlatformTheme::SystemIconFallbackThemeName] = QStringLiteral("hicolor");
m_hints[QPlatformTheme::IconThemeSearchPaths] = xdgIconThemePaths(); m_hints[QPlatformTheme::IconThemeSearchPaths] = xdgIconThemePaths();
@ -114,7 +121,17 @@ void HintsSettings::onFileChanged(const QString &path)
else if (value == s_darkModeName) { else if (value == s_darkModeName) {
emit darkModeChanged(newValue.toBool()); emit darkModeChanged(newValue.toBool());
// Need to update the icon to dark // Need to update the icon to dark
if (m_iconTheme.contains("Crule"))
m_hints[QPlatformTheme::SystemIconThemeName] = darkMode() ? s_darkIconName : s_lightIconName; m_hints[QPlatformTheme::SystemIconThemeName] = darkMode() ? s_darkIconName : s_lightIconName;
emit iconThemeChanged();
} else if (value == "IconTheme") {
if (!m_iconTheme.contains("Crule")) {
m_iconTheme = newValue.toString();
m_hints[QPlatformTheme::SystemIconThemeName] = m_iconTheme;
}
emit iconThemeChanged(); emit iconThemeChanged();
} }
} }

@ -52,6 +52,7 @@ private:
QString m_systemFont; QString m_systemFont;
QString m_systemFixedFont; QString m_systemFixedFont;
qreal m_systemFontPointSize; qreal m_systemFontPointSize;
QString m_iconTheme;
}; };
#endif //HINTSSETTINGS_H #endif //HINTSSETTINGS_H

@ -45,7 +45,8 @@ extern void updateXdgIconSystemTheme();
void onDarkModeChanged() void onDarkModeChanged()
{ {
if (qApp->applicationName() == "systemsettings" if (qApp->applicationName() == "systemsettings"
|| qApp->applicationName().contains("plasma")) { || qApp->applicationName().contains("plasma")
|| qApp->applicationName().contains("QtCreator")) {
return; return;
} }

Loading…
Cancel
Save