X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Flegacysystemtray.h;h=83ff201256c3ece58d1d2176b2f0e2af07f01fa6;hb=4e51500401db3c85dbe5e92e5e5c15b6e3c87787;hp=c4af3df87360c071e0b51d6a4de1f8ea7a77e760;hpb=1a9450ecc5eeb5f987ceac790be84dcced02f028;p=quassel.git diff --git a/src/qtui/legacysystemtray.h b/src/qtui/legacysystemtray.h index c4af3df8..83ff2012 100644 --- a/src/qtui/legacysystemtray.h +++ b/src/qtui/legacysystemtray.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This file is free software; you can redistribute it and/or modify * @@ -18,76 +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_KDE4 -# 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; + 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); + void showMessage(const QString& title, + const QString& message, + MessageIcon icon = Information, + int msTimeout = 10000, + uint notificationId = 0) override; + void closeMessage(uint notificationId) override; -protected slots: +private slots: + void onModeChanged(Mode mode); + void onVisibilityChanged(bool isVisible); -protected: - virtual void setMode(Mode mode); + void onActivated(QSystemTrayIcon::ActivationReason); + void onMessageClicked(); -private: void updateIcon(); - -private slots: - void on_blinkTimeout(); - void on_activated(QSystemTrayIcon::ActivationReason); - void on_messageClicked(); - - void syncLegacyIcon(); + void updateToolTip(); private: - QTimer _blinkTimer; - bool _blinkState; - uint _lastMessageId; + uint _lastMessageId{0}; -#ifdef HAVE_KDE4 - 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_ */