-
Notifications
You must be signed in to change notification settings - Fork 1
/
settingdialog.h
88 lines (75 loc) · 3.38 KB
/
settingdialog.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
#ifndef SETTINGDIALOG_H
#define SETTINGDIALOG_H
#include <QDialog>
#include <QSettings>
#include <QAbstractButton>
#include <cstdint>
enum class SettingGeneralKey { Height = 0, Position = 1, Transparency = 2, ShowCharge = 3, Align = 4, MainMonitor = 5, CustomMonitor = 6 };
enum class SettingBasicColorKey { DefaultColor = 0, ChargeColor = 1, FullColor = 2 };
enum class SettingCustomColorKey { Enable = 0, LowEdge = 1, HighEdge = 2, Color = 3 };
enum class SettingMonitor { Primary = 0, Custom = 1 };
enum class SettingPosition { Top = 0, Bottom = 1, Left = 2, Right = 3 };
enum class SettingAlign { LeftTop = 0, RightBottom = 1 };
#define BL_COLOR_LEVEL 8
#define BL_DEFAULT_DISABLED_COLOR QColor(255, 255, 255)
struct bl_option
{
int height; // Battery line's height (in pixel)
int position; // Where to show battery line? (TOP | BOTTOM | LEFT | RIGHT)
int transparency; // Transparency of battery line
bool showCharge; // Show battery line when charging?
int align; // Align to Left/Top or Right/Bottom?
bool mainMonitor; // Which monitor to show battery line?
int customMonitor; // Which monitor to show battery line?
QColor defaultColor; // Battery line's default color
QColor chargeColor; // Battery line's color when charging
QColor fullColor; // Battery line's color when charging is done
bool customEnable[BL_COLOR_LEVEL]; // User defined battery line's color count
int lowEdge[BL_COLOR_LEVEL]; // User defined edges to pick up user defined color
int highEdge[BL_COLOR_LEVEL]; // User defined edges to pick up user defined color
QColor customColor[BL_COLOR_LEVEL]; // User defined battery line's color
};
typedef struct bl_option BL_OPTION;
namespace Ui {
class SettingDialog;
}
class SettingDialog : public QDialog
{
Q_OBJECT
public:
explicit SettingDialog(BL_OPTION option, BL_OPTION defaultOption, QWidget *parent = nullptr);
~SettingDialog();
signals:
void SignalGeneral(SettingGeneralKey key, QVariant entry);
void SignalBasicColor(SettingBasicColorKey key, QVariant entry);
void SignalCustomColor(SettingCustomColorKey key, int index, QVariant entry);
void SignalDefaultSetting();
private slots:
void on_heightSpinBox_valueChanged(int arg1);
void on_positionComboBox_currentIndexChanged(int value);
void on_transparencySpinBox_valueChanged(int arg1);
void on_showChargeCheckBox_toggled(bool checked);
void on_alignComboBox_currentIndexChanged(int value);
void on_mainMonitorCheckBox_toggled(bool checked);
void on_customMonitorComboBox_currentIndexChanged(int index);
void on_defaultColorPushButton_clicked();
void on_chargeColorPushButton_clicked();
void on_fullColorPushButton_clicked();
void on_customEnableComboBox_currentIndexChanged(int index);
void on_customEnableCheckBox_toggled(bool checked);
void on_lowEdgeSpinBox_valueChanged(int arg1);
void on_highEdgeSpinBox_valueChanged(int arg1);
void on_customColorPushButton_clicked();
void on_buttonBox_clicked(QAbstractButton *button);
void reject();
void done(int ret);
private:
void SetDefaultOption();
void UpdateDialog();
Ui::SettingDialog *ui;
BL_OPTION m_option;
BL_OPTION m_first;
BL_OPTION m_default;
int m_customColorIndex;
};
#endif // SETTINGDIALOG_H