feat(GODT-3046): added ReportBugFallback event support in bridge-gui.

This commit is contained in:
Xavier Michelon
2023-11-07 11:34:55 +01:00
parent 26897f06c4
commit e51c81fc03
6 changed files with 77 additions and 11 deletions

View File

@ -364,7 +364,19 @@ Status GRPCService::ReportBug(ServerContext *, ReportBugRequest const *request,
qtProxy_.reportBug(QString::fromStdString(request->ostype()), QString::fromStdString(request->osversion()),
QString::fromStdString(request->emailclient()), QString::fromStdString(request->address()), QString::fromStdString(request->description()),
request->includelogs());
qtProxy_.sendDelayedEvent(tab.nextBugReportWillSucceed() ? newReportBugSuccessEvent() : newReportBugErrorEvent());
SPStreamEvent event;
switch (tab.nextBugReportResult()) {
case SettingsTab::BugReportResult::Success:
event = newReportBugSuccessEvent();
break;
case SettingsTab::BugReportResult::Error:
event = newReportBugErrorEvent();
break;
case SettingsTab::BugReportResult::DataSharingError:
event = newReportBugFallbackEvent();
break;
}
qtProxy_.sendDelayedEvent(event);
qtProxy_.sendDelayedEvent(newReportBugFinishedEvent());
return Status::OK;

View File

@ -323,8 +323,8 @@ void SettingsTab::exportTLSCertificates(QString const &folderPath) {
//****************************************************************************************************************************************************
/// \return The state of the check box.
//****************************************************************************************************************************************************
bool SettingsTab::nextBugReportWillSucceed() const {
return ui_.checkNextBugReportWillSucceed->isChecked();
SettingsTab::BugReportResult SettingsTab::nextBugReportResult() const {
return BugReportResult(ui_.comboBugReportResult->currentIndex());
}
@ -522,7 +522,7 @@ void SettingsTab::resetUI() {
ui_.editAddress->setText(QString());
ui_.editDescription->setPlainText(QString());
ui_.labelIncludeLogsValue->setText(QString());
ui_.checkNextBugReportWillSucceed->setChecked(true);
ui_.comboBugReportResult->setCurrentIndex(0);
ui_.editHostname->setText("localhost");
ui_.spinPortIMAP->setValue(1143);

View File

@ -35,6 +35,12 @@ public: // data types.
Failure = 2
}; ///< Enumeration for the result of a TLS certificate installation.
enum class BugReportResult {
Success = 0,
Error = 1,
DataSharingError = 2,
}; ///< Enumeration for the result of bug report sending
public: // member functions.
explicit SettingsTab(QWidget *parent = nullptr); ///< Default constructor.
SettingsTab(SettingsTab const &) = delete; ///< Disabled copy-constructor.
@ -60,7 +66,7 @@ public: // member functions.
QString releaseNotesPageLink() const; ///< Get the content of the 'Release Notes Page Link' edit.
QString dependencyLicenseLink() const; ///< Get the content of the 'Dependency License Link' edit.
QString landingPageLink() const; ///< Get the content of the 'Landing Page Link' edit.
bool nextBugReportWillSucceed() const; ///< Get the status of the 'Next Bug Report Will Fail' check box.
BugReportResult nextBugReportResult() const; ///< Get the value of the 'Next bug report result' combo box.
bool isTLSCertificateInstalled() const; ///< Get the status of the 'TLS Certificate is installed' check box.
TLSCertInstallResult nextTLSCertInstallResult() const; ///< Get the value of the 'Next TLS Certificate install result' combo box.
bool nextTLSCertExportWillSucceed() const; ///< Get the status of the 'Next TLS Cert export will succeed' check box.

View File

@ -925,11 +925,47 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkNextBugReportWillSucceed">
<property name="text">
<string>Next Bug Report Will Succeed</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QLabel" name="labelNextBugReportResult">
<property name="text">
<string>Next bug report result</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBugReportResult">
<item>
<property name="text">
<string>Success</string>
</property>
</item>
<item>
<property name="text">
<string>Error</string>
</property>
</item>
<item>
<property name="text">
<string>Data sharing error</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
@ -1088,7 +1124,6 @@
<tabstop>editEmailClient</tabstop>
<tabstop>spinEventDelay</tabstop>
<tabstop>checkIsPortFree</tabstop>
<tabstop>checkNextBugReportWillSucceed</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@ -202,6 +202,18 @@ SPStreamEvent newReportBugErrorEvent() {
}
//****************************************************************************************************************************************************
/// \return The event.
//****************************************************************************************************************************************************
SPStreamEvent newReportBugFallbackEvent() {
auto event = new grpc::ReportBugFallbackEvent;
auto appEvent = new grpc::AppEvent;
appEvent->set_allocated_reportbugfallback(event);
return wrapAppEvent(appEvent);
}
//****************************************************************************************************************************************************
/// \return The event.
//****************************************************************************************************************************************************

View File

@ -34,6 +34,7 @@ SPStreamEvent newResetFinishedEvent(); ///< Create a new ResetFinishedEvent even
SPStreamEvent newReportBugFinishedEvent(); ///< Create a new ReportBugFinishedEvent event.
SPStreamEvent newReportBugSuccessEvent(); ///< Create a new ReportBugSuccessEvent event.
SPStreamEvent newReportBugErrorEvent(); ///< Create a new ReportBugErrorEvent event.
SPStreamEvent newReportBugFallbackEvent(); ///< Create a new ReportBugFallbackEvent event.
SPStreamEvent newCertificateInstallSuccessEvent(); ///< Create a new CertificateInstallSuccessEvent event.
SPStreamEvent newCertificateInstallCanceledEvent(); ///< Create a new CertificateInstallCanceledEvent event.
SPStreamEvent newCertificateInstallFailedEvent(); ///< Create anew CertificateInstallFailedEvent event.