qtui: Hide "fallback" and "Override" if no system theme is configured
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 14 Jun 2018 19:47:26 +0000 (21:47 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 15 Jun 2018 23:30:32 +0000 (01:30 +0200)
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".

src/qtui/qtui.cpp
src/qtui/qtui.h
src/qtui/settingspages/appearancesettingspage.cpp
src/qtui/settingspages/appearancesettingspage.ui

index 2cfc810..7b658b9 100644 (file)
@@ -290,6 +290,12 @@ std::vector<std::pair<QString, QString>> QtUi::availableIconThemes() const
 }
 
 
+QString QtUi::systemIconTheme() const
+{
+    return _systemIconTheme;
+}
+
+
 void QtUi::setupIconTheme()
 {
     // Add paths to our own icon sets to the theme search paths
index e54fb24..0e3cad7 100644 (file)
@@ -74,6 +74,19 @@ public:
      */
     std::vector<std::pair<QString, QString>> 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;
 
index 3156433..1a25533 100644 (file)
@@ -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();
index aa0cf16..0338353 100644 (file)
@@ -68,7 +68,7 @@
       </widget>
      </item>
      <item row="2" column="0">
-      <widget class="QLabel" name="iconthemeLabel">
+      <widget class="QLabel" name="iconThemeLabel">
        <property name="text">
         <string>Fallback icon theme:</string>
        </property>