Commit d69abdbe authored by Nathaniel Graham's avatar Nathaniel Graham
Browse files

Make the review pop-up a bit more user-friendly

Summary:
Polish the design of the review input pop-up:
- Make the button tell you what you need to do
- Make it impossible to accidentally submit a one-star review

BUG: 390426

Test Plan: {F5712259}

Reviewers: #discover_software_store, apol, abetts

Reviewed By: #discover_software_store, apol

Subscribers: anemeth, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10500
parent 89cf44b3
......@@ -27,7 +27,7 @@ RowLayout
id: view
property bool editable: false
property int max: 10
property int rating: 2
property int rating: 0
property real starSize: Kirigami.Units.gridUnit
clip: true
......@@ -37,7 +37,7 @@ RowLayout
Repeater {
id: theRepeater
model: view.rating>0 ? 5 : 0
model: 5
delegate: Kirigami.Icon {
Layout.minimumWidth: view.starSize
Layout.minimumHeight: view.starSize
......
......@@ -11,7 +11,7 @@ Kirigami.OverlaySheet
property QtObject application
readonly property alias rating: ratingInput.rating
readonly property alias summary: summaryInput.text
readonly property alias summary: titleInput.text
readonly property alias review: reviewInput.text
property QtObject backend: null
......@@ -29,19 +29,16 @@ Kirigami.OverlaySheet
visible: reviewDialog.backend.userName.length > 0
text: visible ? i18n("Submission name: %1", reviewDialog.backend.userName) : ""
}
Label { text: i18n("Summary:") }
Label { text: i18n("Title:") }
TextField {
id: summaryInput
id: titleInput
Layout.fillWidth: true
placeholderText: i18n("Short summary...")
validator: RegExpValidator { regExp: /.{3,70}/ }
}
Label { text: i18n("Review:") }
TextArea {
id: reviewInput
readonly property bool acceptableInput: inputIssue.length === 0
readonly property string inputIssue: length < 15 ? i18n("Comment too short") :
length > 3000 ? i18n("Comment too long") : ""
readonly property bool acceptableInput: length > 15 && length < 3000
Layout.fillWidth: true
Layout.fillHeight: true
}
......@@ -49,9 +46,14 @@ Kirigami.OverlaySheet
Button {
id: acceptButton
Layout.alignment: Qt.AlignRight
enabled: summaryInput.acceptableInput && reviewInput.acceptableInput
text: summaryInput.acceptableInput && reviewInput.acceptableInput ? i18n("Submit")
: !summaryInput.acceptableInput ? i18n("Improve summary") : reviewInput.inputIssue
enabled: rating > 2 && titleInput.acceptableInput && reviewInput.acceptableInput
text: {
if (rating < 2) return i18n("Enter a rating");
if (! titleInput.acceptableInput) return i18n("Write a title");
if (reviewInput.length < 15) return i18n("Keep writing...");
if (reviewInput.length > 3000) return i18n("Too long!");
return i18n("Submit review");
}
onClicked: {
reviewDialog.accepted()
reviewDialog.sheetOpen = false
......
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