summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger/debugqt.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-12-02 02:25:57 +1100
committer Vas Crabb <vas@vastheman.com>2022-12-02 02:25:57 +1100
commit516f6b5d2b84c6f4a9aa447d651f3d5e6d113f6d (patch)
treea803f88585a3019c2b32a714f0e48e6c611f4032 /src/osd/modules/debugger/debugqt.cpp
parente46d279454cada2e0a9f2786d382333eacc5a2cd (diff)
-debugger: Improved session save/restore.
* Qt: Save expression for memory and disassembly views. * Qt: Made command history behave more like Cocoa. * Qt: Added expression history and made behaviour more like Cocoa. * Qt: Refactored global notifications to use signals. * Win32: Increased command/expression history size to 100 items. * Cocoa: Save state of device info viewer windows. * Qt/Win32/Cocoa: Save command/expression history. -util/xmlfile.cpp: Fixed bug where copyInto failed to copy nodes.
Diffstat (limited to 'src/osd/modules/debugger/debugqt.cpp')
-rw-r--r--src/osd/modules/debugger/debugqt.cpp87
1 files changed, 18 insertions, 69 deletions
diff --git a/src/osd/modules/debugger/debugqt.cpp b/src/osd/modules/debugger/debugqt.cpp
index c0dc5acb7d6..ae82137f0d8 100644
--- a/src/osd/modules/debugger/debugqt.cpp
+++ b/src/osd/modules/debugger/debugqt.cpp
@@ -45,7 +45,7 @@ bool winwindow_qt_filter(void *message);
namespace {
-class debug_qt : public osd_module, public debug_module
+class debug_qt : public osd_module, public debug_module, protected osd::debugger::qt::DebuggerQt
#if defined(_WIN32) && !defined(SDLMAME_WIN32)
, public QAbstractNativeEventFilter
#endif
@@ -75,6 +75,8 @@ public:
}
#endif
+ virtual running_machine &machine() const override { return *m_machine; }
+
private:
void configuration_load(config_type which_type, config_level level, util::xml::data_node const *parentnode);
void configuration_save(config_type which_type, util::xml::data_node *parentnode);
@@ -102,13 +104,8 @@ char *qtArgv[] = { qtArg0, nullptr };
void debug_qt::exit()
{
// If you've done a hard reset, clear out existing widgets
- if (m_mainwindow)
- {
- m_mainwindow->setExiting();
- QApplication::closeAllWindows();
- qApp->processEvents(QEventLoop::AllEvents, 1);
- m_mainwindow = nullptr;
- }
+ emit exitDebugger();
+ m_mainwindow = nullptr;
}
@@ -145,7 +142,7 @@ void debug_qt::wait_for_debugger(device_t &device, bool firststop)
// Dialog initialization
if (!m_mainwindow)
{
- m_mainwindow = new osd::debugger::qt::MainWindow(*m_machine);
+ m_mainwindow = new osd::debugger::qt::MainWindow(*this);
if (m_config)
{
load_window_configurations(*m_config->get_first_child());
@@ -155,11 +152,7 @@ void debug_qt::wait_for_debugger(device_t &device, bool firststop)
}
// Ensure all top level widgets are visible & bring main window to front
- foreach (QWidget *widget, QApplication::topLevelWidgets())
- {
- if (widget->isWindow() && (widget->windowType() == Qt::Window))
- widget->show();
- }
+ emit showAllWindows();
if (firststop)
{
@@ -167,33 +160,13 @@ void debug_qt::wait_for_debugger(device_t &device, bool firststop)
m_mainwindow->raise();
}
- // Set the main window to display the proper cpu
+ // Set the main window to display the proper CPU
m_mainwindow->setProcessor(&device);
// Run our own QT event loop
osd_sleep(osd_ticks_per_second() / 1000 * 50);
qApp->processEvents(QEventLoop::AllEvents, 1);
- // Refresh everyone if requested
- if (m_mainwindow->wantsRefresh())
- {
- QWidgetList allWidgets = qApp->allWidgets();
- for (int i = 0; i < allWidgets.length(); i++)
- allWidgets[i]->update();
- m_mainwindow->clearRefreshFlag();
- }
-
- // Hide all top level widgets if requested
- if (m_mainwindow->wantsHide())
- {
- foreach (QWidget *widget, QApplication::topLevelWidgets())
- {
- if (widget->isWindow() && (widget->windowType() == Qt::Window))
- widget->hide();
- }
- m_mainwindow->clearHideFlag();
- }
-
#if defined(_WIN32) && !defined(SDLMAME_WIN32)
winwindow_update_cursor_state(*m_machine); // make sure the cursor isn't hidden while in debugger
#endif
@@ -232,18 +205,7 @@ void debug_qt::configuration_save(config_type which_type, util::xml::data_node *
{
// We only save system configuration for now
if ((config_type::SYSTEM == which_type) && parentnode)
- {
- // Loop over all the open windows
- for (QWidget *widget : QApplication::topLevelWidgets())
- {
- if (!widget->isWindow() || (widget->windowType() != Qt::Window))
- continue;
-
- osd::debugger::qt::WindowQt *const win = dynamic_cast<osd::debugger::qt::WindowQt *>(widget);
- if (win)
- win->saveConfiguration(*parentnode);
- }
- }
+ emit saveConfiguration(*parentnode);
}
@@ -251,46 +213,33 @@ void debug_qt::load_window_configurations(util::xml::data_node const &parentnode
{
for (util::xml::data_node const *wnode = parentnode.get_child(osd::debugger::NODE_WINDOW); wnode; wnode = wnode->get_next_sibling(osd::debugger::NODE_WINDOW))
{
- std::unique_ptr<osd::debugger::qt::WindowQtConfig> cfg;
osd::debugger::qt::WindowQt *win = nullptr;
switch (wnode->get_attribute_int(osd::debugger::ATTR_WINDOW_TYPE, -1))
{
case osd::debugger::WINDOW_TYPE_CONSOLE:
- cfg = std::make_unique<osd::debugger::qt::MainWindowQtConfig>();
+ win = m_mainwindow;
break;
case osd::debugger::WINDOW_TYPE_MEMORY_VIEWER:
- cfg = std::make_unique<osd::debugger::qt::MemoryWindowQtConfig>();
- win = new osd::debugger::qt::MemoryWindow(*m_machine);
+ win = new osd::debugger::qt::MemoryWindow(*this);
break;
case osd::debugger::WINDOW_TYPE_DISASSEMBLY_VIEWER:
- cfg = std::make_unique<osd::debugger::qt::DasmWindowQtConfig>();
- win = new osd::debugger::qt::DasmWindow(*m_machine);
+ win = new osd::debugger::qt::DasmWindow(*this);
break;
case osd::debugger::WINDOW_TYPE_ERROR_LOG_VIEWER:
- cfg = std::make_unique<osd::debugger::qt::LogWindowQtConfig>();
- win = new osd::debugger::qt::LogWindow(*m_machine);
+ win = new osd::debugger::qt::LogWindow(*this);
break;
case osd::debugger::WINDOW_TYPE_POINTS_VIEWER:
- cfg = std::make_unique<osd::debugger::qt::BreakpointsWindowQtConfig>();
- win = new osd::debugger::qt::BreakpointsWindow(*m_machine);
+ win = new osd::debugger::qt::BreakpointsWindow(*this);
break;
case osd::debugger::WINDOW_TYPE_DEVICES_VIEWER:
- cfg = std::make_unique<osd::debugger::qt::DevicesWindowQtConfig>();
- win = new osd::debugger::qt::DevicesWindow(*m_machine);
+ win = new osd::debugger::qt::DevicesWindow(*this);
break;
case osd::debugger::WINDOW_TYPE_DEVICE_INFO_VIEWER:
- cfg = std::make_unique<osd::debugger::qt::DeviceInformationWindowQtConfig>();
- win = new osd::debugger::qt::DeviceInformationWindow(*m_machine);
+ win = new osd::debugger::qt::DeviceInformationWindow(*this);
break;
}
- if (cfg)
- {
- cfg->recoverFromXmlNode(*wnode);
- if (win)
- cfg->applyToQWidget(win);
- else if (osd::debugger::WINDOW_TYPE_CONSOLE == cfg->m_type)
- cfg->applyToQWidget(m_mainwindow);
- }
+ if (win)
+ win->restoreConfiguration(*wnode);
}
}