X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Flegacysystemtray.h;h=15134b18c25250dbbc4a8c9f67c59444f652b6ba;hb=6a95ba6273599fa24e79fb008e38197448c29605;hp=635554f465714afeca1df4cf73f37597a83daab6;hpb=9d54503555534a2c554f09a33df6afa33d6308ec;p=quassel.git diff --git a/src/qtui/legacysystemtray.h b/src/qtui/legacysystemtray.h index 635554f4..15134b18 100644 --- a/src/qtui/legacysystemtray.h +++ b/src/qtui/legacysystemtray.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This file is free software; you can redistribute it and/or modify * @@ -18,12 +18,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef LEGACYSYSTEMTRAY_H_ -#define LEGACYSYSTEMTRAY_H_ +#pragma once #ifndef QT_NO_SYSTEMTRAYICON -#ifdef HAVE_KDE +#include + +#ifdef HAVE_KDE4 # include #else # include @@ -39,37 +40,31 @@ class LegacySystemTray : public SystemTray public: explicit LegacySystemTray(QWidget *parent); - virtual ~LegacySystemTray() {} - virtual void init(); - virtual bool isVisible() const; - virtual inline bool isSystemTrayAvailable() const; - virtual Icon stateIcon() const; // overriden to care about blinkState + bool isSystemTrayAvailable() const override; public slots: - virtual void setState(State state); - virtual void setVisible(bool visible = true); - virtual void showMessage(const QString &title, const QString &message, MessageIcon icon = Information, int msTimeout = 10000, uint notificationId = 0); - virtual void closeMessage(uint notificationId); - -protected slots: - -protected: - virtual void setMode(Mode mode); + void showMessage(const QString &title, const QString &message, MessageIcon icon = Information, int msTimeout = 10000, uint notificationId = 0) override; + void closeMessage(uint notificationId) override; private slots: - void on_blinkTimeout(); - void on_activated(QSystemTrayIcon::ActivationReason); - void on_messageClicked(); + void onModeChanged(Mode mode); + void onStateChanged(State state); + void onVisibilityChanged(bool isVisible); + + void onBlinkTimeout(); + void onActivated(QSystemTrayIcon::ActivationReason); + void onMessageClicked(); - void syncLegacyIcon(); + void updateIcon(); + void updateToolTip(); private: QTimer _blinkTimer; bool _blinkState; uint _lastMessageId; -#ifdef HAVE_KDE +#ifdef HAVE_KDE4 KSystemTrayIcon *_trayIcon; #else QSystemTrayIcon *_trayIcon; @@ -79,13 +74,7 @@ private: // inlines -bool LegacySystemTray::isSystemTrayAvailable() const -{ - return mode() == Legacy ? QSystemTrayIcon::isSystemTrayAvailable() - : SystemTray::isSystemTrayAvailable(); -} -#endif /* QT_NO_SYSTEMTRAYICON */ -#endif /* LEGACYSYSTEMTRAY_H_ */ +#endif /* QT_NO_SYSTEMTRAYICON */