GUI: exit confirmation dialog (closes #1645)
This commit is contained in:
		
							parent
							
								
									a6e296054f
								
							
						
					
					
						commit
						a5e37fe74f
					
				| 
						 | 
					@ -451,6 +451,30 @@ void MainWindow::setupLanguagesMenu()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::closeEvent(QCloseEvent* event)
 | 
					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;
 | 
					    duint noClose = 0;
 | 
				
			||||||
    if(bCanClose)
 | 
					    if(bCanClose)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -220,6 +220,7 @@ void SettingsDialog::LoadSettings()
 | 
				
			||||||
    GetSettingBool("Gui", "NoForegroundWindow", &settings.guiNoForegroundWindow);
 | 
					    GetSettingBool("Gui", "NoForegroundWindow", &settings.guiNoForegroundWindow);
 | 
				
			||||||
    GetSettingBool("Gui", "LoadSaveTabOrder", &settings.guiLoadSaveTabOrder);
 | 
					    GetSettingBool("Gui", "LoadSaveTabOrder", &settings.guiLoadSaveTabOrder);
 | 
				
			||||||
    GetSettingBool("Gui", "ShowGraphRva", &settings.guiShowGraphRva);
 | 
					    GetSettingBool("Gui", "ShowGraphRva", &settings.guiShowGraphRva);
 | 
				
			||||||
 | 
					    GetSettingBool("Gui", "ShowExitConfirmation", &settings.guiShowExitConfirmation);
 | 
				
			||||||
    ui->chkFpuRegistersLittleEndian->setChecked(settings.guiFpuRegistersLittleEndian);
 | 
					    ui->chkFpuRegistersLittleEndian->setChecked(settings.guiFpuRegistersLittleEndian);
 | 
				
			||||||
    ui->chkSaveColumnOrder->setChecked(settings.guiSaveColumnOrder);
 | 
					    ui->chkSaveColumnOrder->setChecked(settings.guiSaveColumnOrder);
 | 
				
			||||||
    ui->chkNoCloseDialog->setChecked(settings.guiNoCloseDialog);
 | 
					    ui->chkNoCloseDialog->setChecked(settings.guiNoCloseDialog);
 | 
				
			||||||
| 
						 | 
					@ -228,6 +229,7 @@ void SettingsDialog::LoadSettings()
 | 
				
			||||||
    ui->chkNoForegroundWindow->setChecked(settings.guiNoForegroundWindow);
 | 
					    ui->chkNoForegroundWindow->setChecked(settings.guiNoForegroundWindow);
 | 
				
			||||||
    ui->chkSaveLoadTabOrder->setChecked(settings.guiLoadSaveTabOrder);
 | 
					    ui->chkSaveLoadTabOrder->setChecked(settings.guiLoadSaveTabOrder);
 | 
				
			||||||
    ui->chkShowGraphRva->setChecked(settings.guiShowGraphRva);
 | 
					    ui->chkShowGraphRva->setChecked(settings.guiShowGraphRva);
 | 
				
			||||||
 | 
					    ui->chkShowExitConfirmation->setChecked(settings.guiShowExitConfirmation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //Misc tab
 | 
					    //Misc tab
 | 
				
			||||||
    if(DbgFunctions()->GetJit)
 | 
					    if(DbgFunctions()->GetJit)
 | 
				
			||||||
| 
						 | 
					@ -356,6 +358,7 @@ void SettingsDialog::SaveSettings()
 | 
				
			||||||
    BridgeSettingSetUint("Gui", "NoForegroundWindow", settings.guiNoForegroundWindow);
 | 
					    BridgeSettingSetUint("Gui", "NoForegroundWindow", settings.guiNoForegroundWindow);
 | 
				
			||||||
    BridgeSettingSetUint("Gui", "LoadSaveTabOrder", settings.guiLoadSaveTabOrder);
 | 
					    BridgeSettingSetUint("Gui", "LoadSaveTabOrder", settings.guiLoadSaveTabOrder);
 | 
				
			||||||
    BridgeSettingSetUint("Gui", "ShowGraphRva", settings.guiShowGraphRva);
 | 
					    BridgeSettingSetUint("Gui", "ShowGraphRva", settings.guiShowGraphRva);
 | 
				
			||||||
 | 
					    BridgeSettingSetUint("Gui", "ShowExitConfirmation", settings.guiShowExitConfirmation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //Misc tab
 | 
					    //Misc tab
 | 
				
			||||||
    if(DbgFunctions()->GetJit)
 | 
					    if(DbgFunctions()->GetJit)
 | 
				
			||||||
| 
						 | 
					@ -803,3 +806,8 @@ void SettingsDialog::on_chkShowGraphRva_toggled(bool checked)
 | 
				
			||||||
    bTokenizerConfigUpdated = true;
 | 
					    bTokenizerConfigUpdated = true;
 | 
				
			||||||
    settings.guiShowGraphRva = checked;
 | 
					    settings.guiShowGraphRva = checked;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SettingsDialog::on_chkShowExitConfirmation_toggled(bool checked)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    settings.guiShowExitConfirmation = checked;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,6 +80,7 @@ private slots:
 | 
				
			||||||
    void on_chkPidInHex_clicked(bool checked);
 | 
					    void on_chkPidInHex_clicked(bool checked);
 | 
				
			||||||
    void on_chkSidebarWatchLabels_stateChanged(int arg1);
 | 
					    void on_chkSidebarWatchLabels_stateChanged(int arg1);
 | 
				
			||||||
    void on_chkNoForegroundWindow_toggled(bool checked);
 | 
					    void on_chkNoForegroundWindow_toggled(bool checked);
 | 
				
			||||||
 | 
					    void on_chkShowExitConfirmation_toggled(bool checked);
 | 
				
			||||||
    //Misc tab
 | 
					    //Misc tab
 | 
				
			||||||
    void on_chkSetJIT_stateChanged(int arg1);
 | 
					    void on_chkSetJIT_stateChanged(int arg1);
 | 
				
			||||||
    void on_chkConfirmBeforeAtt_stateChanged(int arg1);
 | 
					    void on_chkConfirmBeforeAtt_stateChanged(int arg1);
 | 
				
			||||||
| 
						 | 
					@ -170,6 +171,7 @@ private:
 | 
				
			||||||
        bool guiNoForegroundWindow;
 | 
					        bool guiNoForegroundWindow;
 | 
				
			||||||
        bool guiLoadSaveTabOrder;
 | 
					        bool guiLoadSaveTabOrder;
 | 
				
			||||||
        bool guiShowGraphRva;
 | 
					        bool guiShowGraphRva;
 | 
				
			||||||
 | 
					        bool guiShowExitConfirmation;
 | 
				
			||||||
        //Misc Tab
 | 
					        //Misc Tab
 | 
				
			||||||
        bool miscSetJIT;
 | 
					        bool miscSetJIT;
 | 
				
			||||||
        bool miscSetJITAuto;
 | 
					        bool miscSetJITAuto;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -627,6 +627,13 @@
 | 
				
			||||||
         </property>
 | 
					         </property>
 | 
				
			||||||
        </widget>
 | 
					        </widget>
 | 
				
			||||||
       </item>
 | 
					       </item>
 | 
				
			||||||
 | 
					       <item>
 | 
				
			||||||
 | 
					        <widget class="QCheckBox" name="chkShowExitConfirmation">
 | 
				
			||||||
 | 
					         <property name="text">
 | 
				
			||||||
 | 
					          <string>Show exit confirmation dialog</string>
 | 
				
			||||||
 | 
					         </property>
 | 
				
			||||||
 | 
					        </widget>
 | 
				
			||||||
 | 
					       </item>
 | 
				
			||||||
       <item>
 | 
					       <item>
 | 
				
			||||||
        <spacer name="verticalSpacer_7">
 | 
					        <spacer name="verticalSpacer_7">
 | 
				
			||||||
         <property name="orientation">
 | 
					         <property name="orientation">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -263,6 +263,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
 | 
				
			||||||
    guiBool.insert("SidebarWatchLabels", true);
 | 
					    guiBool.insert("SidebarWatchLabels", true);
 | 
				
			||||||
    guiBool.insert("LoadSaveTabOrder", false);
 | 
					    guiBool.insert("LoadSaveTabOrder", false);
 | 
				
			||||||
    guiBool.insert("ShowGraphRva", false);
 | 
					    guiBool.insert("ShowGraphRva", false);
 | 
				
			||||||
 | 
					    guiBool.insert("ShowExitConfirmation", true);
 | 
				
			||||||
    //Named menu settings
 | 
					    //Named menu settings
 | 
				
			||||||
    insertMenuBuilderBools(&guiBool, "CPUDisassembly", 50); //CPUDisassembly
 | 
					    insertMenuBuilderBools(&guiBool, "CPUDisassembly", 50); //CPUDisassembly
 | 
				
			||||||
    insertMenuBuilderBools(&guiBool, "CPUDump", 50); //CPUDump
 | 
					    insertMenuBuilderBools(&guiBool, "CPUDump", 50); //CPUDump
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue