-
Notifications
You must be signed in to change notification settings - Fork 0
/
settingsdialog.h
75 lines (60 loc) · 1.74 KB
/
settingsdialog.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
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include <QDialog>
#include "settings.h"
#include "updater.h"
QT_BEGIN_NAMESPACE
namespace Ui { class SettingsDialog; }
class QAbstractButton;
class QIntValidator;
class QTranslator;
QT_END_NAMESPACE
// 设置窗口类,同时管理设置信息的存储
class SettingsDialog : public QDialog {
Q_OBJECT
public:
enum class Page {
General=0, SerialPort=1, Appearance=2, Update=3
};
static QMap<Page, QString> PAGE_NAME;
explicit SettingsDialog(QWidget *parent = nullptr);
~SettingsDialog() override;
// 返回一个指向设置内容的常量指针
[[nodiscard]] const Settings *settings() const;
void showPage(Page page);
void checkUpdateResult(Updater::Result result);
signals:
void needUpdateSettings(const Settings *settings);
void needCheckForUpdate();
public slots:
void showPage(int index);
private slots:
void showPortInfo(int idx);
void apply();
void cancel();
void buttonBoxClicked(QAbstractButton *button);
void checkCustomBaudRatePolicy(int idx);
void checkCustomDevicePathPolicy(int idx);
void mod_RCP_widget_change(bool state);
void mod_RTP_widget_change(bool state);
void chooseFile_Map();
void chooseFile_RCP();
void chooseFile_RTP();
void chooseColor_RCP();
void chooseColor_RTP();
void fillPortsInfo();
void showLanguageSelected(int index);
void adjustPreviewPic();
void checkForUpdate();
private:
void fillPortsParameters();
void switchLanguage();
void recoverSettings();
void updateSettings();
private:
Ui::SettingsDialog *ui;
Settings m_settings;
QIntValidator *m_intValidator = nullptr;
QTranslator *m_translator;
};
#endif // SETTINGSDIALOG_H