mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
ref code sort files
This commit is contained in:
@@ -6,21 +6,19 @@
|
||||
#define SYSTEMTRAYNOTIFICATIONHANDLER_H
|
||||
|
||||
#include "notificationHandler.h"
|
||||
#include "trayIconBackend.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QMenu>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#if defined(Q_OS_MAC) && !defined(MACOS_NE)
|
||||
class MacOSStatusIcon;
|
||||
#endif
|
||||
#include <memory>
|
||||
|
||||
class SystemTrayNotificationHandler : public NotificationHandler {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SystemTrayNotificationHandler(QObject* parent);
|
||||
~SystemTrayNotificationHandler();
|
||||
~SystemTrayNotificationHandler() override;
|
||||
|
||||
void setConnectionState(Vpn::ConnectionState state) override;
|
||||
|
||||
@@ -30,28 +28,19 @@ public slots:
|
||||
void updateWebsiteUrl(const QString &newWebsiteUrl);
|
||||
|
||||
protected:
|
||||
virtual void notify(Message type, const QString& title,
|
||||
const QString& message, int timerMsec) override;
|
||||
void notify(Message type, const QString& title,
|
||||
const QString& message, int timerMsec) override;
|
||||
|
||||
private:
|
||||
void showHideWindow();
|
||||
|
||||
void setTrayState(Vpn::ConnectionState state);
|
||||
void onTrayActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
|
||||
void refreshTheme();
|
||||
void updateTrayIcon();
|
||||
qreal trayIconOpacityForState(Vpn::ConnectionState state) const;
|
||||
QColor trayIndicatorColorForState(Vpn::ConnectionState state) const;
|
||||
TrayIconVisual currentTrayVisual() const;
|
||||
|
||||
private:
|
||||
QMenu m_menu;
|
||||
|
||||
#if defined(Q_OS_MAC) && !defined(MACOS_NE)
|
||||
MacOSStatusIcon *m_macStatusIcon = nullptr;
|
||||
#else
|
||||
QSystemTrayIcon m_systemTrayIcon;
|
||||
#endif
|
||||
std::unique_ptr<TrayIconBackend> m_trayIcon;
|
||||
|
||||
QAction* m_trayActionShow = nullptr;
|
||||
QAction* m_trayActionConnect = nullptr;
|
||||
@@ -64,9 +53,6 @@ private:
|
||||
Vpn::ConnectionState m_trayState = Vpn::ConnectionState::Unknown;
|
||||
bool m_isDarkTheme = false;
|
||||
|
||||
static constexpr qreal kDisconnectedTrayOpacity = 0.5;
|
||||
static constexpr qreal kConnectedTrayOpacity = 1.0;
|
||||
|
||||
QString websiteUrl = "https://amnezia.org";
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user