X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fqtui%2Fqtui.cpp;h=d335d0783a768edb2d9f7f4c23636073e53cb296;hb=b40672ab5c48b577b31371c159e60d330fdd7ce5;hp=2cfc810260678ea0312506788a4dd29beef759e7;hpb=9f0918fca1d858523104435690e5094bfe6244b7;p=quassel.git diff --git a/src/qtui/qtui.cpp b/src/qtui/qtui.cpp index 2cfc8102..d335d078 100644 --- a/src/qtui/qtui.cpp +++ b/src/qtui/qtui.cpp @@ -30,6 +30,7 @@ #include "buffermodel.h" #include "chatlinemodel.h" #include "contextmenuactionprovider.h" +#include "icon.h" #include "mainwin.h" #include "qtuimessageprocessor.h" #include "qtuisettings.h" @@ -39,21 +40,30 @@ #include "types.h" #include "util.h" -QtUi *QtUi::_instance = nullptr; MainWin *QtUi::_mainWin = nullptr; QList QtUi::_notificationBackends; QList QtUi::_notifications; +namespace { + +QtUi *_instance{nullptr}; + +} + + +QtUi *QtUi::instance() +{ + if (!_instance) { + _instance = new QtUi(); + } + return _instance; +} + + QtUi::QtUi() : GraphicalUi() , _systemIconTheme{QIcon::themeName()} { - if (_instance != nullptr) { - qWarning() << "QtUi has been instantiated again!"; - return; - } - _instance = this; - if (Quassel::isOptionSet("icontheme")) { _systemIconTheme = Quassel::optionValue("icontheme"); QIcon::setThemeName(_systemIconTheme); @@ -64,7 +74,7 @@ QtUi::QtUi() setupIconTheme(); - QApplication::setWindowIcon(QIcon::fromTheme("quassel")); + QApplication::setWindowIcon(icon::get("quassel")); setContextMenuActionProvider(new ContextMenuActionProvider(this)); setToolBarActionProvider(new ToolBarActionProvider(this)); @@ -273,7 +283,9 @@ std::vector> QtUi::availableIconThemes() const static const std::vector> supported { { "breeze", tr("Breeze") }, { "breeze-dark", tr("Breeze Dark") }, +#ifdef WITH_OXYGEN_ICONS { "oxygen", tr("Oxygen") } +#endif }; std::vector> result; @@ -290,6 +302,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 @@ -336,7 +354,7 @@ void QtUi::refreshIconTheme() } } - if (_systemIconTheme.isEmpty() || _systemIconTheme == fallbackTheme || s.value("Icons/OverrideSystemTheme", false).toBool()) { + if (_systemIconTheme.isEmpty() || _systemIconTheme == fallbackTheme || s.value("Icons/OverrideSystemTheme", true).toBool()) { // We have a valid fallback theme and want to override the system theme (if it's even defined), so we're basically done QIcon::setThemeName(fallbackTheme); emit iconThemeRefreshed();