~ubuntu-branches/ubuntu/vivid/muon/vivid-proposed

« back to all changes in this revision

Viewing changes to discover/qml/ApplicationsList.qml

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell, Harald Sitter, Jonathan Riddell
  • Date: 2015-01-15 01:33:55 UTC
  • mfrom: (1.4.31)
  • mto: This revision was merged to the branch mainline in revision 81.
  • Revision ID: package-import@ubuntu.com-20150115013355-3h99wieurdvo6z6q
Tags: 4:5.1.95-0ubuntu1
[ Harald Sitter ]
* New upstream release based on KDE Frameworks 5
* muon-installer is no more remove binary package and all references
* Drop all patches, they all came from upstream anyway
* Remove muon.1 it was wrong and is now outdated
* Fix lintian warnings and ignore all that are bogus or not worth
  fixing

[ Jonathan Riddell ]
* New upstream beta release

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
18
 */
19
19
 
20
 
import QtQuick 1.1
21
 
import org.kde.plasma.core 0.1
22
 
import org.kde.plasma.components 0.1
23
 
import org.kde.qtextracomponents 0.1
 
20
import QtQuick 2.1
 
21
import QtQuick.Controls 1.1
 
22
import org.kde.kquickcontrolsaddons 2.0
24
23
import "navigation.js" as Navigation
25
24
 
26
 
Item {
 
25
ScrollView {
27
26
    id: parentItem
28
27
    property alias count: view.count
29
28
    property alias header: view.header
35
34
    ListView
36
35
    {
37
36
        id: view
38
 
        anchors {
39
 
            top: parent.top
40
 
            left: parent.left
41
 
            bottom: parent.bottom
42
 
            right: scroll.left
43
 
        }
44
37
        spacing: 3
45
38
        snapMode: ListView.SnapToItem
46
39
        currentIndex: -1
47
40
        
48
 
        delegate: ListItem {
49
 
                checked: view.currentIndex==index
 
41
        delegate: GridItem {
 
42
                id: delegateArea
 
43
//                 checked: view.currentIndex==index
50
44
                width: parentItem.actualWidth
51
45
                x: parentItem.proposedMargin
52
46
                property real contHeight: height*0.8
53
47
                height: nameLabel.font.pixelSize*3
54
 
                MouseArea {
55
 
                    id: delegateArea
56
 
                    anchors.fill: parent
57
 
                    onClicked: {
58
 
                        view.currentIndex = index
59
 
                        Navigation.openApplication(application)
60
 
                    }
61
 
                    hoverEnabled: true
62
 
                    QIconItem {
63
 
                        id: icon
64
 
                        icon: model.icon
65
 
                        width: contHeight
66
 
                        height: contHeight
67
 
                        anchors.verticalCenter: parent.verticalCenter
68
 
                        anchors.left: parent.left
69
 
                    }
70
 
                    
71
 
                    QIconItem {
72
 
                        anchors.right: icon.right
73
 
                        anchors.bottom: icon.bottom
74
 
                        visible: isInstalled && view.model.stateFilter!=2
75
 
                        icon: "dialog-ok"
76
 
                        height: 16
77
 
                        width: 16
78
 
                    }
79
 
                    Label {
80
 
                        id: nameLabel
81
 
                        anchors.top: icon.top
82
 
                        anchors.left: icon.right
83
 
                        anchors.right: ratingsItem.left
84
 
                        anchors.leftMargin: 5
85
 
                        font.pointSize: commentLabel.font.pointSize*1.7
86
 
                        elide: Text.ElideRight
87
 
                        text: name
88
 
                    }
89
 
                    Label {
90
 
                        id: commentLabel
91
 
                        anchors {
92
 
                            bottom: icon.bottom
93
 
                            left: icon.right
94
 
                            leftMargin: 5
95
 
                            right: installButton.left
96
 
                        }
97
 
                        elide: Text.ElideRight
98
 
                        text: comment
99
 
                        font.italic: true
100
 
                        opacity: delegateArea.containsMouse ? 1 : 0.2
101
 
                        maximumLineCount: 1
102
 
                        clip: true
103
 
                    }
104
 
                    Rating {
105
 
                        id: ratingsItem
106
 
                        anchors {
107
 
                            right: parent.right
108
 
                            top: parent.top
109
 
                        }
110
 
                        height: contHeight*.4
111
 
                        width: installButton.width/2
112
 
                        rating: model.rating
113
 
                    }
114
 
                    
115
 
                    InstallApplicationButton {
116
 
                        id: installButton
117
 
                        anchors {
118
 
                            bottom: parent.bottom
119
 
                            right: parent.right
120
 
                        }
121
 
                        width: Math.max(200, minimumWidth) //minimumWidth depends on paintedWidth, which is invalid before actually painting the button
122
 
//                         property bool isVisible: delegateArea.containsMouse && !installButton.canHide
123
 
//                         opacity: isVisible ? 1 : 0
124
 
                        application: model.application
125
 
                    }
 
48
 
 
49
                onClicked: {
 
50
                    view.currentIndex = index
 
51
                    Navigation.openApplication(application)
 
52
                }
 
53
 
 
54
                QIconItem {
 
55
                    id: resourceIcon
 
56
                    icon: model.icon
 
57
                    width: contHeight
 
58
                    height: contHeight
 
59
                    anchors {
 
60
                        verticalCenter: parent.verticalCenter
 
61
                        left: parent.left
 
62
                    }
 
63
                }
 
64
 
 
65
                QIconItem {
 
66
                    anchors {
 
67
                        right: resourceIcon.right
 
68
                        bottom: resourceIcon.bottom
 
69
                    }
 
70
                    visible: isInstalled && view.model.stateFilter!=2
 
71
                    icon: "checkmark"
 
72
                    height: 16
 
73
                    width: 16
 
74
                }
 
75
                Label {
 
76
                    id: nameLabel
 
77
                    anchors {
 
78
                        top: resourceIcon.top
 
79
                        left: resourceIcon.right
 
80
                        right: ratingsItem.left
 
81
                        leftMargin: 5
 
82
                    }
 
83
                    font.pointSize: commentLabel.font.pointSize*1.7
 
84
                    elide: Text.ElideRight
 
85
                    text: name
 
86
                }
 
87
                Label {
 
88
                    id: commentLabel
 
89
                    anchors {
 
90
                        bottom: resourceIcon.bottom
 
91
                        left: resourceIcon.right
 
92
                        leftMargin: 5
 
93
                        right: installButton.left
 
94
                    }
 
95
                    elide: Text.ElideRight
 
96
                    text: comment
 
97
                    font.italic: true
 
98
                    opacity: delegateArea.containsMouse ? 1 : 0.2
 
99
                    maximumLineCount: 1
 
100
                    clip: true
 
101
                }
 
102
                Rating {
 
103
                    id: ratingsItem
 
104
                    anchors {
 
105
                        right: parent.right
 
106
                        top: parent.top
 
107
                    }
 
108
                    height: contHeight*.4
 
109
                    width: installButton.width/2
 
110
                    rating: model.rating
 
111
                }
 
112
 
 
113
                InstallApplicationButton {
 
114
                    id: installButton
 
115
                    anchors {
 
116
                        bottom: parent.bottom
 
117
                        right: parent.right
 
118
                    }
 
119
                    width: Math.max(200, minimumWidth) //minimumWidth depends on paintedWidth, which is invalid before actually painting the button
 
120
//                     property bool isVisible: delegateArea.containsMouse && !installButton.canHide
 
121
//                     opacity: isVisible ? 1 : 0
 
122
                    application: model.application
126
123
                }
127
124
            }
128
125
    }
129
 
    
130
 
    NativeScrollBar {
131
 
        id: scroll
132
 
        orientation: Qt.Vertical
133
 
        flickableItem: view
134
 
        anchors {
135
 
                top: parent.top
136
 
                right: parent.right
137
 
                bottom: parent.bottom
138
 
        }
139
 
    }
140
126
}