feat: add macOS notification handler and install event filter on main window
This commit is contained in:
parent
9b89237f54
commit
4f2d9b4fa9
3 changed files with 58 additions and 9 deletions
36
client/ui/ne_notificationhandler.h
Normal file
36
client/ui/ne_notificationhandler.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef NE_NOTIFICATION_HANDLER_H
|
||||
#define NE_NOTIFICATION_HANDLER_H
|
||||
|
||||
#include "notificationhandler.h"
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
class MacOSStatusIcon;
|
||||
|
||||
class NEStatusBarNotificationHandler : public NotificationHandler {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NEStatusBarNotificationHandler(QObject* parent);
|
||||
~NEStatusBarNotificationHandler() override;
|
||||
|
||||
void setConnectionState(Vpn::ConnectionState state) override;
|
||||
void onTranslationsUpdated() override;
|
||||
|
||||
protected:
|
||||
void notify(Message type, const QString& title,
|
||||
const QString& message, int timerMsec) override;
|
||||
|
||||
private:
|
||||
void buildMenu();
|
||||
|
||||
QMenu m_menu;
|
||||
MacOSStatusIcon* m_statusIcon;
|
||||
|
||||
QAction* m_actionShow;
|
||||
QAction* m_actionConnect;
|
||||
QAction* m_actionDisconnect;
|
||||
QAction* m_actionVisitWebsite;
|
||||
QAction* m_actionQuit;
|
||||
};
|
||||
|
||||
#endif // NE_NOTIFICATION_HANDLER_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue