feat(GODT-2816): Wait until mandatory fields are filled then fill body and title.

This commit is contained in:
Romain LE JEUNE
2023-07-28 16:35:52 +02:00
committed by Romain Le Jeune
parent 3d64c5f894
commit 80d729e3e5
15 changed files with 885 additions and 766 deletions

View File

@ -53,17 +53,17 @@ bool BugReportFlow::parse(const QString& filepath) {
//****************************************************************************************************************************************************
/// \return The value for the 'bugCategories' property.
//****************************************************************************************************************************************************
QStringList BugReportFlow::categories() const {
return categories_;
}
QStringList BugReportFlow::categories() const {
return categories_;
}
//****************************************************************************************************************************************************
/// \return The value for the 'bugQuestions' property.
//****************************************************************************************************************************************************
QVariantList BugReportFlow::questions() const {
return questions_;
}
QVariantList BugReportFlow::questions() const {
return questions_;
}
//****************************************************************************************************************************************************
@ -91,6 +91,19 @@ bool BugReportFlow::setAnswer(quint8 questionId, QString const &answer) {
}
//****************************************************************************************************************************************************
/// \param[in] questionId The id of the question.
/// \return answer the given question.
//****************************************************************************************************************************************************
QString BugReportFlow::getCategory(quint8 categoryId) const {
QString category;
if (categoryId <= categories_.count() - 1) {
category = categories_[categoryId];
}
return category;
}
//****************************************************************************************************************************************************
/// \param[in] questionId The id of the question.
/// \return answer the given question.
@ -113,7 +126,6 @@ QString BugReportFlow::collectAnswers(quint8 categoryId) const {
if (categoryId > categories_.count() - 1)
return answers;
answers += "Category: " + categories_[categoryId] + "\n\r";
QVariantList sets = this->questionSet(categoryId);
for (QVariant const &var: sets) {
const QString& answer = getAnswer(var.toInt());

View File

@ -38,9 +38,9 @@ public: // member functions.
[[nodiscard]] QStringList categories() const; ///< Getter for the 'bugCategories' property.
[[nodiscard]] QVariantList questions() const; ///< Getter for the 'bugQuestions' property.
[[nodiscard]] QVariantList questionSet(quint8 categoryId) const; ///< Retrieve the set of question for a given bug category.
[[nodiscard]] bool setAnswer(quint8 questionId, QString const &answer); ///< Feed an answer for a given question.
[[nodiscard]] QString getAnswer(quint8 questionId) const; ///< Collect answer for a given questions.
[[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.
void clearAnswers(); ///< Clear all collected answers.