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

« back to all changes in this revision

Viewing changes to qml/func/SoftWareRecommend.qml

  • Committer: Package Import Robot
  • Author(s): Kobe Lee (kylinkobe)
  • Date: 2013-09-18 16:22:14 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130918162214-6nqyjyf3cd3ynqky
Tags: 0.2.1-0ubuntu1
* Modify the mouse events of MonitorBall.
* Add reset button for clear pages.
* Add policykit for apt clear in sudodbus.
* Fixed the bug about software status and add masklayer.
* Rewrite the code of system information.
* Add some signals and slots.
* Fixed the bug about Software signals(LP: #1226389).
* Modify KThread and add base.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Kobe Lee    kobe24_lixiang@126.com
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; version 3.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
import QtQuick 1.1
 
21
import SessionType 0.1
 
22
import SystemType 0.1
 
23
import SudoType 0.1
 
24
import "common" as Common
 
25
import "bars" as Bars
 
26
Item {
 
27
    id: screen; width: parent.width; height: 475
 
28
//需要时常变动的变量
 
29
    property string image_flag:"wps"
 
30
    property string recommendone_image: "../img/skin/wps-small.png"
 
31
    property string recommendtwo_image: "../img/skin/qq-small.png"
 
32
    property string recommendthree_image: "../img/skin/qt-small.png"
 
33
    property string recommendoneimage_image: "../img/skin/wps.png"
 
34
    property string recommendimage_text: "WPS For UbuntuKylin,Linux系统上最好用的办公软件。"
 
35
    property string status_value: "n"
 
36
    property string status_value2: "n"
 
37
 
 
38
    Component.onCompleted: {
 
39
    }
 
40
//    Connections
 
41
//    {
 
42
//        target: sudodispatcher
 
43
//        onReGetList: {
 
44
//            sudodispatcher.add_source_ubuntukylin_qt();
 
45
//            sudodispatcher.check_pkgs_status_qt(sudodispatcher.getAllSoftwareList());
 
46
//            sudodispatcher.remove_source_ubuntukylin_qt();
 
47
//        }
 
48
//    }
 
49
//
 
50
    //背景
 
51
    Image {
 
52
        source: "../img/skin/bg-middle.png"
 
53
        anchors.fill: parent
 
54
    }
 
55
    Item {
 
56
        id: recommendimage
 
57
        width: 560
 
58
        height: 210
 
59
        anchors{
 
60
            left: parent.left
 
61
            leftMargin: 25
 
62
            top:parent.top
 
63
            topMargin: 25
 
64
        }
 
65
        Image {
 
66
            anchors.fill:parent
 
67
            source: recommendoneimage_image
 
68
        }
 
69
        Image {
 
70
            id: statusImage
 
71
            source: "../img/icons/recommend.png"
 
72
            anchors{
 
73
                right:parent.right
 
74
                top: parent.top
 
75
            }
 
76
        }
 
77
        Image{
 
78
            anchors.fill:parent
 
79
            source: "../img/skin/linecolor.png"
 
80
        }
 
81
        Rectangle{
 
82
            width: parent.width;height: 30
 
83
            anchors.bottom: parent.bottom
 
84
            color: "transparent"
 
85
            Text{
 
86
                id: desc_text
 
87
                visible: (screen.image_flag == "qt") ? false : true
 
88
                anchors{
 
89
                    left: parent.left
 
90
                    leftMargin: 15
 
91
                    verticalCenter: parent.verticalCenter
 
92
                }
 
93
                color: "white"
 
94
                text:recommendimage_text
 
95
            }
 
96
            Common.Button{
 
97
                id: ecliseBtn
 
98
                visible: (screen.image_flag == "qt") ? true : false
 
99
                width: 80;height: 26
 
100
                anchors{
 
101
                    left: parent.left
 
102
                    leftMargin: 15
 
103
                    verticalCenter: parent.verticalCenter
 
104
                }
 
105
                text: "详情"
 
106
                onClicked: {
 
107
                    if(screen.image_flag == "qt") {
 
108
                        content.delegate_name= "eclipse"
 
109
                        content.delegate_appname = "Eclipse平台(eclipse)"
 
110
                        content.delegate_image= "../img/logo/eclipse.jpg"
 
111
                        content.delegate_introduction="Eclipse 是一个开放源代码的、基于Java的可扩展开发平台。就其本身而言,它只是一个框架和一组服务,用于通过插件组件构建开发环境。幸运的是,Eclipse 附带了一个标准的插件集,包括Java开发工具(Java Development Kit,JDK)。"
 
112
                        content.introduction_image1= "../img/character/eclipse-01.png"
 
113
                        content.introduction_image2= "../img/character/eclipse-02.png"
 
114
//                        content.soft_status = sudodispatcher.getSoftwareStatus("eclipse");
 
115
                        content.soft_status = sudodispatcher.check_pkg_status_qt("eclipse");
 
116
                        sudodispatcher.notifySoftwareCurrentStatus(content.soft_status);
 
117
                    }
 
118
                    pageStack.push(softwarepage);
 
119
                }
 
120
            }
 
121
            Common.Button{
 
122
                width: 80;height: 26
 
123
                anchors{
 
124
                    verticalCenter:parent.verticalCenter
 
125
                    right:parent.right
 
126
                    rightMargin: 15
 
127
                }
 
128
                text: "详情"
 
129
                onClicked: {
 
130
                    if(screen.image_flag == "wps") {
 
131
                        sudodispatcher.add_source_ubuntukylin_qt();
 
132
                        content.delegate_name= "wps-office"
 
133
                        content.delegate_appname = "WPS For UbuntuKylin(wps-office)"
 
134
                        content.delegate_image= "../img/logo/wps.jpg"
 
135
                        content.delegate_introduction="Ubuntukylin团队与金山公司合作,于13.04开始首先推出WPS for UbuntuKylin 1.0,并于13.10推出WPS for UbuntuKylin1.2。与1.0版本相比,1.2版进行了稳定性提升、BUG修复、同时增加了数据透视表等功能,使您的文档工作更加专业和轻松。"
 
136
                        content.introduction_image1= "../img/character/wps-01.png"
 
137
                        content.introduction_image2= "../img/character/wps-02.png"
 
138
//                        content.soft_status = sudodispatcher.getSoftwareStatus("wps-office");
 
139
                        content.soft_status = sudodispatcher.check_pkg_status_qt("wps-office");
 
140
                        sudodispatcher.notifySoftwareCurrentStatus(content.soft_status);
 
141
                        sudodispatcher.remove_source_ubuntukylin_qt();
 
142
                    }
 
143
                    else if(screen.image_flag == "qq") {
 
144
                        content.delegate_name= "wine-qq2012-longeneteam"
 
145
                        content.delegate_appname = "Wine 1.5.18 patched for qq2012 Beta3"
 
146
                        content.delegate_image= "../img/logo/qq.jpg"
 
147
                        content.delegate_introduction="QQ2012基于官方Beta3版,支持双击deb包安装、支持全局热键、不会自动离线、文件传输正常、ibus中文输入法正常。"
 
148
                        content.introduction_image1= "../img/character/qq-01.png"
 
149
                        content.introduction_image2= "../img/character/qq-02.png"
 
150
//                        content.soft_status = sudodispatcher.getSoftwareStatus("wine-qq2012-longeneteam");
 
151
                        content.soft_status = sudodispatcher.check_pkg_status_qt("wine-qq2012-longeneteam");
 
152
                        sudodispatcher.notifySoftwareCurrentStatus(content.soft_status);
 
153
                    }
 
154
                    else if(screen.image_flag == "qt") {
 
155
                        content.delegate_name= "qtcreator"
 
156
                        content.delegate_appname = "Qt平台(qtcreator)"
 
157
                        content.delegate_image= "../img/logo/qtcreator.jpg"
 
158
                        content.delegate_introduction="Qt Creator是跨平台的 Qt IDE, Qt Creator 是 Qt 被 Nokia 收购后推出的一款新的轻量级集成开发环境(IDE)。此 IDE 能够跨平台运行,支持的系统包括 Linux(32 位及 64 位)、Mac OS X 以及 Windows。"
 
159
                        content.introduction_image1= "../img/character/qtcreator-01.png"
 
160
                        content.introduction_image2= "../img/character/qtcreator-02.png"
 
161
//                        content.soft_status = sudodispatcher.getSoftwareStatus("qtcreator");
 
162
                        content.soft_status = sudodispatcher.check_pkg_status_qt("qtcreator");
 
163
                        sudodispatcher.notifySoftwareCurrentStatus(content.soft_status);
 
164
                    }
 
165
                    pageStack.push(softwarepage);
 
166
                }
 
167
            }
 
168
        }
 
169
    }
 
170
    Column{
 
171
        id:colum
 
172
        anchors{
 
173
            top:parent.top
 
174
            topMargin: 25
 
175
            right: parent.right
 
176
            rightMargin: 25
 
177
        }
 
178
        spacing: 5
 
179
        Item{
 
180
            id: recommendone
 
181
            width:imageone.width;height: imageone.height
 
182
            Image {
 
183
                id:imageone
 
184
                source: recommendone_image
 
185
            }
 
186
            MouseArea{
 
187
                anchors.fill: parent
 
188
                onClicked: {
 
189
//                    screen.status_value = sudodispatcher.getSoftwareStatus("qq");
 
190
                    screen.image_flag = "wps";
 
191
                    screen.recommendimage_text = "WPS,Linux系统上最好用的办公软件。";
 
192
                    imagframe.y=colum.y+recommendone.y;
 
193
                    recommendoneimage_image="../img/skin/wps.png";
 
194
                }
 
195
            }
 
196
        }
 
197
        Item {
 
198
            id: recommendtwo
 
199
            width:imagetwo.width;height: imagetwo.height
 
200
            Image {
 
201
                id:imagetwo
 
202
                source: recommendtwo_image
 
203
            }
 
204
            MouseArea{
 
205
                anchors.fill: parent
 
206
                onClicked: {
 
207
//                    screen.status_value = sudodispatcher.getSoftwareStatus("qq");
 
208
                    screen.image_flag = "qq";
 
209
                    screen.recommendimage_text = "WineQQ,Linux系统上最好用的QQ版本。";
 
210
                    imagframe.y=colum.y+recommendtwo.y;
 
211
                    recommendoneimage_image="../img/skin/qq.png";
 
212
                }
 
213
            }
 
214
        }
 
215
        Item{
 
216
            id: recommendthree
 
217
            width:imagethree.width;height: imagethree.height
 
218
            Image {
 
219
                id:imagethree
 
220
                source: recommendthree_image
 
221
            }
 
222
            MouseArea{
 
223
                anchors.fill: parent
 
224
                onClicked: {
 
225
//                    screen.status_value = sudodispatcher.getSoftwareStatus("qtcreator");
 
226
//                    screen.status_value2 = sudodispatcher.getSoftwareStatus("qq");
 
227
                    screen.image_flag = "qt";
 
228
                    imagframe.y=colum.y+recommendthree.y;
 
229
                    recommendoneimage_image="../img/skin/qt.png";
 
230
                }
 
231
            }
 
232
        }
 
233
    }
 
234
 
 
235
    Image {
 
236
        id: imagframe
 
237
        source: "../img/skin/frame.png"
 
238
        x:colum.x-13;y:colum.y
 
239
        opacity: 0.8
 
240
    }
 
241
 
 
242
    Rectangle {
 
243
        id: views
 
244
        width: parent.width-50
 
245
        height: 227
 
246
        anchors{
 
247
            bottom:parent.bottom
 
248
            left: parent.left
 
249
            leftMargin: 25
 
250
        }
 
251
        clip:true
 
252
        border.color: "#9aa2af"
 
253
        color: "#e6ebfe"
 
254
        Rectangle{
 
255
            id:rec
 
256
            width: parent.width-1;height: 31
 
257
            anchors{
 
258
                top:parent.top
 
259
                topMargin: 1
 
260
                left: parent.left
 
261
                leftMargin: 1
 
262
            }
 
263
            gradient: Gradient{
 
264
                GradientStop{position: 0.0; color: "#e2e2e2"}
 
265
                GradientStop{position: 1.0; color: "#dedede"}
 
266
            }
 
267
            Row{
 
268
                anchors.centerIn: parent
 
269
                spacing: 50
 
270
                Text {
 
271
                    text:"推荐金榜单"
 
272
                    color: "#6b6f70"
 
273
                    font.pixelSize: 14
 
274
                }
 
275
            }
 
276
        }
 
277
        Rectangle{id: splitbar1; anchors{top:rec.bottom;left: parent.left;leftMargin: 1 }width:parent.width-1 ; height:1; color:"#b8bdc3"}
 
278
        Rectangle{id: splitbar2; anchors{top:splitbar1.bottom;left: parent.left;leftMargin: 1  }width:parent.width-1 ; height:1; color:"#ebf0f6"}
 
279
        Item {
 
280
            width: views.width
 
281
            height: 194
 
282
            anchors.bottom: parent.bottom
 
283
            clip:true
 
284
            ListModel {
 
285
                id: funcmodel
 
286
                ListElement {
 
287
                    icon: "../img/icons/kuaipan.png"
 
288
                    flag: "Kuaipan"
 
289
                }
 
290
                ListElement {
 
291
                    icon: "../img/icons/Pps.png"
 
292
                    flag: "Pps"
 
293
                }ListElement {
 
294
                    icon: "../img/icons/kugou.png"
 
295
                    flag: "KugouMusic"
 
296
                }
 
297
                ListElement {
 
298
                    icon: "../img/icons/xunlei.png"
 
299
                    flag: "XunLei"
 
300
                }
 
301
                ListElement {
 
302
                    icon: "../img/icons/stardict.png"
 
303
                    flag: "StarDict"
 
304
                }
 
305
                ListElement {
 
306
                    icon: "../img/icons/adobe-flash.png"
 
307
                    flag: "AdobeFlash"
 
308
                }
 
309
                ListElement {
 
310
                    icon: "../img/icons/vlc.png"
 
311
                    flag: "Vlc"
 
312
                }
 
313
                ListElement {
 
314
                    icon: "../img/icons/chromium.png"
 
315
                    flag: "Chromium"
 
316
                }
 
317
                ListElement {
 
318
                    icon: "../img/icons/virtualbox.png"
 
319
                    flag: "VirtualBox"
 
320
                }
 
321
                ListElement {
 
322
                    icon: "../img/icons/qbittorrent.png"
 
323
                    flag: "QbitTorrent"
 
324
                }
 
325
                ListElement {
 
326
                    icon: "../img/icons/xchat.png"
 
327
                    flag: "XChat"
 
328
                }
 
329
                ListElement {
 
330
                    icon: "../img/icons/lotus.png"
 
331
                    flag: "Lotus"
 
332
                }
 
333
                ListElement {
 
334
                    icon: "../img/icons/openfetion.png"
 
335
                    flag: "OpenFetion"
 
336
                }
 
337
 
 
338
//                ListElement {
 
339
//                    icon: "../img/icons/eclipse.png"
 
340
//                    flag: "Eclipse"
 
341
//                }
 
342
//                ListElement {
 
343
//                    icon: "../img/icons/qt.png"
 
344
//                    flag: "Qtcreator"
 
345
//                }
 
346
//                ListElement {
 
347
//                    icon: "../img/icons/qq.png"
 
348
//                    flag: "Wineqq"
 
349
//                }
 
350
//                ListElement {
 
351
//                    icon: "../img/icons/wps.png"
 
352
//                    flag: "Wps"
 
353
//                }
 
354
            }
 
355
            GridView {
 
356
                id: gridView
 
357
                height: parent.height-12
 
358
                width: parent.width
 
359
                anchors {
 
360
                    top: parent.top
 
361
                    topMargin: 12
 
362
                    left: parent.left
 
363
                    leftMargin: 20
 
364
                }
 
365
                model: funcmodel
 
366
                delegate: SoftwareDelegate {}
 
367
                cacheBuffer: 1000
 
368
                cellWidth: 190; cellHeight: 90
 
369
                focus: true
 
370
            }
 
371
            Rectangle{
 
372
                id:scrollbar
 
373
                anchors.right: parent.right
 
374
                anchors.rightMargin: 4
 
375
                height: parent.height-1
 
376
                width:13
 
377
                color: "lightgrey"
 
378
            }
 
379
            Rectangle{
 
380
                id: button
 
381
                anchors.right: parent.right
 
382
                anchors.rightMargin: 5
 
383
                width: 12
 
384
                y: gridView.visibleArea.yPosition * (scrollbar.height + 100) //257
 
385
//                height: gridView.visibleArea.heightRatio * scrollbar.height;
 
386
                height: 45
 
387
                radius: 3
 
388
                smooth: true
 
389
                color: "white"
 
390
                border.color: "lightgrey"
 
391
                Column{
 
392
                    anchors.verticalCenter: parent.verticalCenter
 
393
                    anchors.horizontalCenter: parent.horizontalCenter
 
394
                    spacing: 2
 
395
                    Rectangle{
 
396
                        width: 8;height: 1
 
397
                        color: "lightgrey"
 
398
                    }
 
399
                    Rectangle{
 
400
                        width: 8;height: 1
 
401
                        color: "lightgrey"
 
402
                    }
 
403
                    Rectangle{
 
404
                        width: 8;height: 1
 
405
                        color: "lightgrey"
 
406
                    }
 
407
                }
 
408
                MouseArea {
 
409
                    id: mousearea
 
410
                    anchors.fill: button
 
411
                    drag.target: button
 
412
                    drag.axis: Drag.YAxis
 
413
                    drag.minimumY: 0
 
414
                    drag.maximumY: scrollbar.height - button.height
 
415
                    onMouseYChanged: {
 
416
                        gridView.contentY = button.y / (scrollbar.height + 100) * gridView.contentHeight //257
 
417
                    }
 
418
                }
 
419
            }
 
420
        }
 
421
    }
 
422
}