19
19
import "../bars" as Bars
21
21
id: mousepointerpage
22
property bool on: true
23
22
width: parent.width
25
property string fontName: "Helvetica"
26
property int fontSize: 12
27
property color fontColor: "black"
28
25
property int cursor_size: 24
29
property string selected_cursor_theme: ""//存放用户选择确认后的主题
31
26
property int current_index//当前主题的索引
32
27
property int default_index//系统默认主题的索引
34
28
property string actiontitle: qsTr("Mouse Settings")//鼠标设置
35
29
property string actiontext: qsTr("Replace the theme and size of the mouse pointer, then click the 'OK' button to confirm. Also, theme change need to restart system.")//更换鼠标指针主题和大小,更改设置后点击"确定"按钮进行确认。主题更改需要重新系统才能生效。
31
ListModel { id: choices }
38
35
source: "../../img/skin/bg-middle.png"
41
38
Component.onCompleted: {
42
39
mousepointerpage.cursor_size = sessiondispatcher.get_cursor_size_qt();
43
// sessiondispatcher.write_default_configure_to_qsetting_file("theme", "cursorsize", mousepointerpage.cursor_size);
44
40
var cursorlist = sessiondispatcher.get_cursor_themes_qt();
45
var default_theme = sessiondispatcher.get_default_theme_sring_qt("mousetheme");
46
//系统默认值可能在获取列表的时候没有该值,所以需要在这里添加进去。
48
for(var i=0; i < cursorlist.length; i++) {
49
if(cursorlist[i] == default_theme) {
57
var len = cursorlist.length;
58
cursorlist.push(default_theme);
62
41
var current_cursor_theme = sessiondispatcher.get_cursor_theme_qt();
63
//将系统初始的图标主题写入QSetting配置文件
64
// sessiondispatcher.write_default_configure_to_qsetting_file("theme", "cursortheme", current_cursor_theme);
65
showText.text = qsTr("[ Current Cursor Theme: ") + current_cursor_theme + " ]";//[ 当前光标主题是:
66
mousepointerpage.selected_cursor_theme = current_cursor_theme;
67
// cursorlist.unshift(current_cursor_theme);
70
// console.log("default_theme->");
71
// console.log(default_theme);
42
var default_theme = "DMZ-White";//sessiondispatcher.get_default_theme_sring_qt("mousetheme");
74
for(var k=0; k < cursorlist.length; k++) {
75
choices.append({"text": cursorlist[k]});
76
if (cursorlist[k] == current_cursor_theme) {
77
mousepointerpage.current_index = k;
82
// for(k=0; k < cursorlist.length; k++) {
83
// choices.append({"text": cursorlist[k]});
84
//// if (k!=0 && cursorlist[k] == current_cursor_theme)
85
//// choices.remove(k);
86
// if (cursorlist[k] == current_cursor_theme) {
87
// mousepointerpage.current_index = k;
89
// else if (cursorlist[k] == default_theme) {
90
// mousepointerpage.default_index = k;
92
//// console.log("aaaaaaaaaa->");
100
// choices.append({"text": default_theme});
101
// mousepointerpage.default_index = cursorlist.length - 1;
44
if(current_cursor_theme == default_theme) {
45
for(var i=0; i < cursorlist.length; i++) {
46
choices.append({"text": cursorlist[i]});
47
if (cursorlist[i] == current_cursor_theme) {
48
mousepointerpage.current_index = i;
49
mousepointerpage.default_index = i;
54
for(var j=0; j < cursorlist.length; j++) {
55
choices.append({"text": cursorlist[j]});
56
if (cursorlist[j] == current_cursor_theme) {
57
mousepointerpage.current_index = j;
59
else if (cursorlist[j] == default_theme) {
60
mousepointerpage.default_index = j;
104
64
cursorcombo.selectedIndex = mousepointerpage.current_index;
111
70
anchors.topMargin: 44
112
71
anchors.left: parent.left
113
72
anchors.leftMargin: 80
117
text: mousepointerpage.actiontitle
132
iconName: "green.png"
133
text: qsTr("Completed")//已完成
134
anchors.verticalCenter: parent.verticalCenter
138
text: mousepointerpage.actiontext
74
text: mousepointerpage.actiontitle
80
text: mousepointerpage.actiontext
144
ListModel { id: choices }
118
spacing: 314 - 16 - 20
122
anchors.verticalCenter: parent.verticalCenter
124
showImage: "../../img/icons/cloud-gray.png"
182
127
id: cursorthemelabel
183
text: qsTr("Mouse Pointer Theme")//鼠标指针主题
129
text: qsTr("Mouse Pointer Theme:")//鼠标指针主题:
184
130
font.pixelSize: 12
186
132
anchors.verticalCenter: parent.verticalCenter
189
134
Common.ComboBox {
193
// width: cursorthemelabel.width
194
onSelectedTextChanged: {/*console.log(selectedText)*/}
137
width: cursorthemelabel.width
138
onSelectedTextChanged: {
139
sessiondispatcher.set_cursor_theme_qt(cursorcombo.selectedText);
140
systemdispatcher.set_cursor_theme_with_root_qt(cursorcombo.selectedText);
195
142
anchors.verticalCenter: parent.verticalCenter
201
hoverimage: "green.png"
204
if (mousepointerpage.selected_cursor_theme != cursorcombo.selectedText) {
205
mousepointerpage.selected_cursor_theme = cursorcombo.selectedText;
206
sessiondispatcher.set_cursor_theme_qt(cursorcombo.selectedText);
207
systemdispatcher.set_cursor_theme_with_root_qt(cursorcombo.selectedText);
208
showText.text = qsTr("[ Current Cursor Theme: ") + cursorcombo.selectedText + " ]";//[ 当前光标主题是:
209
statusImage.visible = true;
215
146
hoverimage: "blue.png"
221
sessiondispatcher.set_default_theme_qt("mousetheme");
222
var defaulttheme = sessiondispatcher.get_cursor_theme_qt();
223
// console.log(defaulttheme);
224
systemdispatcher.set_cursor_theme_with_root_qt(defaulttheme);
225
cursorcombo.selectedText = defaulttheme;
226
// cursorcombo.selectedIndex = mousepointerpage.default_index;
227
showText.text = qsTr("[ Current Cursor Theme: ") + cursorcombo.selectedText + " ]";//[ 当前光标主题是:
228
statusImage.visible = true;
152
//Attention:配置文件的系统默认值为:DMZ-White,而通过gsetting方法得到的默认值为:Adwaita
153
//这里我们使用配置自带的系统默认值DMZ-White
154
sessiondispatcher.set_cursor_theme_qt("DMZ-White");
155
systemdispatcher.set_cursor_theme_with_root_qt("DMZ-White");
156
cursorcombo.selectedIndex = mousepointerpage.default_index;
239
text: qsTr("Cursor Pointer Size")//光标指针大小
242
anchors.verticalCenter: parent.verticalCenter
162
spacing: 314 - 16 - 20
167
anchors.verticalCenter: parent.verticalCenter
169
showImage: "../../img/icons/cloud-gray.png"
174
text: qsTr("Cursor Pointer Size:")//光标指针大小:
177
anchors.verticalCenter: parent.verticalCenter
181
exclusive: true//控制是否联动
185
checked: (mousepointerpage.cursor_size == 24) ? true : false
186
titleName: qsTr("Small Size")//24 小号
189
if(smallstyle.checked == true) {
190
if(mousepointerpage.cursor_size != 24) {
191
sessiondispatcher.set_cursor_size_qt(24);
192
mousepointerpage.cursor_size = 24;
199
checked: (mousepointerpage.cursor_size == 48) ? true : false
200
titleName: qsTr("Big Size")//48 大号
203
if(bigstyle.checked == true) {
204
if(mousepointerpage.cursor_size != 48) {
205
sessiondispatcher.set_cursor_size_qt(48);
206
mousepointerpage.cursor_size = 48;
246
exclusive: true//控制是否联动
250
checked: (mousepointerpage.cursor_size == 24) ? true : false
251
titleName: qsTr("Small Size")//24 小号
254
if(smallstyle.checked == true) {
255
if(mousepointerpage.cursor_size != 24) {
256
sessiondispatcher.set_cursor_size_qt(24);
257
mousepointerpage.cursor_size = 24;
258
statusImage.visible = true;
214
hoverimage: "blue.png"
215
text: qsTr("Restore")//恢复默认
220
sessiondispatcher.set_default_theme_qt("cursorsize");
221
var default_value = sessiondispatcher.get_cursor_size_qt();
222
if(default_value == 24) {
223
smallstyle.checked = true;
265
checked: (mousepointerpage.cursor_size == 36) ? true : false
266
titleName: qsTr("Big Size")//36 大号
269
if(bigstyle.checked == true) {
270
if(mousepointerpage.cursor_size != 36) {
271
sessiondispatcher.set_cursor_size_qt(36);
272
mousepointerpage.cursor_size = 36;
273
statusImage.visible = true;
225
else if(default_type == 48) {
226
bigstyle.checked = true;
281
// hoverimage: "blue.png"
282
// text: qsTr("Restore")//恢复默认
330
269
pageStack.push(functioncollection);
333
// onRestoreBtnClicked: {
335
// sessiondispatcher.set_default_theme_qt("mousetheme");
336
// var defaulttheme = sessiondispatcher.get_cursor_theme_qt();
337
// systemdispatcher.set_cursor_theme_with_root_qt(defaulttheme);
338
// showText.text = qsTr("[ Current Cursor Theme: ") + defaulttheme + " ]";//[ 当前光标主题是:
339
// statusImage.visible = true;
340
// var defaulttheme = sessiondispatcher.read_default_configure_from_qsetting_file("theme", "cursortheme");
341
// var defaultsize = sessiondispatcher.read_default_configure_from_qsetting_file("theme", "cursorsize");
343
// if((defaulttheme == mousepointerpage.selected_cursor_theme) && (defaultsize == mousepointerpage.cursor_size)) {
344
// sessiondispatcher.showWarningDialog(qsTr("Tips: "), qsTr("Cursor configure is the default configuration!"), mainwindow.pos.x, mainwindow.pos.y);//友情提示://光标配置已经为默认设置!
347
// if(defaulttheme != mousepointerpage.selected_cursor_theme) {
348
// sessiondispatcher.set_cursor_theme_qt(defaulttheme);
349
// systemdispatcher.set_cursor_theme_with_root_qt(defaulttheme);
350
// mousepointerpage.selected_cursor_theme = defaulttheme;
351
// showText.text = qsTr("[ Current Cursor Theme: ") + defaulttheme + " ]";//[ 当前光标主题是:
352
// cursorcombo.selectedIndex = 0;
354
// if(defaultsize != mousepointerpage.cursor_size) {
355
// sessiondispatcher.set_cursor_size_qt(defaultsize);
356
// mousepointerpage.cursor_size = defaultsize;
357
// if(defaultsize == 24) {
358
// smallstyle.checked = true;
360
// else if(defaultsize == 36) {
361
// bigstyle.checked = true;
364
// statusImage.visible = true;
368
interval: 5000; running: true; repeat: true
369
onTriggered: statusImage.visible = false