summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger/qt/breakpointswindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/debugger/qt/breakpointswindow.cpp')
-rw-r--r--src/osd/modules/debugger/qt/breakpointswindow.cpp151
1 files changed, 92 insertions, 59 deletions
diff --git a/src/osd/modules/debugger/qt/breakpointswindow.cpp b/src/osd/modules/debugger/qt/breakpointswindow.cpp
index 5d091694d66..7dc3db34179 100644
--- a/src/osd/modules/debugger/qt/breakpointswindow.cpp
+++ b/src/osd/modules/debugger/qt/breakpointswindow.cpp
@@ -1,26 +1,29 @@
// license:BSD-3-Clause
// copyright-holders:Andrew Gardner
#include "emu.h"
+#include "breakpointswindow.h"
+
+#include "util/xmlfile.h"
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include <QtGui/QActionGroup>
+#else
#include <QtWidgets/QActionGroup>
+#endif
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QVBoxLayout>
-#include "breakpointswindow.h"
-#include "debug/debugcon.h"
-#include "debug/debugcpu.h"
-#include "debug/dvbpoints.h"
-#include "debug/dvwpoints.h"
+namespace osd::debugger::qt {
-
-BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) :
- WindowQt(machine, nullptr)
+BreakpointsWindow::BreakpointsWindow(DebuggerQt &debugger, QWidget *parent) :
+ WindowQt(debugger, nullptr)
{
setWindowTitle("Debug: All Breakpoints");
- if (parent != nullptr)
+ if (parent)
{
QPoint parentPos = parent->pos();
setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
@@ -29,13 +32,13 @@ BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent)
//
// The main frame and its input and breakpoints widgets
//
- QFrame* mainWindowFrame = new QFrame(this);
+ QFrame *mainWindowFrame = new QFrame(this);
// The main breakpoints view
m_breakpointsView = new DebuggerView(DVT_BREAK_POINTS, m_machine, this);
// Layout
- QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
+ QVBoxLayout *vLayout = new QVBoxLayout(mainWindowFrame);
vLayout->setObjectName("vlayout");
vLayout->setSpacing(3);
vLayout->setContentsMargins(2,2,2,2);
@@ -46,23 +49,38 @@ BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent)
//
// Menu bars
//
- QActionGroup* typeGroup = new QActionGroup(this);
+ QActionGroup *typeGroup = new QActionGroup(this);
typeGroup->setObjectName("typegroup");
- QAction* typeBreak = new QAction("Breakpoints", this);
+
+ QAction *typeBreak = new QAction("Breakpoints", this);
typeBreak->setObjectName("typebreak");
- QAction* typeWatch = new QAction("Watchpoints", this);
- typeWatch->setObjectName("typewatch");
typeBreak->setCheckable(true);
- typeWatch->setCheckable(true);
typeBreak->setActionGroup(typeGroup);
- typeWatch->setActionGroup(typeGroup);
typeBreak->setShortcut(QKeySequence("Ctrl+1"));
+
+ QAction *typeWatch = new QAction("Watchpoints", this);
+ typeWatch->setObjectName("typewatch");
+ typeWatch->setCheckable(true);
+ typeWatch->setActionGroup(typeGroup);
typeWatch->setShortcut(QKeySequence("Ctrl+2"));
+
+ QAction *typeRegister = new QAction("Registerpoints", this);
+ typeRegister->setObjectName("typeregister");
+ typeRegister->setCheckable(true);
+ typeRegister->setActionGroup(typeGroup);
+ typeRegister->setShortcut(QKeySequence("Ctrl+3"));
+
+ QAction *typeException = new QAction("Exceptionpoints", this);
+ typeException->setObjectName("typeexception");
+ typeException->setCheckable(true);
+ typeException->setActionGroup(typeGroup);
+ typeException->setShortcut(QKeySequence("Ctrl+4"));
+
typeBreak->setChecked(true);
connect(typeGroup, &QActionGroup::triggered, this, &BreakpointsWindow::typeChanged);
// Assemble the options menu
- QMenu* optionsMenu = menuBar()->addMenu("&Options");
+ QMenu *optionsMenu = menuBar()->addMenu("&Options");
optionsMenu->addActions(typeGroup->actions());
}
@@ -72,6 +90,50 @@ BreakpointsWindow::~BreakpointsWindow()
}
+void BreakpointsWindow::restoreConfiguration(util::xml::data_node const &node)
+{
+ WindowQt::restoreConfiguration(node);
+
+ auto const type = node.get_attribute_int(ATTR_WINDOW_POINTS_TYPE, -1);
+ QActionGroup *typeGroup = findChild<QActionGroup *>("typegroup");
+ if ((0 <= type) && (typeGroup->actions().size() > type))
+ typeGroup->actions()[type]->trigger();
+
+ m_breakpointsView->restoreConfigurationFromNode(node);
+
+}
+
+
+void BreakpointsWindow::saveConfigurationToNode(util::xml::data_node &node)
+{
+ WindowQt::saveConfigurationToNode(node);
+
+ node.set_attribute_int(ATTR_WINDOW_TYPE, WINDOW_TYPE_POINTS_VIEWER);
+ if (m_breakpointsView)
+ {
+ switch (m_breakpointsView->view()->type())
+ {
+ case DVT_BREAK_POINTS:
+ node.set_attribute_int(ATTR_WINDOW_POINTS_TYPE, 0);
+ break;
+ case DVT_WATCH_POINTS:
+ node.set_attribute_int(ATTR_WINDOW_POINTS_TYPE, 1);
+ break;
+ case DVT_REGISTER_POINTS:
+ node.set_attribute_int(ATTR_WINDOW_POINTS_TYPE, 2);
+ break;
+ case DVT_EXCEPTION_POINTS:
+ node.set_attribute_int(ATTR_WINDOW_POINTS_TYPE, 3);
+ break;
+ default:
+ break;
+ }
+ }
+
+ m_breakpointsView->saveConfigurationToNode(node);
+}
+
+
void BreakpointsWindow::typeChanged(QAction* changedTo)
{
// Clean
@@ -89,49 +151,20 @@ void BreakpointsWindow::typeChanged(QAction* changedTo)
m_breakpointsView = new DebuggerView(DVT_WATCH_POINTS, m_machine, this);
setWindowTitle("Debug: All Watchpoints");
}
+ else if (changedTo->text() == "Registerpoints")
+ {
+ m_breakpointsView = new DebuggerView(DVT_REGISTER_POINTS, m_machine, this);
+ setWindowTitle("Debug: All Registerpoints");
+ }
+ else if (changedTo->text() == "Exceptionpoints")
+ {
+ m_breakpointsView = new DebuggerView(DVT_EXCEPTION_POINTS, m_machine, this);
+ setWindowTitle("Debug: All Exceptionpoints");
+ }
// Re-register
- QVBoxLayout* layout = findChild<QVBoxLayout*>("vlayout");
+ QVBoxLayout *layout = findChild<QVBoxLayout *>("vlayout");
layout->addWidget(m_breakpointsView);
}
-
-
-//=========================================================================
-// BreakpointsWindowQtConfig
-//=========================================================================
-void BreakpointsWindowQtConfig::buildFromQWidget(QWidget* widget)
-{
- WindowQtConfig::buildFromQWidget(widget);
- BreakpointsWindow* window = dynamic_cast<BreakpointsWindow*>(widget);
-
- QActionGroup* typeGroup = window->findChild<QActionGroup*>("typegroup");
- if (typeGroup->checkedAction()->text() == "Breakpoints")
- m_bwType = 0;
- else if (typeGroup->checkedAction()->text() == "Watchpoints")
- m_bwType = 1;
-}
-
-
-void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget)
-{
- WindowQtConfig::applyToQWidget(widget);
- BreakpointsWindow* window = dynamic_cast<BreakpointsWindow*>(widget);
-
- QActionGroup* typeGroup = window->findChild<QActionGroup*>("typegroup");
- typeGroup->actions()[m_bwType]->trigger();
-}
-
-
-void BreakpointsWindowQtConfig::addToXmlDataNode(util::xml::data_node &node) const
-{
- WindowQtConfig::addToXmlDataNode(node);
- node.set_attribute_int("bwtype", m_bwType);
-}
-
-
-void BreakpointsWindowQtConfig::recoverFromXmlNode(util::xml::data_node const &node)
-{
- WindowQtConfig::recoverFromXmlNode(node);
- m_bwType = node.get_attribute_int("bwtype", m_bwType);
-}
+} // namespace osd::debugger::qt