ref code sort files

This commit is contained in:
dranik
2026-05-30 10:53:44 +03:00
parent 9937add4eb
commit 58d6c362f3
22 changed files with 705 additions and 274 deletions
@@ -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";
};