diff options
Diffstat (limited to 'src/osd/modules/debugger/qt/windowqt.h')
-rw-r--r-- | src/osd/modules/debugger/qt/windowqt.h | 87 |
1 files changed, 55 insertions, 32 deletions
diff --git a/src/osd/modules/debugger/qt/windowqt.h b/src/osd/modules/debugger/qt/windowqt.h index ceea280e016..8085f9a63bf 100644 --- a/src/osd/modules/debugger/qt/windowqt.h +++ b/src/osd/modules/debugger/qt/windowqt.h @@ -9,30 +9,45 @@ #include <QtWidgets/QMainWindow> +#include <deque> +#include <memory> + namespace osd::debugger::qt { //============================================================ -// The Qt window that everyone derives from. +// The Qt debugger module interface //============================================================ -class WindowQt : public QMainWindow +class DebuggerQt : public QObject { Q_OBJECT public: - WindowQt(running_machine &machine, QWidget *parent = nullptr); - virtual ~WindowQt(); + virtual ~DebuggerQt() { } - // The interface to an all-window refresh - void refreshAll() { s_refreshAll = true; } - bool wantsRefresh() { return s_refreshAll; } - void clearRefreshFlag() { s_refreshAll = false; } + virtual running_machine &machine() const = 0; - void hideAll() { s_hideAll = true; } - bool wantsHide() { return s_hideAll; } - void clearHideFlag() { s_hideAll = false; } + void hideAll() { emit hideAllWindows(); } +signals: + void exitDebugger(); + void hideAllWindows(); + void showAllWindows(); void saveConfiguration(util::xml::data_node &parentnode); +}; + + +//============================================================ +// The Qt window that everyone derives from. +//============================================================ +class WindowQt : public QMainWindow +{ + Q_OBJECT + +public: + virtual ~WindowQt(); + + virtual void restoreConfiguration(util::xml::data_node const &node); protected slots: void debugActOpenMemory(); @@ -52,38 +67,46 @@ protected slots: void debugActHardReset(); virtual void debugActClose(); void debugActQuit(); + virtual void debuggerExit(); +private slots: + void saveConfiguration(util::xml::data_node &parentnode); protected: + WindowQt(DebuggerQt &debugger, QWidget *parent = nullptr); + virtual void saveConfigurationToNode(util::xml::data_node &node); + DebuggerQt &m_debugger; running_machine &m_machine; - - static bool s_refreshAll; - static bool s_hideAll; }; -//========================================================================= -// A way to store the configuration of a window long enough to read/write. -//========================================================================= -class WindowQtConfig +//============================================================ +// Command history helper +//============================================================ +class CommandHistory { public: - WindowQtConfig(int type) : - m_type(type), - m_size(800, 600), - m_position(120, 120) - {} - virtual ~WindowQtConfig() {} - - // Settings - int m_type; - QPoint m_size; - QPoint m_position; - - virtual void applyToQWidget(QWidget *widget); - virtual void recoverFromXmlNode(util::xml::data_node const &node); + CommandHistory(); + ~CommandHistory(); + + void add(QString const &entry); + QString const *previous(QString const ¤t); + QString const *next(QString const ¤t); + void edit(); + void reset(); + void clear(); + + void restoreConfigurationFromNode(util::xml::data_node const &node); + void saveConfigurationToNode(util::xml::data_node &node); + +private: + static inline constexpr unsigned CAPACITY = 100U; + + std::deque<QString> m_history; + std::unique_ptr<QString> m_current; + int m_position; }; } // namespace osd::debugger::qt |