-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettingwidget.cpp
167 lines (134 loc) · 6.6 KB
/
settingwidget.cpp
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#include "settingwidget.h"
#include "ui_settingwidget.h"
SettingWidget::SettingWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SettingWidget)
{
ui->setupUi(this);
setFixedSize(600,292);
initDate();
initLayout();
initConnect();
}
SettingWidget::~SettingWidget()
{
delete ui;
}
void SettingWidget::initDate()
{
}
void SettingWidget::initLayout()
{
lb_closeStyle = new QLabel(this);
lb_closeStyle->setText("关闭风格 :");
bt_selectCloseStyle_0 = new QRadioButton("直接关闭",this);
bt_selectCloseStyle_1 = new QRadioButton("关闭到窗口栏",this);
gb_closeStyle = new QButtonGroup(this);
gb_closeStyle->addButton(bt_selectCloseStyle_0,0);
gb_closeStyle->addButton(bt_selectCloseStyle_1,1);
lb_softStyle = new QLabel(this);
lb_softStyleMessage = new QLabel(this);
lb_softStyle->setText("软件样式 :");
lb_softStyleMessage->setText("吴均潮黑色 V 1.1 版");
lb_updateCycle = new QLabel(this);
lb_updateCycle->setText(" 更新 :");
lb_updateCycle->setStyleSheet("QLabel{background:transparent;color:#e80041;font-size:20px;font-weight:bold;}"
"QLabel:hover{color:#fff582}"
"QLabel:pressed{}");
lb_updateCycle->setGeometry(50,100,100,30);
lb_updateCycleMessage_1 = new QComboBox(this);
lb_updateCycleMessage_2 = new QComboBox(this);
lb_updateCycleMessage_1->addItem("自动更新/10秒钟");
lb_updateCycleMessage_2->addItem("手动更新限制/5秒钟");
lb_updateCycleMessage_1->setFont(Tool::Font(16,false));
lb_updateCycleMessage_1->setStyleSheet("QComboBox{background:#F5F5F5;border:0px solid gray;border-radius:3px;padding:1px 2px 1px 2px;}"
"QComboBox::down-arrow{image:url(:/image/softImage/details/drow_arrow_0.png);"
"width:10px;"
"height:10px;}"
"QComboBox:hover{border: 1px solid gray;}"
"QComboBox::drop-down{"
"width: 20px;"
"background:#F5F5F5;"
"border-radius:3px;}");
lb_updateCycleMessage_1->view()->setStyleSheet("QAbstractItemView{background:#FFF;}");
lb_updateCycleMessage_2->setFont(Tool::Font(16,false));
lb_updateCycleMessage_2->setStyleSheet("QComboBox{background:#F5F5F5;border:0px solid gray;border-radius:3px;padding:1px 2px 1px 2px;}"
"QComboBox::down-arrow{image:url(:/image/softImage/details/drow_arrow_0.png);"
"width:10px;"
"height:30px;}"
"QComboBox:hover{border: 1px solid gray;}"
"QComboBox::drop-down{"
"width: 20px;"
"background:#F5F5F5;"
"border-radius:3px;}");
lb_updateCycleMessage_2->view()->setStyleSheet("QAbstractItemView{background:#FFF;}");
cb_update = new QComboBox(this);
cb_update->setFont(Tool::Font(16,false));
cb_update->setStyleSheet("QComboBox{background:#F5F5F5;border:0px solid gray;border-radius:3px;padding:1px 2px 1px 2px;}"
"QComboBox::down-arrow{image:url(:/image/softImage/details/drow_arrow_0.png);"
"width:10px;"
"height:20px;}"
"QComboBox:hover{border: 1px solid gray;}"
"QComboBox::drop-down{"
"width: 20px;"
"background:#F5F5F5;"
"border-radius:3px;}");
cb_update->view()->setStyleSheet("QAbstractItemView{background:#FFF;}");
cb_update->addItem("更新及时提示");
cb_update->addItem("开发者模式,手动更新");
cb_update->setCurrentIndex(0);
lb_updateCycleMessage_1->setGeometry(160,100,200,30);
lb_updateCycleMessage_2->setGeometry(160,140,200,30);
cb_update->setGeometry(160,180,200,30);
bt_submit = new QPushButton(this);
bt_submit->setText("设置");
lb_closeStyle->setGeometry(50,20,100,30);
lb_closeStyle->setStyleSheet("QLabel{background:transparent;color:#e80041;font-size:20px;font-weight:bold;}"
"QLabel:hover{color:#fff582}"
"QLabel:pressed{}");
bt_selectCloseStyle_0->setStyleSheet("QRadioButton{background:transparent;color:#e9a4ff;font-size:12px;font-weight:bold;}"
"QRadioButton:hover{color:#DF7DAF}"
"QRadioButton:pressed{color:#E6FF13}");
bt_selectCloseStyle_1->setStyleSheet("QRadioButton{background:transparent;color:#e9a4ff;font-size:12px;font-weight:bold;}"
"QRadioButton:hover{color:#DF7DAF}"
"QRadioButton:pressed{color:#E6FF13}");
bt_selectCloseStyle_0->setGeometry(180,20,100,30);
bt_selectCloseStyle_1->setGeometry(280,20,150,30);
bt_selectCloseStyle_1->setChecked(true);
lb_softStyle->setStyleSheet("QLabel{background:transparent;color:#e80041;font-size:20px;font-weight:bold;}"
"QLabel:hover{color:#fff582}"
"QLabel:pressed{}");
lb_softStyleMessage->setStyleSheet("QLabel{background:transparent;color:#e9a4ff;font-size:14px;font-weight:bold;}"
"QLabel:hover{color:#fff582}"
"QLabel:pressed{}");
lb_softStyle->setGeometry(50,60,100,30);
lb_softStyleMessage->setGeometry(170,60,200,30);
bt_submit->setGeometry(430,220,80,30);
bt_submit->setStyleSheet("QPushButton{background:#FF34B3;color:#000;font-size:14px;font-weight:bold;}"
"QPushButton:hover{background:#fff582}"
"QPushButton:pressed{background:#e80041}");
}
void SettingWidget::initConnect()
{
connect(bt_submit,SIGNAL(clicked(bool)),this,SLOT(Update_setting_Button()));
}
void SettingWidget::setUser(const User &user)
{
if(user.getCloseStyle()==0)
{
bt_selectCloseStyle_0->setChecked(true);
}
else
{
bt_selectCloseStyle_1->setChecked(true);
}
cb_update->setCurrentIndex(user.getUpdateStyle());
return;
}
void SettingWidget::Update_setting_Button()
{
User user;
user.setCloseStyle(gb_closeStyle->checkedId());
user.setUpdateStyle(cb_update->currentIndex());
emit SignalToSettingUpdate(user);
}