diff options
author | 2022-09-20 04:22:51 +1000 | |
---|---|---|
committer | 2022-09-20 04:22:51 +1000 | |
commit | 76541e8c81f1a38707bd4d1c973f6e4f86478de5 (patch) | |
tree | cfb6ba0d92911763ae0fa56be563cf81612c7ab7 /src/osd/modules/debugger/qt/mainwindow.cpp | |
parent | 05d3b10a6c6223b7a384a4aa02ad9d55923d778d (diff) |
Debugger updates:
Made closing the Qt debugger console window hide all debugger windows
and run the emulated machine (debugger windows will be shown on next
user break or breakpoint hit). This matches the behaviour of the Win32
and Cocoa debuggers.
Made Qt debugger clean up its windows on exit rather than on subsequent
starts. This fixes GitHub #9789.
Made Qt debugger less reliant on global variables, and made code to save
and load configuration a bit less convoluted. It still needs more
refactoring on this front, but it's in slightly better shape now.
Made Qt debugger a bit less crashy on invalid configuration. Still
plenty of ways to crash it, but every little bit counts.
Made Qt debugger do less comparisons on menu item names and object
names - it might be possible to localise one day.
Moved all the C++ debugger implementations into namespaces. They're
using awfully generic class names, so it's about time.
Diffstat (limited to 'src/osd/modules/debugger/qt/mainwindow.cpp')
-rw-r--r-- | src/osd/modules/debugger/qt/mainwindow.cpp | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp index 974d3632ffc..a418a543ace 100644 --- a/src/osd/modules/debugger/qt/mainwindow.cpp +++ b/src/osd/modules/debugger/qt/mainwindow.cpp @@ -19,10 +19,13 @@ #include <QtWidgets/QScrollBar> +namespace osd::debugger::qt { + MainWindow::MainWindow(running_machine &machine, QWidget *parent) : WindowQt(machine, nullptr), m_historyIndex(0), - m_inputHistory() + m_inputHistory(), + m_exiting(false) { setGeometry(300, 300, 1000, 600); @@ -70,6 +73,9 @@ MainWindow::MainWindow(running_machine &machine, QWidget *parent) : QAction *rightActRaw = new QAction("Raw Opcodes", this); QAction *rightActEncrypted = new QAction("Encrypted Opcodes", this); QAction *rightActComments = new QAction("Comments", this); + rightActRaw->setData(int(DASM_RIGHTCOL_RAW)); + rightActEncrypted->setData(int(DASM_RIGHTCOL_ENCRYPTED)); + rightActComments->setData(int(DASM_RIGHTCOL_COMMENTS)); rightActRaw->setCheckable(true); rightActEncrypted->setCheckable(true); rightActComments->setCheckable(true); @@ -152,10 +158,10 @@ void MainWindow::saveConfigurationToNode(util::xml::data_node &node) { WindowQt::saveConfigurationToNode(node); - node.set_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, osd::debugger::WINDOW_TYPE_CONSOLE); + node.set_attribute_int(ATTR_WINDOW_TYPE, WINDOW_TYPE_CONSOLE); debug_view_disasm &dasmview = *m_dasmFrame->view()->view<debug_view_disasm>(); - node.set_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, dasmview.right_column()); + node.set_attribute_int(ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, dasmview.right_column()); node.set_attribute("qtwindowstate", saveState().toPercentEncoding().data()); } @@ -163,10 +169,12 @@ void MainWindow::saveConfigurationToNode(util::xml::data_node &node) // Used to intercept the user clicking 'X' in the upper corner void MainWindow::closeEvent(QCloseEvent *event) { - debugActQuit(); - - // Insure the window doesn't disappear before we get a chance to save its parameters - event->ignore(); + if (!m_exiting) + { + // Don't actually close the window - it will be brought back on user break + debugActRunAndHide(); + event->ignore(); + } } @@ -279,14 +287,7 @@ void MainWindow::runToCursor(bool changedTo) void MainWindow::rightBarChanged(QAction *changedTo) { debug_view_disasm *const dasmView = m_dasmFrame->view()->view<debug_view_disasm>(); - - if (changedTo->text() == "Raw Opcodes") - dasmView->set_right_column(DASM_RIGHTCOL_RAW); - else if (changedTo->text() == "Encrypted Opcodes") - dasmView->set_right_column(DASM_RIGHTCOL_ENCRYPTED); - else if (changedTo->text() == "Comments") - dasmView->set_right_column(DASM_RIGHTCOL_COMMENTS); - + dasmView->set_right_column(disasm_right_column(changedTo->data().toInt())); m_dasmFrame->view()->viewport()->update(); } @@ -489,8 +490,15 @@ void MainWindowQtConfig::applyToQWidget(QWidget *widget) MainWindow *window = dynamic_cast<MainWindow *>(widget); window->restoreState(m_windowState); - QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup"); - rightBarGroup->actions()[m_rightBar - 1]->trigger(); + QActionGroup *const rightBarGroup = window->findChild<QActionGroup*>("rightbargroup"); + for (QAction *action : rightBarGroup->actions()) + { + if (action->data().toInt() == m_rightBar) + { + action->trigger(); + break; + } + } } @@ -499,7 +507,7 @@ void MainWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node) WindowQtConfig::recoverFromXmlNode(node); const char* state = node.get_attribute_string("qtwindowstate", ""); m_windowState = QByteArray::fromPercentEncoding(state); - m_rightBar = node.get_attribute_int(osd::debugger::ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, m_rightBar); + m_rightBar = node.get_attribute_int(ATTR_WINDOW_DISASSEMBLY_RIGHT_COLUMN, m_rightBar); } DasmDockWidget::~DasmDockWidget() @@ -509,3 +517,5 @@ DasmDockWidget::~DasmDockWidget() ProcessorDockWidget::~ProcessorDockWidget() { } + +} // namespace osd::debugger::qt |