Add command line parameter for overriding the system icon theme
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 25 Oct 2014 20:35:01 +0000 (22:35 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sat, 25 Oct 2014 21:16:33 +0000 (23:16 +0200)
Quassel uses many icons that are not part of the freedesktop naming
spec, but supported by KDE icon themes. If Quassel is run in
another environment, such as GNOME, which would select a non-KDE icon
theme, there may be missing icons.

In such cases, it is recommended to install the Oxygen icon theme and
start the Quassel client with '--icontheme=oxygen' to override the
system setting. Of course, you are free to choose any other theme as
well.

Note that oxygen is already selected as a fallback if the platform does
not tell Qt about its icon theme (for example, on non-Linux platforms).

src/common/main.cpp
src/qtui/qtuiapplication.cpp

index b973bba..31340cc 100644 (file)
@@ -116,6 +116,7 @@ int main(int argc, char **argv)
 
 #ifndef BUILD_CORE
     // put client-only arguments here
+    cliParser->addOption("icontheme <theme>", 0, "Override the system icon theme ('oxygen' is recommended)");
     cliParser->addOption("qss <file.qss>", 0, "Load a custom application stylesheet");
     cliParser->addSwitch("debugbufferswitches", 0, "Enables debugging for bufferswitches");
     cliParser->addSwitch("debugmodel", 0, "Enables debugging for models");
index 5bf11bb..3d1d378 100644 (file)
@@ -68,10 +68,6 @@ QtUiApplication::QtUiApplication(int &argc, char **argv)
 #else
     qInstallMessageHandler(Client::logMessage);
 #endif
-
-    // Some platforms don't set a default icon theme; chances are we can find our bundled Oxygen theme though
-    if (QIcon::themeName().isEmpty())
-        QIcon::setThemeName("oxygen");
 }
 
 
@@ -122,6 +118,13 @@ bool QtUiApplication::init()
             return false;
         }
 
+        // Set the icon theme
+        if (Quassel::isOptionSet("icontheme"))
+            QIcon::setThemeName(Quassel::optionValue("icontheme"));
+        else if (QIcon::themeName().isEmpty())
+            // Some platforms don't set a default icon theme; chances are we can find our bundled Oxygen theme though
+            QIcon::setThemeName("oxygen");
+
         // session resume
         QtUi *gui = new QtUi();
         Client::init(gui);