diff --git a/src/blackgui/components/internalscomponent.cpp b/src/blackgui/components/internalscomponent.cpp index 423704abc..717a80a37 100644 --- a/src/blackgui/components/internalscomponent.cpp +++ b/src/blackgui/components/internalscomponent.cpp @@ -26,6 +26,7 @@ #include "blackmisc/math/mathutils.h" #include "blackmisc/logmessage.h" #include "blackmisc/statusmessage.h" + #include "ui_internalscomponent.h" #include @@ -85,10 +86,22 @@ namespace BlackGui connect(ui->pb_LatestPartsLog, &QPushButton::released, this, &CInternalsComponent::showLogFiles); connect(ui->pb_RequestFromNetwork, &QPushButton::released, this, &CInternalsComponent::requestPartsFromNetwork); connect(ui->pb_DisplayLog, &QPushButton::released, this, &CInternalsComponent::displayLogInSimulator); - connect(ui->pb_SendAtis, &QPushButton::released, this, &CInternalsComponent::sendAtis); connect(ui->comp_RemoteAircraftSelector, &CRemoteAircraftSelector::changedCallsign, this, &CInternalsComponent::selectorChanged); + + if (sGui && sGui->isSupportingCrashpad()) + { + ui->cb_CrashDumpUpload->setChecked(sGui->isCrashDumpUploadEnabled()); + connect(ui->pb_SimulateCrash, &QPushButton::released, this, &CInternalsComponent::simulateCrash); + connect(ui->cb_CrashDumpUpload, &QCheckBox::toggled, this, &CInternalsComponent::onCrashDumpUploadToggled); + } + else + { + ui->pb_SimulateCrash->setEnabled(false); + ui->cb_CrashDumpUpload->setEnabled(false); + } + this->contextFlagsToGui(); } @@ -316,5 +329,22 @@ namespace BlackGui ui->cb_DebugContextOwnAircraft->setChecked(sGui->getIContextOwnAircraft()->isDebugEnabled()); ui->cb_DebugContextSimulator->setChecked(sGui->getIContextSimulator()->isDebugEnabled()); } + + void CInternalsComponent::simulateCrash() + { + const QMessageBox::StandardButton reply = QMessageBox::question(this, "crash", "Really simulate crash?", QMessageBox::Yes | QMessageBox::No); + if (reply != QMessageBox::Yes) { return; } + sGui->simulateCrash(); + } + + void CInternalsComponent::onCrashDumpUploadToggled(bool checked) + { + if (sGui && sGui->isSupportingCrashpad()) + { + const bool current = sGui->isCrashDumpUploadEnabled(); + if (current == checked) { return; } + sGui->enableCrashDumpUpload(checked); + } + } } // namespace } // namespace diff --git a/src/blackgui/components/internalscomponent.h b/src/blackgui/components/internalscomponent.h index 03900bee0..29e0d6cc8 100644 --- a/src/blackgui/components/internalscomponent.h +++ b/src/blackgui/components/internalscomponent.h @@ -27,8 +27,7 @@ namespace BlackGui namespace Components { //! Internals for debugging, statistics - class BLACKGUI_EXPORT CInternalsComponent : - public QWidget + class BLACKGUI_EXPORT CInternalsComponent : public QWidget { Q_OBJECT @@ -77,6 +76,12 @@ namespace BlackGui //! Set the context flags void contextFlagsToGui(); + //! Simulate a crash + void simulateCrash(); + + //! Checkbox toggled + void onCrashDumpUploadToggled(bool checked); + QScopedPointer ui; }; } // namespace diff --git a/src/blackgui/components/internalscomponent.ui b/src/blackgui/components/internalscomponent.ui index c9b1e6b90..b47fe346f 100644 --- a/src/blackgui/components/internalscomponent.ui +++ b/src/blackgui/components/internalscomponent.ui @@ -13,7 +13,7 @@ Form - + 2 @@ -31,11 +31,11 @@ 0 - + - Debug + Messages - + 0 @@ -48,62 +48,6 @@ 0 - - - - Contexts - - - - 4 - - - 4 - - - 4 - - - 4 - - - - - Audio - - - - - - - Network - - - - - - - Own aircraft - - - - - - - Simulator - - - - - - - Application - - - - - - @@ -295,6 +239,105 @@ + + + Debug + + + + + + Contexts + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + Audio + + + + + + + Network + + + + + + + Own aircraft + + + + + + + Simulator + + + + + + + Application + + + + + + + + + + Crash dumps + + + + + + uploads enabled + + + + + + + crash! + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + Statistics / Logs @@ -662,12 +705,6 @@ - tw_Internals - cb_DebugContextAudio - cb_DebugContextNetwork - cb_DebugContextOwnAircraft - cb_DebugContextSimulator - cb_DebugContextApplication le_StatusMessage tb_LogStatusMessage rb_StatusMessageInfo @@ -682,15 +719,23 @@ le_AtisCallsign pb_SendAtis pte_Atis + cb_DebugContextAudio + cb_DebugContextNetwork + cb_DebugContextOwnAircraft + cb_DebugContextSimulator + cb_DebugContextApplication + cb_CrashDumpUpload + pb_SimulateCrash pb_LatestInterpolationLog pb_LatestPartsLog pb_DisplayLog pb_RequestFromNetwork tb_History + cb_AircraftPartsIncremental pb_CurrentParts pb_SendAircraftPartsJson pb_SendAircraftPartsGui - cb_AircraftPartsIncremental + tw_Internals