X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Flegacysystemtray.h;h=7f1b66c501de73afd1cc7af42082cd3bb986e718;hp=196c6984232da08afba9d761cf2b0469ece44945;hb=e38846f054ad1766f2e91992a57bbaffd33c7c06;hpb=d0c0848307dab16108e855cab557be4a2f3d8d1b diff --git a/src/qtui/legacysystemtray.h b/src/qtui/legacysystemtray.h index 196c6984..7f1b66c5 100644 --- a/src/qtui/legacysystemtray.h +++ b/src/qtui/legacysystemtray.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2019 by the Quassel Project * * devel@quassel-irc.org * * * * This file is free software; you can redistribute it and/or modify * @@ -18,74 +18,46 @@ * 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 -#else -# include -#endif +# include +# include -#include - -#include "systemtray.h" +# include "systemtray.h" class LegacySystemTray : public SystemTray { Q_OBJECT public: - explicit LegacySystemTray(QWidget *parent); - virtual ~LegacySystemTray() {} - virtual void init(); + explicit LegacySystemTray(QWidget* parent); - 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 onVisibilityChanged(bool isVisible); - void syncLegacyIcon(); + void onActivated(QSystemTrayIcon::ActivationReason); + void onMessageClicked(); + + void updateIcon(); + void updateToolTip(); private: - QTimer _blinkTimer; - bool _blinkState; - uint _lastMessageId; + uint _lastMessageId{0}; -#ifdef HAVE_KDE - KSystemTrayIcon *_trayIcon; -#else - QSystemTrayIcon *_trayIcon; -#endif + QSystemTrayIcon* _trayIcon; }; - -// inlines - -bool LegacySystemTray::isSystemTrayAvailable() const -{ - return mode() == Legacy ? QSystemTrayIcon::isSystemTrayAvailable() - : SystemTray::isSystemTrayAvailable(); -} - - #endif /* QT_NO_SYSTEMTRAYICON */ - -#endif /* LEGACYSYSTEMTRAY_H_ */