Commit acf66dd1 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Bring back embedded top3 reviews on the ApplicationPage

Summary: FEATURE: 380514

Reviewers: ngraham, #discover_software_store

Subscribers: ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10237
parent 116f19e6
......@@ -208,6 +208,34 @@ DiscoverPage {
onClicked: addonsView.sheetOpen = true
}
Kirigami.Heading {
Layout.topMargin: Kirigami.Units.largeSpacing
text: i18n("Reviews")
level: 2
visible: rep.count > 0
}
Rectangle {
color: Kirigami.Theme.linkColor
Layout.fillWidth: true
height: 1
visible: rep.count > 0
}
Repeater {
id: rep
model: PaginateModel {
sourceModel: reviewsSheet.model
pageSize: 3
}
delegate: ReviewDelegate {
Layout.topMargin: Kirigami.Units.largeSpacing
separator: false
compact: true
Layout.bottomMargin: Kirigami.Units.largeSpacing
}
}
LinkButton {
text: i18n("Review")
onClicked: reviewsSheet.openReviewDialog()
......@@ -217,25 +245,19 @@ DiscoverPage {
id: commentsButton
readonly property QtObject rating: appInfo.application.rating
visible: rating && rating.ratingCount>0 && reviewsModel.count
text: i18n("Show reviews (%1)...", rating ? reviewsModel.count : 0)
text: i18n("Show more reviews (%1)...", rating ? reviewsModel.count : 0)
onClicked: {
reviewsSheet.open()
}
Layout.bottomMargin: Kirigami.Units.largeSpacing
}
Item {
height: addonsButton.height
width: 5
}
// Details/metadata
Rectangle {
Layout.topMargin: Kirigami.Units.smallSpacing
color: Kirigami.Theme.linkColor
Layout.fillWidth: true
height: 1
Layout.bottomMargin: Kirigami.Units.smallSpacing
Layout.bottomMargin: Kirigami.Units.largeSpacing
}
GridLayout {
rowSpacing: 0
......
......@@ -27,6 +27,8 @@ ColumnLayout
{
id: item
visible: model.shouldShow
property bool compact: false
property bool separator: true
signal markUseful(bool useful)
function usefulnessToString(favorable, total)
......@@ -53,13 +55,16 @@ ColumnLayout
Label {
Layout.fillWidth: true
text: display
maximumLineCount: item.compact ? 3 : undefined
wrapMode: Text.Wrap
}
Label {
visible: !item.compact
text: usefulnessToString(usefulnessFavorable, usefulnessTotal)
}
Label {
visible: !item.compact
Layout.alignment: Qt.AlignRight
text: {
switch(usefulChoice) {
......@@ -77,6 +82,7 @@ ColumnLayout
onLinkActivated: item.markUseful(link=='true')
}
Kirigami.Separator {
visible: item.separator
Layout.fillWidth: true
}
}
......@@ -73,6 +73,7 @@ Kirigami.OverlaySheet {
left: parent.left
right: parent.right
}
separator: index != ListView.view.count-1
onMarkUseful: page.model.markUseful(index, useful)
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment