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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
/*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 1.1
import "../common" as Common
import "../bars" as Bars
Rectangle {
id: widgetthemepage
width: parent.width
height: 475
property string actiontitle: qsTr("Window theme settings")//窗口主题设置
property string actiontext: qsTr("Choose the theme you want. The first theme on the page is the current theme.")//选择您想设置的主题。优客助手启动时页面上的第一个主题为系统当前使用的主题。
property string init_theme: ""
property string selected_theme: ""
Component.onCompleted: {
statusImage.visible = false;
var syslist = sessiondispatcher.get_themes_qt();
widgetthemepage.init_theme = sessiondispatcher.get_theme_qt();
showText.text = qsTr("[ Current Theme is: ") + widgetthemepage.init_theme + " ]";
syslist.unshift(widgetthemepage.init_theme);
themeModel.clear();
for(var i=0; i < syslist.length; i++) {
themeModel.append({"icon": "../../img/skin/" + syslist[i] + ".png", "name": syslist[i]});
if (i!=0 && syslist[i] == widgetthemepage.init_theme)
themeModel.remove(i);
}
//将系统初始的标题栏字体写入QSetting配置文件
sessiondispatcher.write_default_configure_to_qsetting_file("widgettheme", "currenttheme", widgetthemepage.init_theme);
}
ListModel { id: themeModel }
//背景
Image {
source: "../../img/skin/bg-bottom-tab.png"
anchors.fill: parent
}
Component {
id: themegridDelegate
Item {
id: griditem
width: 120; height: 120
Column {
anchors.fill: parent
spacing: 10
Image {
id: seticon
source: icon
width: 120
height: 120
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
id: btnText
height: 20
anchors.horizontalCenter: parent.horizontalCenter
text: name
font.bold: true
font.pixelSize: 12
color: "#383838"
}
}
Image {
id: btnImg
anchors.fill: parent
source: ""
}
MouseArea {
id: signaltest
hoverEnabled: true
anchors.fill: parent
onEntered: btnImg.source = "../../img/toolWidget/menu_hover.png"
onPressed: btnImg.source = "../../img/toolWidget/menu_press.png"
//要判断松开是鼠标位置
onReleased: btnImg.source = "../../img/toolWidget/menu_hover.png"
onExited: btnImg.source = ""
onClicked: {
// griditem.GridView.view.currentIndex = index;
widgetthemepage.selected_theme = name;
sessiondispatcher.set_theme_qt(name);
statusImage.visible = true;
showText.text = qsTr("[ Current Theme is: ") + name + " ]";
}
}
}
}
Column {
id: titlecolumn
anchors {
top: parent.top
topMargin: 44
left: parent.left
leftMargin: 80
}
Row {
spacing: 50
Text {
text: widgetthemepage.actiontitle
font.bold: true
font.pixelSize: 14
color: "#383838"
}
Text {
id: showText
text: ""
font.pixelSize: 14
color: "#318d11"
}
//status picture
Common.StatusImage {
id: statusImage
visible: false
iconName: "green.png"
text: qsTr("Completed")//已完成
anchors.verticalCenter: parent.verticalCenter
}
}
Text {
text: widgetthemepage.actiontext
font.pixelSize: 12
color: "#7a7a7a"
}
}
Item {
width: parent.width - 60*2
anchors {
top: parent.top
topMargin: 100
left: parent.left
leftMargin: 60
}
GridView {
id: themegrid
anchors.fill: parent
cellWidth: 156; cellHeight: 156
model: themeModel
delegate: themegridDelegate
focus: true
cacheBuffer: 1000
// highlight: Rectangle { color: "lightsteelblue"; radius: 5 }//kobe:设置选中项深色块
}
}
//顶层工具栏
Bars.TopBar {
id: topBar
width: 28
height: 26
anchors.top: parent.top
anchors.topMargin: 40
anchors.left: parent.left
anchors.leftMargin: 40
opacity: 0.9
onButtonClicked: {
var num = sessiondispatcher.get_page_num();
if (num == 0)
pageStack.push(homepage)
else if (num == 3)
pageStack.push(systemset)
else if (num == 4)
pageStack.push(functioncollection)
}
}
//底层工具栏
Bars.ToolBar {
id: toolBar
showok: false
showrestore: true
height: 50; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9
onQuitBtnClicked: {
var num = sessiondispatcher.get_page_num();
if (num == 0)
pageStack.push(homepage)
else if (num == 3)
pageStack.push(systemset)
else if (num == 4)
pageStack.push(functioncollection)
}
onRestoreBtnClicked: {
var defaulttheme = sessiondispatcher.read_default_configure_from_qsetting_file("widgettheme", "currenttheme");
if(defaulttheme == widgetthemepage.selected_theme || widgetthemepage.selected_theme == "") {
//友情提示: 您系统的当前窗口主题已经为默认主题!
sessiondispatcher.showWarningDialog(qsTr("Tips:"), qsTr("Your system's current widget theme is the default theme!"), mainwindow.pos.x, mainwindow.pos.y);
}
else {
sessiondispatcher.set_theme_qt(defaulttheme);
statusImage.visible = true;
showText.text = qsTr("[ Current Theme is: ") + defaulttheme + " ]";
widgetthemepage.selected_theme = defaulttheme;
}
}
// onOkBtnClicked: {
// if (widgetthemepage.selected_theme == "")
// sessiondispatcher.set_theme_qt(widgetthemepage.init_theme);
// else {
// sessiondispatcher.set_theme_qt(widgetthemepage.selected_theme);
// statusImage.visible = true;
// }
// }
Timer {
interval: 5000; running: true; repeat: true
onTriggered: statusImage.visible = false
}
}
}
|