mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
feat(GODT-3121): forward user input to bridge.
This commit is contained in:
@ -30,13 +30,6 @@ namespace {
|
||||
namespace bridgepp {
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
BugReportFlow::BugReportFlow() {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] filepath The path of the file to parse.
|
||||
/// \return True iff the file can be properly parsed.
|
||||
@ -92,7 +85,7 @@ bool BugReportFlow::setAnswer(quint8 questionId, QString const &answer) {
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] questionId The id of the question.
|
||||
/// \param[in] categoryId The id of the question.
|
||||
/// \return answer the given question.
|
||||
//****************************************************************************************************************************************************
|
||||
QString BugReportFlow::getCategory(quint8 categoryId) const {
|
||||
@ -128,7 +121,7 @@ QString BugReportFlow::collectAnswers(quint8 categoryId) const {
|
||||
|
||||
QVariantList sets = this->questionSet(categoryId);
|
||||
for (QVariant const &var: sets) {
|
||||
const QString& answer = getAnswer(var.toInt());
|
||||
const QString answer = getAnswer(var.toInt());
|
||||
if (answer.isEmpty())
|
||||
continue;
|
||||
answers += "#### " + questions_[var.toInt()].toMap()["text"].toString() + "\n\r";
|
||||
@ -139,6 +132,24 @@ QString BugReportFlow::collectAnswers(quint8 categoryId) const {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] categoryId The id of the question set.
|
||||
//****************************************************************************************************************************************************
|
||||
QString BugReportFlow::collectUserInput(quint8 categoryId) const {
|
||||
if (categoryId > categories_.count() - 1)
|
||||
return {};
|
||||
|
||||
QString input = this->getCategory(categoryId);
|
||||
for (QVariant const &var: this->questionSet(categoryId)) {
|
||||
QString const answer = getAnswer(var.toInt());
|
||||
if (!answer.isEmpty())
|
||||
input += " " + answer;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
|
||||
@ -28,7 +28,7 @@ namespace bridgepp {
|
||||
class BugReportFlow {
|
||||
|
||||
public: // member functions.
|
||||
BugReportFlow(); ///< Default constructor.
|
||||
BugReportFlow() = default; ///< Default constructor.
|
||||
BugReportFlow(BugReportFlow const &) = delete; ///< Disabled copy-constructor.
|
||||
BugReportFlow(BugReportFlow &&) = delete; ///< Disabled assignment copy-constructor.
|
||||
~BugReportFlow() = default; ///< Destructor.
|
||||
@ -42,6 +42,7 @@ public: // member functions.
|
||||
[[nodiscard]] QString getCategory(quint8 categoryId) const; ///< Get category name.
|
||||
[[nodiscard]] QString getAnswer(quint8 questionId) const; ///< Get answer for a given question.
|
||||
[[nodiscard]] QString collectAnswers(quint8 categoryId) const; ///< Collect answer for a given set of questions.
|
||||
[[nodiscard]] QString collectUserInput(quint8 categoryId) const; ///< Collect the user input (user answers without quesitons) for a given set of questions.
|
||||
void clearAnswers(); ///< Clear all collected answers.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user