-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmainwindow.h
93 lines (74 loc) · 2.18 KB
/
mainwindow.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QDialog>
#include <QSettings>
#include <QRegExpValidator>
#include <dogcomcontroller.h>
#include <QSystemTrayIcon>
#include "singleapplication.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QDialog
{
Q_OBJECT
public:
explicit MainWindow(SingleApplication *parentApp=nullptr, QWidget *parent = nullptr);
~MainWindow() override;
void closeEvent(QCloseEvent *) override;
private slots:
void on_checkBoxAutoLogin_toggled(bool checked);
void on_checkBoxRemember_toggled(bool checked);
void on_comboBoxMAC_currentTextChanged(const QString &arg1);
void on_pushButtonLogin_clicked();
void IconActivated(QSystemTrayIcon::ActivationReason reason);
void UserLogOut();
void on_checkBoxNotShowWelcome_toggled(bool checked);
void on_checkBoxHideLoginWindow_toggled(bool checked);
public slots:
void HandleOffline(int reason);
void HandleLoggedIn();
void HandleIpAddress(const QString &ip);
void ShowLoginWindow();
void RestartDrcom();
void QuitDrcom();
void RestartDrcomByUser();
private:
Ui::MainWindow *ui;
SingleApplication *app=nullptr;
const QString CUSTOM_MAC = tr("custom (format: 1A:2B:3C:4D:5E:6F case insensitive)");
const QString APP_NAME = tr("DrCOM JLU Qt version");
// 用于确保调用socket的析构函数,释放资源
bool bQuit=false;
bool bRestart=false;
// 记录用户保存的信息
QString account, password, mac_addr;
bool bRemember, bAutoLogin;
bool bHideWindow, bNotShowWelcome;
// 用于在未登录时关闭窗口就退出
int CURR_STATE;
QRegExpValidator *macValidator;
DogcomController *dogcomController;
// 设置托盘中的注销按钮的可用性
void DisableLogOutButton(bool yes);
// 窗口菜单
QAction *aboutAction;
QMenu *windowMenu;
void AboutDrcom();
// 托盘图标
QAction *restartAction;
QAction *restoreAction;
QAction *logOutAction;
QAction *quitAction;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
void CreateActions();
void CreateTrayIcon();
void SetIcon(bool online);
void GetInputs();
void LoadSettings();
void SaveSettings();
void SetMAC(const QString &m);
void SetDisableInput(bool yes);
};
#endif // MAINWINDOW_H