~ubuntu-branches/ubuntu/vivid/youker-assistant/vivid

« back to all changes in this revision

Viewing changes to qml/func/settings/TouchpadSet.qml

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2014-03-24 15:52:37 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140324155237-3kod0m3wr2a2ag39
Tags: 1.0.1-0ubuntu1
* New upstream release (LP: #1294936).
* Modify display mode of weather forecast and system settings.
* Add file manager and font style settings.
* Improve system settings and restoring default settings.
* Cache user account (not password).
* Change the position of window control buttons.
* Add configuration for Kingsoft KuaiPan cloud client.
* Add the instruction of Youker Assistant.
* Open related folders when scanning items got double-clicked.
* Notify users when operating the Kingsoft disk cloud configuration.
* Modify Dbus starting method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
Rectangle {
22
22
    id: touchpadsetpage
23
 
    property bool on: true
24
23
    width: parent.width
25
24
    height: 475
26
 
    property string fontName: "Helvetica"
27
 
    property int fontSize: 12
28
 
    property color fontColor: "black"
 
25
 
29
26
    property string scrollbars_mode: ""
30
27
    property string touchscrolling_mode: ""
31
28
    property string actiontitle: qsTr("Touchpad settings")//触摸板设置
36
33
        anchors.fill: parent
37
34
    }
38
35
 
 
36
    //使用云配置后,控件状态根据配置发生相应的变化
 
37
    Connections
 
38
    {
 
39
        target: sessiondispatcher
 
40
        onTellDownloadCloudConfToQML: {
 
41
            if(download == "touchpad_enable") {
 
42
                if (sessiondispatcher.get_touchpad_enable_qt()) {
 
43
                    touchpadswitcher.switchedOn = true;
 
44
                }
 
45
                else {
 
46
                    touchpadswitcher.switchedOn = false;
 
47
                }
 
48
            }
 
49
            else if(download == "touch_horizontal_scrolling") {
 
50
                if (sessiondispatcher.get_touchscrolling_use_horizontal_qt()) {
 
51
                    horizontalswitcher.switchedOn = true;
 
52
                }
 
53
                else {
 
54
                    horizontalswitcher.switchedOn = false;
 
55
                }
 
56
            }
 
57
            else if(download == "type_scroll_bar") {
 
58
                touchpadsetpage.scrollbars_mode = sessiondispatcher.get_scrollbars_mode_qt();
 
59
                if (touchpadsetpage.scrollbars_mode == "overlay-auto") {
 
60
                    overlay.checked = true;
 
61
                }
 
62
                else if(touchpadsetpage.scrollbars_mode == "normal") {
 
63
                    legacy.checked = true;
 
64
                }
 
65
            }
 
66
            else if(download == "touchpad_scrolling_mode") {
 
67
                touchpadsetpage.touchscrolling_mode = sessiondispatcher.get_touchscrolling_mode_qt();
 
68
                if (touchpadsetpage.touchscrolling_mode == "edge-scrolling") {
 
69
                    edge.checked = true;
 
70
                }
 
71
                else if(touchpadsetpage.touchscrolling_mode == "two-finger-scrolling") {
 
72
                    twofinger.checked = true;
 
73
                }
 
74
            }
 
75
        }
 
76
    }
 
77
 
39
78
    Component.onCompleted: {
40
79
        touchpadsetpage.scrollbars_mode = sessiondispatcher.get_scrollbars_mode_qt();
41
 
//        sessiondispatcher.write_default_configure_to_qsetting_file("touchpad", "scrolltype", touchpadsetpage.scrollbars_mode);
42
80
        touchpadsetpage.touchscrolling_mode = sessiondispatcher.get_touchscrolling_mode_qt();//edge-scrolling
43
 
//        sessiondispatcher.write_default_configure_to_qsetting_file("touchpad", "scrollmode", touchpadsetpage.touchscrolling_mode);
44
81
        if (sessiondispatcher.get_touchpad_enable_qt()) {
45
82
            touchpadswitcher.switchedOn = true;
46
 
//            sessiondispatcher.write_default_configure_to_qsetting_file("touchpad", "enable", "true");
47
83
        }
48
84
        else {
49
85
            touchpadswitcher.switchedOn = false;
50
 
//            sessiondispatcher.write_default_configure_to_qsetting_file("touchpad", "enable", "false");
51
86
        }
52
 
 
53
87
        if (sessiondispatcher.get_touchscrolling_use_horizontal_qt()) {
54
88
            horizontalswitcher.switchedOn = true;
55
 
//            sessiondispatcher.write_default_configure_to_qsetting_file("touchpad", "horizontal", "true");
56
89
        }
57
90
        else {
58
91
            horizontalswitcher.switchedOn = false;
59
 
//            sessiondispatcher.write_default_configure_to_qsetting_file("touchpad", "horizontal", "false");
60
92
        }
61
93
    }
62
94
 
66
98
        anchors.topMargin: 44
67
99
        anchors.left: parent.left
68
100
        anchors.leftMargin: 80
69
 
        Row {
70
 
            spacing: 50
71
 
            Text {
72
 
                 text: touchpadsetpage.actiontitle
73
 
                 font.bold: true
74
 
                 font.pixelSize: 14
75
 
                 color: "#383838"
76
 
             }
77
 
            //status picture
78
 
            Common.StatusImage {
79
 
                id: statusImage
80
 
                visible: false
81
 
                iconName: "green.png"
82
 
                text: qsTr("Completed")//已完成
83
 
                anchors.verticalCenter: parent.verticalCenter
84
 
            }
 
101
        Text {
 
102
            text: touchpadsetpage.actiontitle
 
103
            font.bold: true
 
104
            font.pixelSize: 14
 
105
            color: "#383838"
85
106
        }
86
107
        Text {
87
108
            width: touchpadsetpage.width - 80 - 20
117
138
    }
118
139
    Row {
119
140
        id: setcontext
120
 
        spacing: 200
 
141
        spacing: 314 - 16 - 20
121
142
        anchors{
122
143
            left: parent.left
123
144
            leftMargin: 60
124
145
            top: settitle.bottom
125
146
            topMargin: 20
126
147
        }
 
148
        z: 11
127
149
        Row {
128
 
            spacing: 40
 
150
            spacing: 20
 
151
            Common.TipLabel {
 
152
                anchors.verticalCenter: parent.verticalCenter
 
153
                kflag: "yes"
 
154
                showImage: "../../img/icons/cloud-light.png"
 
155
            }
129
156
            Common.Label {
130
 
                width: 130
 
157
                width: 160
 
158
                anchors.verticalCenter: parent.verticalCenter
131
159
                text: qsTr("Enable/Disable touchpad: ")//启用/禁用触摸板:
132
160
                font.pixelSize: 12
133
161
                color: "#7a7a7a"
134
 
    //                anchors.verticalCenter: parent.verticalCenter
135
162
            }
136
163
            Common.Switch {
137
164
                id: touchpadswitcher
138
 
                width: 125
 
165
                anchors.verticalCenter: parent.verticalCenter
 
166
                width: 160
139
167
                onSwitched: {
140
168
                    if (touchpadswitcher.switchedOn) {
141
169
                        sessiondispatcher.set_touchpad_enable_qt(true);
146
174
                }
147
175
            }
148
176
        }
 
177
 
149
178
        Common.Button {
150
179
            hoverimage: "blue.png"
151
180
            text: qsTr("Restore")//恢复默认
199
228
            top: scrollrow.bottom
200
229
            topMargin: 30
201
230
        }
202
 
 
203
 
        Row {
204
 
            spacing: 200
 
231
        z: 11
 
232
        Row {
 
233
            spacing: 314 - 16 - 20
 
234
            Row {
 
235
                id: horizontalscroll
 
236
                spacing: 20
 
237
                Common.TipLabel {
 
238
                    anchors.verticalCenter: parent.verticalCenter
 
239
                    kflag: "yes"
 
240
                    showImage: "../../img/icons/cloud-light.png"
 
241
                }
 
242
                Common.Label {
 
243
                    width: 160
 
244
                    text: qsTr("Touchpad horizontal scroll: ")//触摸板横向滚动:
 
245
                    font.pixelSize: 12
 
246
                    color: "#7a7a7a"
 
247
                    anchors.verticalCenter: parent.verticalCenter
 
248
                }
 
249
                Common.Switch {
 
250
                    id: horizontalswitcher
 
251
                    width: 160
 
252
                    anchors.verticalCenter: parent.verticalCenter
 
253
                    onSwitched: {
 
254
                        if (horizontalswitcher.switchedOn) {
 
255
                            sessiondispatcher.set_touchscrolling_use_horizontal_qt(true);
 
256
                        }
 
257
                        else if(!horizontalswitcher.switchedOn) {
 
258
                            sessiondispatcher.set_touchscrolling_use_horizontal_qt(false);
 
259
                        }
 
260
                    }
 
261
                }
 
262
            }
 
263
 
 
264
            Common.Button {
 
265
                hoverimage: "blue.png"
 
266
                text: qsTr("Restore")//恢复默认
 
267
                width: 94
 
268
                height: 29
 
269
                fontsize: 13
 
270
                anchors.verticalCenter: parent.verticalCenter
 
271
                onClicked: {
 
272
                    sessiondispatcher.set_default_system_qt("horiz-scroll-enabled");//触摸板横向滚动
 
273
                    if (sessiondispatcher.get_touchscrolling_use_horizontal_qt()) {
 
274
                        horizontalswitcher.switchedOn = true;
 
275
                    }
 
276
                    else {
 
277
                        horizontalswitcher.switchedOn = false;
 
278
                    }
 
279
                }
 
280
            }
 
281
        }
 
282
 
 
283
        Row {
 
284
            spacing: 314 - 16 - 20
205
285
            Row {
206
286
                id: workmode
207
 
                spacing: 40
 
287
                spacing: 20
 
288
                Common.TipLabel {
 
289
                    anchors.verticalCenter: parent.verticalCenter
 
290
                    kflag: "yes"
 
291
                    showImage: "../../img/icons/cloud-light.png"
 
292
                }
208
293
                Common.Label {
209
 
                    width: 130
 
294
                    width: 160
210
295
                    text: qsTr("Scrollbar type: ")//滚动条类型:
211
296
                    font.pixelSize: 12
212
297
                    color: "#7a7a7a"
218
303
        //            adjustToContentSize: true
219
304
                    Common.ButtonRow {
220
305
                        exclusive: true//控制是否联动
221
 
                        spacing: 100
 
306
                        spacing: 134
222
307
                        Common.CheckBox {
223
308
                            id:overlay
224
309
                            titleName: qsTr("Features Type") //特色类型
229
314
                                    if(touchpadsetpage.scrollbars_mode != "overlay-auto") {
230
315
                                        sessiondispatcher.set_scrollbars_mode_overlay_qt();
231
316
                                        touchpadsetpage.scrollbars_mode = "overlay-auto";
232
 
                                        statusImage.visible = true;
233
317
                                    }
234
318
                                }
235
319
                            }
244
328
                                    if(touchpadsetpage.scrollbars_mode != "normal") {
245
329
                                        sessiondispatcher.set_scrollbars_mode_legacy_qt();
246
330
                                        touchpadsetpage.scrollbars_mode = "normal";
247
 
                                        statusImage.visible = true;
248
331
                                    }
249
332
                                }
250
333
                            }
252
335
        //            }
253
336
                }
254
337
            }
 
338
 
255
339
            Common.Button {
256
340
                hoverimage: "blue.png"
257
341
                text: qsTr("Restore")//恢复默认
272
356
            }
273
357
        }
274
358
 
275
 
 
276
 
 
277
359
        Row {
278
 
            spacing: 200
 
360
            spacing: 314 - 16 - 20
279
361
            Row {
280
362
                id: scrollstyle
281
 
                spacing: 40
 
363
                spacing: 20
 
364
                Common.TipLabel {
 
365
                    anchors.verticalCenter: parent.verticalCenter
 
366
                    kflag: "yes"
 
367
                    showImage: "../../img/icons/cloud-light.png"
 
368
                }
282
369
                Common.Label {
283
 
                    width: 130
 
370
                    width: 160
284
371
                    text: qsTr("Touchpad scroll trigger mode: ")//触摸板滚动触发方式:
285
372
                    font.pixelSize: 12
286
373
                    color: "#7a7a7a"
292
379
        //            adjustToContentSize: true
293
380
                    Common.ButtonRow {
294
381
                        exclusive: true//控制是否联动
295
 
                        spacing: 100
 
382
                        spacing: 134
296
383
                        Common.CheckBox {
297
384
                            id:edge
298
385
                            titleName: qsTr("Edgemotion")//边缘触发
303
390
                                    if(touchpadsetpage.touchscrolling_mode != "edge-scrolling") {
304
391
                                        sessiondispatcher.set_touchscrolling_mode_edge_qt();
305
392
                                        touchpadsetpage.touchscrolling_mode = "edge-scrolling";
306
 
                                        statusImage.visible = true;
307
393
                                    }
308
394
                                }
309
395
                            }
318
404
                                    if(touchpadsetpage.touchscrolling_mode != "two-finger-scrolling") {
319
405
                                        sessiondispatcher.set_touchscrolling_mode_twofinger_qt();
320
406
                                        touchpadsetpage.touchscrolling_mode = "two-finger-scrolling";
321
 
                                        statusImage.visible = true;
322
407
                                    }
323
408
                                }
324
409
                            }
326
411
        //            }
327
412
                }
328
413
            }
 
414
 
329
415
            Common.Button {
330
416
                hoverimage: "blue.png"
331
417
                text: qsTr("Restore")//恢复默认
345
431
                }
346
432
            }
347
433
        }
348
 
 
349
 
 
350
 
        Row {
351
 
            spacing: 200
352
 
            Row {
353
 
                id: horizontalscroll
354
 
                spacing: 40
355
 
                Common.Label {
356
 
                    width: 130
357
 
                    text: qsTr("Touchpad horizontal scroll: ")//触摸板横向滚动:
358
 
                    font.pixelSize: 12
359
 
                    color: "#7a7a7a"
360
 
                    anchors.verticalCenter: parent.verticalCenter
361
 
                }
362
 
                Common.Switch {
363
 
                    id: horizontalswitcher
364
 
                    width: 125
365
 
                    onSwitched: {
366
 
                        if (horizontalswitcher.switchedOn) {
367
 
                            sessiondispatcher.set_touchscrolling_use_horizontal_qt(true);
368
 
                        }
369
 
                        else if(!horizontalswitcher.switchedOn) {
370
 
                            sessiondispatcher.set_touchscrolling_use_horizontal_qt(false);
371
 
                        }
372
 
                    }
373
 
                }
374
 
            }
375
 
            Common.Button {
376
 
                hoverimage: "blue.png"
377
 
                text: qsTr("Restore")//恢复默认
378
 
                width: 94
379
 
                height: 29
380
 
                fontsize: 13
381
 
                anchors.verticalCenter: parent.verticalCenter
382
 
                onClicked: {
383
 
                    sessiondispatcher.set_default_system_qt("horiz-scroll-enabled");//触摸板横向滚动
384
 
                    if (sessiondispatcher.get_touchscrolling_use_horizontal_qt()) {
385
 
                        horizontalswitcher.switchedOn = true;
386
 
                    }
387
 
                    else {
388
 
                        horizontalswitcher.switchedOn = false;
389
 
                    }
390
 
                }
391
 
            }
392
 
        }
393
434
    }
394
435
 
395
 
 
396
 
 
397
436
    //顶层工具栏
398
437
    Bars.TopBar {
399
438
        id: topBar
421
460
    Bars.ToolBar {
422
461
        id: toolBar
423
462
        showok: false
424
 
//        showrestore: true
425
463
        height: 50; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9
426
464
        onQuitBtnClicked: {
427
465
            var num = sessiondispatcher.get_page_num();
435
473
                pageStack.push(functioncollection);
436
474
            }
437
475
        }
438
 
//        onRestoreBtnClicked: {
439
 
//            sessiondispatcher.set_default_system_qt("touchpad-enabled");//启用禁用触摸板
440
 
//            if (sessiondispatcher.get_touchpad_enable_qt()) {
441
 
//                touchpadswitcher.switchedOn = true;
442
 
//            }
443
 
//            else {
444
 
//                touchpadswitcher.switchedOn = false;
445
 
//            }
446
 
 
447
 
//            sessiondispatcher.set_default_system_qt("scrollbar-mode");//滚动条类型
448
 
//            var default_type = sessiondispatcher.get_scrollbars_mode_qt();
449
 
//            if(default_type == "overlay-auto") {
450
 
//                overlay.checked = true;
451
 
//            }
452
 
//            else if(default_type == "normal") {
453
 
//                legacy.checked = true;
454
 
//            }
455
 
//            sessiondispatcher.set_default_system_qt("scroll-method");//触摸板滚动条触发方式
456
 
//            var default_mode = sessiondispatcher.get_touchscrolling_mode_qt();
457
 
//            if(default_mode == "edge-scrolling") {
458
 
//                edge.checked = true;
459
 
//            }
460
 
//            else if(default_mode == "two-finger-scrolling") {
461
 
//                twofinger.checked = true;
462
 
//            }
463
 
//            sessiondispatcher.set_default_system_qt("horiz-scroll-enabled");//触摸板横向滚动
464
 
//            if (sessiondispatcher.get_touchscrolling_use_horizontal_qt()) {
465
 
//                horizontalswitcher.switchedOn = true;
466
 
//            }
467
 
//            else {
468
 
//                horizontalswitcher.switchedOn = false;
469
 
//            }
470
 
 
471
 
//            statusImage.visible = true;
472
 
 
473
 
 
474
 
//            var defaultenable = sessiondispatcher.read_default_configure_from_qsetting_file("touchpad", "enable");
475
 
//            var defaulthorizontal = sessiondispatcher.read_default_configure_from_qsetting_file("touchpad", "horizontal");
476
 
//            var defaulttype = sessiondispatcher.read_default_configure_from_qsetting_file("touchpad", "scrolltype");
477
 
//            var defaultmode = sessiondispatcher.read_default_configure_from_qsetting_file("touchpad", "scrollmode");
478
 
 
479
 
//            var enableFlag;
480
 
//            var horizontalFlag;
481
 
//            if(touchpadswitcher.switchedOn) {
482
 
//                enableFlag = "true";
483
 
//            }
484
 
//            else {
485
 
//                enableFlag = "false";
486
 
//            }
487
 
//            if(horizontalswitcher.switchedOn) {
488
 
//                horizontalFlag = "true";
489
 
//            }
490
 
//            else {
491
 
//                horizontalFlag = "false";
492
 
//            }
493
 
 
494
 
//            if((defaultenable == enableFlag) && (defaulthorizontal == horizontalFlag) && (touchpadsetpage.scrollbars_mode == defaulttype) && (touchpadsetpage.touchscrolling_mode == defaultmode)) {
495
 
//                //友情提示:        触摸板配置已经为默认配置!
496
 
//                sessiondispatcher.showWarningDialog(qsTr("Tips: "), qsTr("Touchpad configure has been restored to the default configuration!"), mainwindow.pos.x, mainwindow.pos.y);//触摸板配置已经为默认配置!
497
 
//            }
498
 
//            else {
499
 
//                if(defaultenable != enableFlag) {
500
 
//                    if(defaultenable == "true") {
501
 
//                        touchpadswitcher.switchedOn = true;
502
 
//                        sessiondispatcher.set_touchpad_enable_qt(true);
503
 
//                    }
504
 
//                    else {
505
 
//                        touchpadswitcher.switchedOn = false;
506
 
//                        sessiondispatcher.set_touchpad_enable_qt(false);
507
 
//                    }
508
 
//                }
509
 
//                if(defaulthorizontal != horizontalFlag) {
510
 
//                    if(defaulthorizontal == "true") {
511
 
//                        horizontalswitcher.switchedOn = true;
512
 
//                        sessiondispatcher.set_touchscrolling_use_horizontal_qt(true);
513
 
//                    }
514
 
//                    else {
515
 
//                        horizontalswitcher.switchedOn = false;
516
 
//                        sessiondispatcher.set_touchscrolling_use_horizontal_qt(false);
517
 
//                    }
518
 
//                }
519
 
//                if(touchpadsetpage.scrollbars_mode != defaulttype) {
520
 
//                    if(defaulttype == "overlay-auto") {
521
 
//                        sessiondispatcher.set_scrollbars_mode_overlay_qt();
522
 
//                        overlay.checked = true;
523
 
//                    }
524
 
//                    else if(defaulttype == "normal") {
525
 
//                        sessiondispatcher.set_scrollbars_mode_legacy_qt();
526
 
//                        legacy.checked = true;
527
 
//                    }
528
 
//                    touchpadsetpage.scrollbars_mode = defaulttype;
529
 
//                }
530
 
//                if(touchpadsetpage.touchscrolling_mode != defaultmode) {
531
 
//                    if(defaultmode == "edge-scrolling") {
532
 
//                        sessiondispatcher.set_touchscrolling_mode_edge_qt();
533
 
//                        edge.checked = true;
534
 
//                    }
535
 
//                    else if(defaultmode == "two-finger-scrolling") {
536
 
//                        sessiondispatcher.set_touchscrolling_mode_twofinger_qt();
537
 
//                        twofinger.checked = true;
538
 
//                    }
539
 
//                    touchpadsetpage.touchscrolling_mode = defaultmode;
540
 
//                }
541
 
//                statusImage.visible = true;
542
 
//            }
543
 
//        }
544
 
    }
545
 
    Timer {
546
 
         interval: 5000; running: true; repeat: true
547
 
         onTriggered: statusImage.visible = false
548
476
    }
549
477
}