X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Flegacysystemtray.h;h=e2bc3386e3753acb6634f19234f835a355f05525;hp=f366fbda2b15a6c33dea012a520cc9d6496e74ea;hb=ee8b9f55860e340c1600188fddcfd557c7489f66;hpb=695758015a80eb8c158a9ac4c0f1c0b547e70df3 diff --git a/src/qtui/legacysystemtray.h b/src/qtui/legacysystemtray.h index f366fbda..e2bc3386 100644 --- a/src/qtui/legacysystemtray.h +++ b/src/qtui/legacysystemtray.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 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,20 +18,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef LEGACYSYSTEMTRAY_H_ -#define LEGACYSYSTEMTRAY_H_ +#pragma once #ifndef QT_NO_SYSTEMTRAYICON +#include + #ifdef HAVE_KDE4 # include #else # include #endif -#include -#include - #include "systemtray.h" class LegacySystemTray : public SystemTray @@ -40,35 +38,25 @@ class LegacySystemTray : public SystemTray public: explicit LegacySystemTray(QWidget *parent); - virtual ~LegacySystemTray() {} - virtual void init(); - virtual bool isVisible() const; - virtual inline bool isSystemTrayAvailable() const; - virtual QIcon 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 onActivated(QSystemTrayIcon::ActivationReason); + void onMessageClicked(); - void syncLegacyIcon(); + void updateIcon(); + void updateToolTip(); private: - QTimer _blinkTimer; - bool _blinkState; - uint _lastMessageId; + uint _lastMessageId {0}; #ifdef HAVE_KDE4 KSystemTrayIcon *_trayIcon; @@ -77,16 +65,4 @@ private: #endif }; - -// inlines - -bool LegacySystemTray::isSystemTrayAvailable() const -{ - return mode() == Legacy ? QSystemTrayIcon::isSystemTrayAvailable() - : SystemTray::isSystemTrayAvailable(); -} - - #endif /* QT_NO_SYSTEMTRAYICON */ - -#endif /* LEGACYSYSTEMTRAY_H_ */