1
0
Fork 0

GUI: exit confirmation dialog (closes #1645)

This commit is contained in:
mrexodia 2017-07-23 23:11:47 +02:00
parent a6e296054f
commit a5e37fe74f
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
5 changed files with 42 additions and 0 deletions

View File

@ -451,6 +451,30 @@ void MainWindow::setupLanguagesMenu()
void MainWindow::closeEvent(QCloseEvent* event)
{
if(DbgIsDebugging() && ConfigBool("Gui", "ShowExitConfirmation"))
{
auto cb = new QCheckBox(tr("Don't ask this question again"));
QMessageBox msgbox(this);
msgbox.setText(tr("The debuggee is still running and will be terminated if you exit. Do you really want to exit?"));
msgbox.setWindowTitle(tr("Debuggee is still running"));
msgbox.setWindowIcon(DIcon("bug.png"));
msgbox.addButton(QMessageBox::Yes);
msgbox.addButton(QMessageBox::No);
msgbox.setDefaultButton(QMessageBox::No);
msgbox.setCheckBox(cb);
QObject::connect(cb, &QCheckBox::toggled, [](bool checked)
{
Config()->setBool("Gui", "ShowExitConfirmation", !checked);
});
if(msgbox.exec() != QMessageBox::Yes)
{
event->ignore();
return;
}
}
duint noClose = 0;
if(bCanClose)
{

View File

@ -220,6 +220,7 @@ void SettingsDialog::LoadSettings()
GetSettingBool("Gui", "NoForegroundWindow", &settings.guiNoForegroundWindow);
GetSettingBool("Gui", "LoadSaveTabOrder", &settings.guiLoadSaveTabOrder);
GetSettingBool("Gui", "ShowGraphRva", &settings.guiShowGraphRva);
GetSettingBool("Gui", "ShowExitConfirmation", &settings.guiShowExitConfirmation);
ui->chkFpuRegistersLittleEndian->setChecked(settings.guiFpuRegistersLittleEndian);
ui->chkSaveColumnOrder->setChecked(settings.guiSaveColumnOrder);
ui->chkNoCloseDialog->setChecked(settings.guiNoCloseDialog);
@ -228,6 +229,7 @@ void SettingsDialog::LoadSettings()
ui->chkNoForegroundWindow->setChecked(settings.guiNoForegroundWindow);
ui->chkSaveLoadTabOrder->setChecked(settings.guiLoadSaveTabOrder);
ui->chkShowGraphRva->setChecked(settings.guiShowGraphRva);
ui->chkShowExitConfirmation->setChecked(settings.guiShowExitConfirmation);
//Misc tab
if(DbgFunctions()->GetJit)
@ -356,6 +358,7 @@ void SettingsDialog::SaveSettings()
BridgeSettingSetUint("Gui", "NoForegroundWindow", settings.guiNoForegroundWindow);
BridgeSettingSetUint("Gui", "LoadSaveTabOrder", settings.guiLoadSaveTabOrder);
BridgeSettingSetUint("Gui", "ShowGraphRva", settings.guiShowGraphRva);
BridgeSettingSetUint("Gui", "ShowExitConfirmation", settings.guiShowExitConfirmation);
//Misc tab
if(DbgFunctions()->GetJit)
@ -803,3 +806,8 @@ void SettingsDialog::on_chkShowGraphRva_toggled(bool checked)
bTokenizerConfigUpdated = true;
settings.guiShowGraphRva = checked;
}
void SettingsDialog::on_chkShowExitConfirmation_toggled(bool checked)
{
settings.guiShowExitConfirmation = checked;
}

View File

@ -80,6 +80,7 @@ private slots:
void on_chkPidInHex_clicked(bool checked);
void on_chkSidebarWatchLabels_stateChanged(int arg1);
void on_chkNoForegroundWindow_toggled(bool checked);
void on_chkShowExitConfirmation_toggled(bool checked);
//Misc tab
void on_chkSetJIT_stateChanged(int arg1);
void on_chkConfirmBeforeAtt_stateChanged(int arg1);
@ -170,6 +171,7 @@ private:
bool guiNoForegroundWindow;
bool guiLoadSaveTabOrder;
bool guiShowGraphRva;
bool guiShowExitConfirmation;
//Misc Tab
bool miscSetJIT;
bool miscSetJITAuto;

View File

@ -627,6 +627,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkShowExitConfirmation">
<property name="text">
<string>Show exit confirmation dialog</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">

View File

@ -263,6 +263,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
guiBool.insert("SidebarWatchLabels", true);
guiBool.insert("LoadSaveTabOrder", false);
guiBool.insert("ShowGraphRva", false);
guiBool.insert("ShowExitConfirmation", true);
//Named menu settings
insertMenuBuilderBools(&guiBool, "CPUDisassembly", 50); //CPUDisassembly
insertMenuBuilderBools(&guiBool, "CPUDump", 50); //CPUDump