X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Flegacysystemtray.cpp;h=3fbe1dcac2129556ac91b31315e12a866591dd71;hb=61f33c7895e324f6e95034d86897ad2e963653f1;hp=0f1135a43180aefa4abe0d6a15bdbee91a3c2013;hpb=a888a2886dc1466eb0b1bb3591f43350623c6330;p=quassel.git diff --git a/src/qtui/legacysystemtray.cpp b/src/qtui/legacysystemtray.cpp index 0f1135a4..3fbe1dca 100644 --- a/src/qtui/legacysystemtray.cpp +++ b/src/qtui/legacysystemtray.cpp @@ -20,40 +20,34 @@ #ifndef QT_NO_SYSTEMTRAYICON -#include - #include "legacysystemtray.h" + +#include "icon.h" #include "mainwin.h" #include "qtui.h" LegacySystemTray::LegacySystemTray(QWidget *parent) : SystemTray(parent) + , _trayIcon{new QSystemTrayIcon(associatedWidget())} { -#ifndef HAVE_KDE4 - _trayIcon = new QSystemTrayIcon(associatedWidget()); -#else - _trayIcon = new KSystemTrayIcon(associatedWidget()); - // We don't want to trigger a minimize if a highlight is pending, so we brutally remove the internal connection for that - disconnect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - _trayIcon, SLOT(activateOrHide(QSystemTrayIcon::ActivationReason))); -#endif + #ifndef Q_OS_MAC - connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - SLOT(onActivated(QSystemTrayIcon::ActivationReason))); + connect(_trayIcon, &QSystemTrayIcon::activated, + this, &LegacySystemTray::onActivated); #endif - connect(_trayIcon, SIGNAL(messageClicked()), - SLOT(onMessageClicked())); + connect(_trayIcon, &QSystemTrayIcon::messageClicked, + this, &LegacySystemTray::onMessageClicked); _trayIcon->setContextMenu(trayMenu()); _trayIcon->setVisible(false); setMode(Mode::Legacy); - connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(onVisibilityChanged(bool))); - connect(this, SIGNAL(modeChanged(Mode)), this, SLOT(onModeChanged(Mode))); - connect(this, SIGNAL(toolTipChanged(QString, QString)), SLOT(updateToolTip())); - connect(this, SIGNAL(iconsChanged()), this, SLOT(updateIcon())); - connect(this, SIGNAL(currentIconNameChanged()), this, SLOT(updateIcon())); + connect(this, &SystemTray::visibilityChanged, this, &LegacySystemTray::onVisibilityChanged); + connect(this, &SystemTray::modeChanged, this, &LegacySystemTray::onModeChanged); + connect(this, &SystemTray::toolTipChanged, this, &LegacySystemTray::updateToolTip); + connect(this, &SystemTray::iconsChanged, this, &LegacySystemTray::updateIcon); + connect(this, &SystemTray::currentIconNameChanged, this, &LegacySystemTray::updateIcon); updateIcon(); updateToolTip(); @@ -90,7 +84,7 @@ void LegacySystemTray::onModeChanged(Mode mode) void LegacySystemTray::updateIcon() { QString iconName = (state() == NeedsAttention) ? currentAttentionIconName() : currentIconName(); - _trayIcon->setIcon(QIcon::fromTheme(iconName, QIcon{QString{":/icons/hicolor/24x24/status/%1.svg"}.arg(iconName)})); + _trayIcon->setIcon(icon::get(iconName, QString{":/icons/hicolor/24x24/status/%1.svg"}.arg(iconName))); }