1
0
Fork 0

Merge pull request #2857 from torusrxxx/patch000000d5

Add detach and exit to exit dialog
This commit is contained in:
Duncan Ogilvie 2022-03-26 14:09:43 +01:00 committed by GitHub
commit ba12bb6eba
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -119,6 +119,7 @@ HandlesView::HandlesView(QWidget* parent) : QWidget(parent)
mWindowsTable->addAction(mActionFollowProc);
mActionToggleProcBP = new QAction(DIcon("breakpoint_toggle.png"), tr("Toggle Breakpoint in Proc"), this);
connect(mActionToggleProcBP, SIGNAL(triggered()), this, SLOT(toggleBPSlot()));
mWindowsTable->addAction(mActionToggleProcBP);
mActionMessageProcBP = new QAction(DIcon("breakpoint_execute.png"), tr("Message Breakpoint"), this);
connect(mActionMessageProcBP, SIGNAL(triggered()), this, SLOT(messagesBPSlot()));
@ -169,6 +170,7 @@ void HandlesView::reloadData()
void HandlesView::refreshShortcuts()
{
mActionRefresh->setShortcut(ConfigShortcut("ActionRefresh"));
mActionToggleProcBP->setShortcut(ConfigShortcut("ActionToggleBreakpoint"));
}
void HandlesView::dbgStateChanged(DBGSTATE state)

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