-
Notifications
You must be signed in to change notification settings - Fork 2
/
zerotiermanager.h
73 lines (65 loc) · 1.99 KB
/
zerotiermanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef ZEROTIERMANAGER_H
#define ZEROTIERMANAGER_H
#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QMenu>
#include <QAction>
#include <QList>
#include <QTimer>
#include "ztonstatus.h"
QT_BEGIN_NAMESPACE
namespace Ui { class ZeroTierManager; }
QT_END_NAMESPACE
class ZeroTierManager : public QMainWindow
{
Q_OBJECT
public:
ZeroTierManager(QWidget *parent = nullptr);
~ZeroTierManager();
protected:
void closeEvent(QCloseEvent *event) override;
private slots:
void manageNetwork(bool checked);
void on_btnOk_clicked();
void on_lstCurrentNetwork_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
void on_btnToogleConnection_clicked();
void on_btnRemove_clicked();
void on_btnInformation_clicked();
void on_btnJoin_clicked();
void trayActivated(QSystemTrayIcon::ActivationReason reason);
void trayMenuTriggered(bool status);
void openCentral(bool checked);
private:
void createActions();
void createTrayIcon();
bool checkServiceIsRunning();
bool checkHavePkexec();
bool checkUserToken();
void copyAuthToken();
void addActionMenu(QString name, bool check);
void updateTrayMenu();
void updateStatus();
bool startService();
void updateNetworkStatus();
int selectedNetwork();
QJsonDocument getNetworkInformation();
bool isNetworkJoinedInZerotier(QString networkId);
void zerotierJoinNetwork(QString networkId);
void zerotierLeaveNetwork(QString networkId);
Ui::ZeroTierManager *ui;
QAction *quitAction;
QAction *addAction;
QAction *separatorAction;
QAction *quitSeparatorAction;
QAction *openCentralAction;
QList<QAction *> networkMeuActions;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
bool serviceIsRunning;
bool havePkexec;
bool haveUserToken;
const QString USER_TOKEN_FILE = ".zeroTierOneAuthToken";
QTimer *updateStatusTimer;
QList<ztonStatus> configuratedNetwork;
};
#endif // ZEROTIERMANAGER_H