From 12183fbf05ea8102c27ab9dfef599880e923c243 Mon Sep 17 00:00:00 2001 From: Romain Le Jeune Date: Fri, 11 Aug 2023 05:39:34 +0000 Subject: [PATCH] feat(GODT-2787): Tweaking Bug Report form with last Review. --- .../bridge-gui/qml/BugCategoryView.qml | 2 +- .../bridge-gui/qml/BugQuestionView.qml | 5 ++- .../bridge-gui/qml/BugReportView.qml | 1 + .../bridge-gui/qml/QuestionItem.qml | 36 +++++++++++++++++-- .../qml/Resources/bug_report_flow.json | 10 +++--- .../bridge-gui/qml/SettingsView.qml | 1 + .../bridgepp/Test/TestBugReportFlow.cpp | 2 +- .../bridgepp/BugReportFlow/BugReportFlow.cpp | 5 +-- 8 files changed, 47 insertions(+), 15 deletions(-) diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/BugCategoryView.qml b/internal/frontend/bridge-gui/bridge-gui/qml/BugCategoryView.qml index 18865147..07372080 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/BugCategoryView.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/BugCategoryView.qml @@ -27,7 +27,7 @@ SettingsView { Label { Layout.fillWidth: true colorScheme: root.colorScheme - text: qsTr("What's the issue?") + text: qsTr("What do you want to report?") type: Label.Heading } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/BugQuestionView.qml b/internal/frontend/bridge-gui/bridge-gui/qml/BugQuestionView.qml index 6d50eedc..7c01914b 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/BugQuestionView.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/BugQuestionView.qml @@ -40,7 +40,7 @@ SettingsView { Label { Layout.fillWidth: true colorScheme: root.colorScheme - text: qsTr("Describe the issue") + text: qsTr("Provide more details") type: Label.Heading } @@ -58,6 +58,7 @@ SettingsView { font.letterSpacing: ProtonStyle.caption_letter_spacing font.pixelSize: ProtonStyle.caption_font_size font.weight: ProtonStyle.fontWeight_400 + textFormat: Text.MarkdownText readOnly: true selectByMouse: true selectedTextColor: root.colorScheme.text_invert @@ -87,8 +88,6 @@ SettingsView { QuestionItem { Layout.fillWidth: true - implicitWidth: parent.implicitWidth - colorScheme: root.colorScheme showSeparator: index < (root.questionSet.length - 1) diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/BugReportView.qml b/internal/frontend/bridge-gui/bridge-gui/qml/BugReportView.qml index a1594c0a..447ad61d 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/BugReportView.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/BugReportView.qml @@ -65,6 +65,7 @@ SettingsView { Layout.fillWidth: true Layout.minimumHeight: heightForLinesVisible(4) colorScheme: root.colorScheme + textFormat: Text.MarkdownText // set implicitHeight to explicit height because se don't // want TextArea implicitHeight (which is height of all text) diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/QuestionItem.qml b/internal/frontend/bridge-gui/bridge-gui/qml/QuestionItem.qml index 04ee559b..9889f11d 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/QuestionItem.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/QuestionItem.qml @@ -133,7 +133,7 @@ Item { property string text: { return checkedButton ? checkedButton.text : ""; } - property bool error: root.mandatory + property bool error: false function setDefaultValue(defaultValue) { const values = root.type === root._typeChoice ? defaultValue : []; @@ -176,7 +176,7 @@ Item { } return str.slice(0, -delimitor.length); } - property bool error: root.mandatory + property bool error: false function setDefaultValue(defaultValue) { const values = root.type === root._typeMutlichoice ? defaultValue.split(delimitor) : []; @@ -207,13 +207,43 @@ Item { visible: root.type === root._typeMutlichoice } } + + RowLayout { + id: footerLayout + Layout.fillWidth: true + spacing: 0 + + visible: { + if (root.type === root._typeOpen) + return false + return root.error + } + + ColorImage { + id: errorIcon + Layout.rightMargin: 4 + color: root.colorScheme.signal_danger + height: errorChoice.height + source: "/qml/icons/ic-exclamation-circle-filled.svg" + sourceSize.height: errorChoice.height + } + Label { + id: errorChoice + Layout.fillWidth: true + color: root.colorScheme.signal_danger + colorScheme: root.colorScheme + text: "Field is mandatory" + type: Label.LabelType.Caption_semibold + } + } } } + Rectangle { anchors.bottom: root.bottom anchors.left: root.left anchors.right: root.right - color: colorScheme.border_weak + color: root.colorScheme.border_weak height: root._lineHeight visible: root.showSeparator } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Resources/bug_report_flow.json b/internal/frontend/bridge-gui/bridge-gui/qml/Resources/bug_report_flow.json index 5e1d0175..d34f4497 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Resources/bug_report_flow.json +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Resources/bug_report_flow.json @@ -7,7 +7,7 @@ { "name": "I cannot find emails in my email client", "questions": [0,5,6,4], - "hint": "e.g., missing old emails or not receiving new emails" + "hint": "For example, missing old emails or not receiving new emails" }, { "name": "I am not able to send emails", @@ -17,12 +17,12 @@ { "name": "Bridge is not starting correctly", "questions": [0,2,3,4], - "hint": "e.g., Bridge does not autostart or shows an error at startup" + "hint": "For example, Bridge does not autostart or shows an error at startup" }, { "name": "Bridge is running slow", "questions": [0,2,7,4], - "hint": "e.g., delay in receiving email or high resource consumption" + "hint": "For example, delay in receiving email or high resource consumption" }, { "name": "Something else", @@ -33,7 +33,7 @@ "questions": [ { "id": 0, - "text": "What happened? Please also let us know if you received any error messages.", + "text": "Please describe what happened and include any error messages.", "tips": "Type your answer here", "type": "open", "mandatory": true, @@ -81,7 +81,7 @@ }, { "id": 7, - "text": "Which of these issues are you facing?", + "text": "Which of these issues are you experiencing?", "type": "multichoice", "answerList": ["Emails arrive with a delay", "Emails are sending slowly", "Bridge is slow to launch", "Bridge is slowing down my computer"] } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/SettingsView.qml b/internal/frontend/bridge-gui/bridge-gui/qml/SettingsView.qml index e4619052..edb5743a 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/SettingsView.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/SettingsView.qml @@ -37,6 +37,7 @@ Item { anchors.fill: parent clip: true + ScrollBar.vertical.policy: ScrollBar.vertical.size < 1.0 ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff; Component.onCompleted: contentItem.boundsBehavior = Flickable.StopAtBounds // Disable the springy effect when scroll reaches top/bottom. Item { diff --git a/internal/frontend/bridge-gui/bridgepp/Test/TestBugReportFlow.cpp b/internal/frontend/bridge-gui/bridgepp/Test/TestBugReportFlow.cpp index 2f12a363..466b271d 100644 --- a/internal/frontend/bridge-gui/bridgepp/Test/TestBugReportFlow.cpp +++ b/internal/frontend/bridge-gui/bridgepp/Test/TestBugReportFlow.cpp @@ -140,7 +140,7 @@ TEST_F(BugReportFlowFixture, validFile) { EXPECT_TRUE(flow_.setAnswer(0, "pwet")); EXPECT_FALSE(flow_.setAnswer(1, "pwet")); - EXPECT_EQ(flow_.collectAnswers(0), " > What happened?\n\rpwet\n\r"); + EXPECT_EQ(flow_.collectAnswers(0), "#### What happened?\n\r> pwet\n\r"); EXPECT_EQ(flow_.collectAnswers(1), ""); EXPECT_EQ(flow_.getAnswer(0), "pwet"); EXPECT_EQ(flow_.getAnswer(1), ""); diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/BugReportFlow/BugReportFlow.cpp b/internal/frontend/bridge-gui/bridgepp/bridgepp/BugReportFlow/BugReportFlow.cpp index d6824e76..d7205bfa 100644 --- a/internal/frontend/bridge-gui/bridgepp/bridgepp/BugReportFlow/BugReportFlow.cpp +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/BugReportFlow/BugReportFlow.cpp @@ -131,8 +131,9 @@ QString BugReportFlow::collectAnswers(quint8 categoryId) const { const QString& answer = getAnswer(var.toInt()); if (answer.isEmpty()) continue; - answers += " > " + questions_[var.toInt()].toMap()["text"].toString() + "\n\r"; - answers += answer + "\n\r"; + answers += "#### " + questions_[var.toInt()].toMap()["text"].toString() + "\n\r"; + for (const QString& line : answer.split("\n")) + answers += "> " + line + "\n\r"; } return answers; }