fixed icon conn/disc macos

This commit is contained in:
dranik
2026-05-29 17:01:08 +03:00
parent a40bd0d580
commit 6fad9f56e4
11 changed files with 302 additions and 53 deletions
@@ -7,9 +7,14 @@
#include "notificationHandler.h"
#include <QColor>
#include <QMenu>
#include <QSystemTrayIcon>
#if defined(Q_OS_MAC) && !defined(MACOS_NE)
class MacOSStatusIcon;
#endif
class SystemTrayNotificationHandler : public NotificationHandler {
Q_OBJECT
@@ -34,12 +39,19 @@ private:
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;
private:
QMenu m_menu;
#if defined(Q_OS_MAC) && !defined(MACOS_NE)
MacOSStatusIcon *m_macStatusIcon = nullptr;
#else
QSystemTrayIcon m_systemTrayIcon;
#endif
QAction* m_trayActionShow = nullptr;
QAction* m_trayActionConnect = nullptr;
@@ -50,6 +62,7 @@ private:
QAction* m_separator = nullptr;
Vpn::ConnectionState m_trayState = Vpn::ConnectionState::Unknown;
bool m_isDarkTheme = false;
static constexpr qreal kDisconnectedTrayOpacity = 0.5;
static constexpr qreal kConnectedTrayOpacity = 1.0;