Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/ApplicationDelegate.qml
Show All 24 Lines | |||||
25 | import "navigation.js" as Navigation | 25 | import "navigation.js" as Navigation | ||
26 | import org.kde.kirigami 2.4 as Kirigami | 26 | import org.kde.kirigami 2.4 as Kirigami | ||
27 | 27 | | |||
28 | Kirigami.AbstractCard | 28 | Kirigami.AbstractCard | ||
29 | { | 29 | { | ||
30 | id: delegateArea | 30 | id: delegateArea | ||
31 | property alias application: installButton.application | 31 | property alias application: installButton.application | ||
32 | property bool compact: false | 32 | property bool compact: false | ||
33 | property bool showRating: true | ||||
33 | showClickFeedback: true | 34 | showClickFeedback: true | ||
34 | 35 | | |||
35 | function trigger() { | 36 | function trigger() { | ||
36 | if (ListView.view) | 37 | if (ListView.view) | ||
37 | ListView.view.currentIndex = index | 38 | ListView.view.currentIndex = index | ||
38 | Navigation.openApplication(application) | 39 | Navigation.openApplication(application) | ||
39 | } | 40 | } | ||
40 | highlighted: ListView.isCurrentItem | 41 | highlighted: ListView.isCurrentItem | ||
Show All 11 Lines | 48 | Kirigami.Icon { | |||
52 | width: contHeight | 53 | width: contHeight | ||
53 | anchors { | 54 | anchors { | ||
54 | verticalCenter: parent.verticalCenter | 55 | verticalCenter: parent.verticalCenter | ||
55 | left: parent.left | 56 | left: parent.left | ||
56 | } | 57 | } | ||
57 | } | 58 | } | ||
58 | 59 | | |||
59 | ColumnLayout { | 60 | ColumnLayout { | ||
60 | spacing: delegateArea.compact ? 3 : 5 | 61 | spacing: delegateArea.compact ? 0 : 5 | ||
61 | anchors { | 62 | anchors { | ||
63 | verticalCenter: parent.verticalCenter | ||||
62 | right: parent.right | 64 | right: parent.right | ||
63 | left: resourceIcon.right | 65 | left: resourceIcon.right | ||
64 | leftMargin: Kirigami.Units.largeSpacing | 66 | leftMargin: Kirigami.Units.largeSpacing | ||
65 | } | 67 | } | ||
66 | 68 | | |||
67 | Kirigami.Heading { | 69 | Kirigami.Heading { | ||
68 | id: head | 70 | id: head | ||
69 | level: delegateArea.compact ? 3 : 2 | 71 | level: delegateArea.compact ? 3 : 2 | ||
70 | Layout.fillWidth: true | 72 | Layout.fillWidth: true | ||
71 | Layout.rightMargin: installButton.width | 73 | Layout.rightMargin: installButton.width | ||
72 | elide: Text.ElideRight | 74 | elide: Text.ElideRight | ||
73 | text: delegateArea.application.name | 75 | text: delegateArea.application.name | ||
74 | maximumLineCount: 1 | 76 | maximumLineCount: 1 | ||
75 | 77 | | |||
76 | InstallApplicationButton { | 78 | InstallApplicationButton { | ||
77 | id: installButton | 79 | id: installButton | ||
78 | anchors { | 80 | anchors { | ||
79 | verticalCenter: parent.verticalCenter | 81 | verticalCenter: delegateArea.compact ? parent.bottom: parent.verticalCenter | ||
80 | left: parent.right | 82 | left: parent.right | ||
81 | } | 83 | } | ||
82 | } | 84 | } | ||
83 | 85 | | |||
84 | } | 86 | } | ||
85 | 87 | | |||
86 | Rectangle { | 88 | RowLayout { | ||
87 | color: Kirigami.Theme.linkColor | 89 | visible: showRating | ||
88 | Layout.fillWidth: true | 90 | spacing: Kirigami.Units.largeSpacing | ||
89 | Layout.rightMargin: delegateArea.compact ? installButton.width + Kirigami.Units.largeSpacing : 0 | 91 | Rating { | ||
90 | height: Kirigami.Units.devicePixelRatio / 2 | 92 | rating: delegateArea.application.rating ? delegateArea.application.rating.sortableRating : 0 | ||
93 | starSize: delegateArea.compact ? summary.font.pointSize : head.font.pointSize | ||||
94 | } | ||||
95 | QQC2.Label { | ||||
96 | text: delegateArea.application.rating ? i18n("%1 ratings", delegateArea.application.rating.ratingCount) : i18n("No ratings yet") | ||||
97 | opacity: 0.5 | ||||
98 | } | ||||
91 | } | 99 | } | ||
92 | 100 | | |||
93 | Layout.fillWidth: true | 101 | Layout.fillWidth: true | ||
94 | QQC2.Label { | 102 | QQC2.Label { | ||
103 | id: summary | ||||
95 | Layout.fillWidth: true | 104 | Layout.fillWidth: true | ||
96 | bottomPadding: Kirigami.Units.smallSpacing | 105 | bottomPadding: Kirigami.Units.smallSpacing | ||
97 | elide: Text.ElideRight | 106 | elide: Text.ElideRight | ||
98 | text: delegateArea.application.comment | 107 | text: delegateArea.application.comment | ||
99 | maximumLineCount: 1 | 108 | maximumLineCount: 1 | ||
100 | textFormat: Text.PlainText | 109 | textFormat: Text.PlainText | ||
101 | } | 110 | } | ||
102 | } | 111 | } | ||
103 | } | 112 | } | ||
104 | } | 113 | } |