forked from qt-creator/qt-creator
Crashpad: Make the test crashbutton more accessible
Add the button to the settings layout and show it depending on the environment variable `QTC_SHOW_CRASHBUTTON` instead of a setting that needs to be manually added to the settings file. Change-Id: I130b1c061a8d1448d7238f1e3c0714116195c1c1 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -145,7 +145,6 @@ SystemSettings::SystemSettings()
|
|||||||
Tr::tr("Allow crashes to be automatically reported. Collected reports are "
|
Tr::tr("Allow crashes to be automatically reported. Collected reports are "
|
||||||
"used for the sole purpose of fixing bugs."));
|
"used for the sole purpose of fixing bugs."));
|
||||||
|
|
||||||
showCrashButton.setSettingsKey("ShowCrashButton");
|
|
||||||
#endif
|
#endif
|
||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
@@ -239,9 +238,19 @@ public:
|
|||||||
.arg(appInfo().crashReports.toUserOutput());
|
.arg(appInfo().crashReports.toUserOutput());
|
||||||
m_clearCrashReportsButton->setToolTip(toolTip);
|
m_clearCrashReportsButton->setToolTip(toolTip);
|
||||||
m_crashReportsSizeText->setToolTip(toolTip);
|
m_crashReportsSizeText->setToolTip(toolTip);
|
||||||
grid.addRow(
|
Row crashDetails
|
||||||
{s.enableCrashReporting,
|
= Row{m_clearCrashReportsButton, m_crashReportsSizeText, helpCrashReportingButton, st};
|
||||||
Row{m_clearCrashReportsButton, m_crashReportsSizeText, helpCrashReportingButton, st}});
|
if (qtcEnvironmentVariableIsSet("QTC_SHOW_CRASHBUTTON")) {
|
||||||
|
auto crashButton = new QPushButton("CRASH!!!");
|
||||||
|
connect(crashButton, &QPushButton::clicked, [] {
|
||||||
|
// do a real crash
|
||||||
|
volatile int *a = reinterpret_cast<volatile int *>(NULL);
|
||||||
|
*a = 1;
|
||||||
|
});
|
||||||
|
crashDetails.addItem(crashButton);
|
||||||
|
}
|
||||||
|
grid.addRow({s.enableCrashReporting, crashDetails});
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -267,15 +276,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_CRASHPAD
|
#ifdef ENABLE_CRASHPAD
|
||||||
if (s.showCrashButton()) {
|
|
||||||
auto crashButton = new QPushButton("CRASH!!!");
|
|
||||||
crashButton->show();
|
|
||||||
connect(crashButton, &QPushButton::clicked, [] {
|
|
||||||
// do a real crash
|
|
||||||
volatile int* a = reinterpret_cast<volatile int *>(NULL); *a = 1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(helpCrashReportingButton, &QAbstractButton::clicked, this, [this] {
|
connect(helpCrashReportingButton, &QAbstractButton::clicked, this, [this] {
|
||||||
showHelpDialog(Tr::tr("Crash Reporting"), CorePlugin::msgCrashpadInformation());
|
showHelpDialog(Tr::tr("Crash Reporting"), CorePlugin::msgCrashpadInformation());
|
||||||
});
|
});
|
||||||
|
@@ -33,7 +33,6 @@ public:
|
|||||||
|
|
||||||
#ifdef ENABLE_CRASHPAD
|
#ifdef ENABLE_CRASHPAD
|
||||||
Utils::BoolAspect enableCrashReporting{this};
|
Utils::BoolAspect enableCrashReporting{this};
|
||||||
Utils::BoolAspect showCrashButton{this};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Utils::BoolAspect askBeforeExit{this};
|
Utils::BoolAspect askBeforeExit{this};
|
||||||
|
Reference in New Issue
Block a user