Ref T401, allow to trigger crash from internals page

This commit is contained in:
Klaus Basan
2019-02-21 00:27:30 +01:00
committed by Mat Sutcliffe
parent 5fe4c95f4b
commit da52e25f78
3 changed files with 150 additions and 70 deletions

View File

@@ -26,6 +26,7 @@
#include "blackmisc/math/mathutils.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/statusmessage.h"
#include "ui_internalscomponent.h"
#include <QCheckBox>
@@ -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

View File

@@ -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::CInternalsComponent> ui;
};
} // namespace

View File

@@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gl_Messages">
<property name="leftMargin">
<number>2</number>
</property>
@@ -31,11 +31,11 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tb_Debug">
<widget class="QWidget" name="tb_Messages">
<attribute name="title">
<string>Debug</string>
<string>Messages</string>
</attribute>
<layout class="QVBoxLayout" name="vl_Debug">
<layout class="QVBoxLayout" name="vl_Messages">
<property name="leftMargin">
<number>0</number>
</property>
@@ -48,62 +48,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="gb_DebugContext">
<property name="title">
<string>Contexts</string>
</property>
<layout class="QGridLayout" name="gl_Contexts">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="cb_DebugContextAudio">
<property name="text">
<string>Audio</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="cb_DebugContextNetwork">
<property name="text">
<string>Network</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="cb_DebugContextOwnAircraft">
<property name="text">
<string>Own aircraft</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="cb_DebugContextSimulator">
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="cb_DebugContextApplication">
<property name="text">
<string>Application</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_StatusMessage">
<property name="title">
@@ -295,6 +239,105 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_Debug">
<attribute name="title">
<string>Debug</string>
</attribute>
<layout class="QVBoxLayout" name="vl_Debug">
<item>
<widget class="QGroupBox" name="gb_DebugContext">
<property name="title">
<string>Contexts</string>
</property>
<layout class="QGridLayout" name="gl_Contexts">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="cb_DebugContextAudio">
<property name="text">
<string>Audio</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="cb_DebugContextNetwork">
<property name="text">
<string>Network</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="cb_DebugContextOwnAircraft">
<property name="text">
<string>Own aircraft</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="cb_DebugContextSimulator">
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="cb_DebugContextApplication">
<property name="text">
<string>Application</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_CrashDumps">
<property name="title">
<string>Crash dumps</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="cb_CrashDumpUpload">
<property name="text">
<string>uploads enabled</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_SimulateCrash">
<property name="text">
<string>crash!</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_Statistics">
<attribute name="title">
<string>Statistics / Logs</string>
@@ -662,12 +705,6 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tw_Internals</tabstop>
<tabstop>cb_DebugContextAudio</tabstop>
<tabstop>cb_DebugContextNetwork</tabstop>
<tabstop>cb_DebugContextOwnAircraft</tabstop>
<tabstop>cb_DebugContextSimulator</tabstop>
<tabstop>cb_DebugContextApplication</tabstop>
<tabstop>le_StatusMessage</tabstop>
<tabstop>tb_LogStatusMessage</tabstop>
<tabstop>rb_StatusMessageInfo</tabstop>
@@ -682,15 +719,23 @@
<tabstop>le_AtisCallsign</tabstop>
<tabstop>pb_SendAtis</tabstop>
<tabstop>pte_Atis</tabstop>
<tabstop>cb_DebugContextAudio</tabstop>
<tabstop>cb_DebugContextNetwork</tabstop>
<tabstop>cb_DebugContextOwnAircraft</tabstop>
<tabstop>cb_DebugContextSimulator</tabstop>
<tabstop>cb_DebugContextApplication</tabstop>
<tabstop>cb_CrashDumpUpload</tabstop>
<tabstop>pb_SimulateCrash</tabstop>
<tabstop>pb_LatestInterpolationLog</tabstop>
<tabstop>pb_LatestPartsLog</tabstop>
<tabstop>pb_DisplayLog</tabstop>
<tabstop>pb_RequestFromNetwork</tabstop>
<tabstop>tb_History</tabstop>
<tabstop>cb_AircraftPartsIncremental</tabstop>
<tabstop>pb_CurrentParts</tabstop>
<tabstop>pb_SendAircraftPartsJson</tabstop>
<tabstop>pb_SendAircraftPartsGui</tabstop>
<tabstop>cb_AircraftPartsIncremental</tabstop>
<tabstop>tw_Internals</tabstop>
</tabstops>
<resources>
<include location="../../blackmisc/blackmisc.qrc"/>