1
0
Fork 0

Add detach and exit to exit dialog

This commit is contained in:
torusrxxx 2022-03-26 19:48:17 +08:00
parent 78b77fa333
commit 01dba2c707
No known key found for this signature in database
GPG Key ID: A795C73A0F1CFADD
2 changed files with 10 additions and 3 deletions

View File

@ -390,6 +390,7 @@ MainWindow::MainWindow(QWidget* parent)
// Setup close thread and dialog
bCanClose = false;
bExitWhenDetached = false;
mCloseThread = new MainWindowCloseThread(this);
connect(mCloseThread, SIGNAL(canClose()), this, SLOT(canClose()));
mCloseDialog = new CloseDialog(this);
@ -595,7 +596,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
msgbox.setWindowIcon(DIcon("bug.png"));
msgbox.addButton(QMessageBox::Yes)->setText(tr("&Exit"));
msgbox.addButton(QMessageBox::Cancel)->setText(tr("&Cancel"));
msgbox.addButton(QMessageBox::Abort)->setText(tr("&Stop debugging"));
msgbox.addButton(QMessageBox::Abort)->setText(tr("&Detach and exit"));
msgbox.addButton(QMessageBox::Retry)->setText(tr("&Restart debugging"));
msgbox.setDefaultButton(QMessageBox::Cancel);
msgbox.setEscapeButton(QMessageBox::Cancel);
@ -609,8 +610,11 @@ void MainWindow::closeEvent(QCloseEvent* event)
auto code = msgbox.exec();
if(code == QMessageBox::Retry)
restartDebugging();
if(code == QMessageBox::Abort)
DbgCmdExec("stop");
else if(code == QMessageBox::Abort)
{
bExitWhenDetached = true;
DbgCmdExec("detach");
}
if(code != QMessageBox::Yes)
{
event->ignore();
@ -1891,6 +1895,8 @@ void MainWindow::dbgStateChangedSlot(DBGSTATE state)
{
if(state == initialized) //fixes a crash when restarting with certain settings in another tab
displayCpuWidget();
if(bExitWhenDetached && state == stopped) //detach and exit: the debugger has detached, no exit confirmation dialog this time
close();
}
void MainWindow::on_actionFaq_triggered()

View File

@ -245,6 +245,7 @@ private:
void clearMenuImpl(int hMenu, bool erase);
bool bCanClose;
bool bExitWhenDetached;
MainWindowCloseThread* mCloseThread;
struct WidgetInfo