summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2015-09-23 16:18:33 (GMT)
committerAleix Pol <aleixpol@kde.org>2015-09-23 16:18:33 (GMT)
commit71572c478c7ac03c27a044f0f1a42d082922f36a (patch)
treef6b7aff03b325094696184fc094aa844837f5959
parentfd62e42569330dfc810736b25d563797e5ffc88a (diff)
code simplification
-rw-r--r--discover/qml/ApplicationsGridDelegate.qml79
1 files changed, 30 insertions, 49 deletions
diff --git a/discover/qml/ApplicationsGridDelegate.qml b/discover/qml/ApplicationsGridDelegate.qml
index d6f2cf1..78b42dc 100644
--- a/discover/qml/ApplicationsGridDelegate.qml
+++ b/discover/qml/ApplicationsGridDelegate.qml
@@ -39,60 +39,41 @@ GridItem {
color: sys.shadow
width: parent.width
height: parent.height*0.65
+ property bool hasThumbnail: model.application.thumbnailUrl!=""
- ConditionalLoader {
- id: artworkConditional
- anchors.fill: parent
-
- condition: model.application.thumbnailUrl!=""
- componentTrue: Item {
- Image {
- id: screen
- anchors {
- verticalCenter: parent.verticalCenter
- right: parent.right
- rightMargin: parent.width*0.1
- }
-
- source: model.application.thumbnailUrl
- height: parent.height*0.9
- fillMode: Image.PreserveAspectFit
- smooth: false
- cache: false
- asynchronous: true
- onStatusChanged: {
- if(status==Image.Error) {
- artworkConditional.hasThumbnail=false
- }
- }
- }
- Image {
- anchors {
- verticalCenter: parent.verticalCenter
- left: parent.left
- leftMargin: parent.width*0.1
- }
+ Image {
+ id: screen
+ anchors {
+ verticalCenter: parent.verticalCenter
+ right: parent.right
+ rightMargin: parent.width*0.1
+ }
- id: smallIcon
- width: 64
- height: width
- smooth: true
- asynchronous: true
- sourceSize: Qt.size(width, width)
- source: model.application.icon[0] == "/" ? "file://"+model.application.icon : "image://icon/"+model.application.icon
+ source: model.application.thumbnailUrl
+ height: parent.height*0.9
+ fillMode: Image.PreserveAspectFit
+ smooth: false
+ cache: false
+ asynchronous: true
+ onStatusChanged: {
+ if(status==Image.Error) {
+ artwork.hasThumbnail=false
}
}
- componentFalse: Item {
- Image {
- anchors.centerIn: parent
- height: parent.height*0.7
- width: height
- sourceSize: Qt.size(width, width)
- smooth: true
- asynchronous: true
- source: model.application.icon[0] == "/" ? "file://"+model.application.icon : "image://icon/"+model.application.icon
- }
+ }
+ Image {
+ anchors {
+ centerIn: parent
+ horizontalCenterOffset: artwork.hasThumbnail ? -50 : 0
}
+
+ id: smallIcon
+ width: 64
+ height: width
+ smooth: true
+ asynchronous: true
+ sourceSize: Qt.size(width, width)
+ source: model.application.icon[0] == "/" ? "file://"+model.application.icon : "image://icon/"+model.application.icon
}
}
RowLayout {