-
Notifications
You must be signed in to change notification settings - Fork 15
/
WinSetting.h
106 lines (83 loc) · 2.62 KB
/
WinSetting.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
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef WINSETTING_H
#define WINSETTING_H
#include <QButtonGroup>
#include <QDir>
#include <QTranslator>
#include <QCoreApplication>
#include <QWidget>
#include "lib/MonitorInfo_x11.h"
LFX_USE_NAESPACE
#include "json.hpp"
using json = nlohmann::json;
namespace Ui {
class WinSetting;
}
class WinSetting : public QWidget
{
Q_OBJECT
public:
explicit WinSetting(QWidget *parent = nullptr);
~WinSetting();
public:
void init();
void readConfig(bool initLanguage = true);
void changeOriePreviewUI();
void saveConfig();
void saveConfig(bool &isHomePath);
void saveConfigThemeIsLight(bool isLight);
void onlyFirstEmitSig();
bool isHorizontal();
bool isLightTheme();
QString getConfigPath(bool &isHomePath);
QString getConfigPath(QString homePath, QString systemPath, bool &isHomePath);
QString writeDataToConfigPath();
bool writeDataToConfigPath(QString sour, QString dest, QString sourName, QString destName);
void initSigConnectPersonalization();
void initSigConnectGeneralSetting();
public:
virtual bool eventFilter(QObject *watched, QEvent *event) override;
signals:
// --------个性化 相关--------
void sigUnitModel(const QString &);
void sigUnitModelIndex(int);
void sigLabUploadText(const QString &);
void sigLabDownText(const QString &);
void sigLabCpuText(const QString &);
void sigLabMemoryText(const QString &);
void sigCurrentFont(const QFont &);
void sigFontSize(int);
void sigLabTextColor(const QColor);
void sigTextColor(const QColor);
void sigBackgroundColor(const QColor);
void sigBackgroundImage(QString path);
void sigTheme(bool checked);
// --------常规配置 相关--------
void sigCurrystemStyle(int index);
void sigWindowTop(bool top);
void sigDisolayNet(bool);
void sigDisolayCPUAndMemory(bool);
void sigLocationExchangeNet(bool);
void sigLocationExchangeCPUAndMenory(bool);
void sigFractionalAccuracy(int);
void sigRefreshInterval(int);
void sigCpuOver(bool check);
void sigMemOver(bool check);
void sigCpuOverNum(int cpu);
void sigMemOverNum(int mem);
void sigShowModel(bool);
public slots:
void onComboBoxLanguage(int index);
void onTheme(bool checked);
void onBtnApplyToJson();
void onExportData(bool checked);
void onBtnApplyWinSetting();
void onBtnQuitWinSetting();
void onCurrystemStyle(int index);
void onCurrystemStyleText(const QString style);
private:
Ui::WinSetting *ui;
json m_js;
bool m_isHorizontal; // 插件的水平、垂直状态
QTranslator *m_trans;
};
#endif // WINSETTING_H