From: Manuel Nickschas Date: Thu, 14 Jun 2018 19:47:26 +0000 (+0200) Subject: qtui: Hide "fallback" and "Override" if no system theme is configured X-Git-Tag: travis-deploy-test~27 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=911f181e0e179eb51279c0880eb701a43163b8b5;ds=sidebyside qtui: Hide "fallback" and "Override" if no system theme is configured On platforms that don't support icon themes, it does not make sense to show related options in appearance settings. Hide the override option in that case, and change wording from "Fallback icon theme" to just "Icon theme". --- diff --git a/src/qtui/qtui.cpp b/src/qtui/qtui.cpp index 2cfc8102..7b658b9c 100644 --- a/src/qtui/qtui.cpp +++ b/src/qtui/qtui.cpp @@ -290,6 +290,12 @@ std::vector> QtUi::availableIconThemes() const } +QString QtUi::systemIconTheme() const +{ + return _systemIconTheme; +} + + void QtUi::setupIconTheme() { // Add paths to our own icon sets to the theme search paths diff --git a/src/qtui/qtui.h b/src/qtui/qtui.h index e54fb244..0e3cad7c 100644 --- a/src/qtui/qtui.h +++ b/src/qtui/qtui.h @@ -74,6 +74,19 @@ public: */ std::vector> availableIconThemes() const; + /** + * Determine the system icon theme set when Quassel was started. + * + * This property stores the icon theme initially configured in Qt when starting up (may be empty on platforms + * not supporting system icon themes). If the --icontheme option is given, uses that. + * + * Since Qt does not support notifications on theme changes, this property will not be updated when the theme + * changes at runtime. + * + * @returns The system icon theme at startup time + */ + QString systemIconTheme() const; + public slots: void init() override; diff --git a/src/qtui/settingspages/appearancesettingspage.cpp b/src/qtui/settingspages/appearancesettingspage.cpp index 31564334..1a25533f 100644 --- a/src/qtui/settingspages/appearancesettingspage.cpp +++ b/src/qtui/settingspages/appearancesettingspage.cpp @@ -45,6 +45,13 @@ AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent) ui.overrideSystemIconTheme->hide(); #endif + // If no system icon theme is given, showing the override option makes no sense. + // Also don't mention a "fallback". + if (QtUi::instance()->systemIconTheme().isEmpty()) { + ui.iconThemeLabel->setText(tr("Icon theme:")); + ui.overrideSystemIconTheme->hide(); + } + initAutoWidgets(); initStyleComboBox(); initLanguageComboBox(); diff --git a/src/qtui/settingspages/appearancesettingspage.ui b/src/qtui/settingspages/appearancesettingspage.ui index aa0cf160..03383535 100644 --- a/src/qtui/settingspages/appearancesettingspage.ui +++ b/src/qtui/settingspages/appearancesettingspage.ui @@ -68,7 +68,7 @@ - + Fallback icon theme: