diff --git a/discover/qml/ApplicationPage.qml b/discover/qml/ApplicationPage.qml --- a/discover/qml/ApplicationPage.qml +++ b/discover/qml/ApplicationPage.qml @@ -208,6 +208,34 @@ 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 @@ 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 diff --git a/discover/qml/ReviewDelegate.qml b/discover/qml/ReviewDelegate.qml --- a/discover/qml/ReviewDelegate.qml +++ b/discover/qml/ReviewDelegate.qml @@ -27,6 +27,8 @@ { 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 @@ 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 @@ onLinkActivated: item.markUseful(link=='true') } Kirigami.Separator { + visible: item.separator Layout.fillWidth: true } } diff --git a/discover/qml/ReviewsPage.qml b/discover/qml/ReviewsPage.qml --- a/discover/qml/ReviewsPage.qml +++ b/discover/qml/ReviewsPage.qml @@ -73,6 +73,7 @@ left: parent.left right: parent.right } + separator: index != ListView.view.count-1 onMarkUseful: page.model.markUseful(index, useful) } }