From 3d2daffbe9ea071126100e97a8afaa03994f7dd2 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 28 May 2026 11:23:58 -0400 Subject: [PATCH] Add Qt reset menu. --- OSBindings/Qt/mainwindow.cpp | 25 +++++++++++++++++++++++++ OSBindings/Qt/mainwindow.h | 1 + 2 files changed, 26 insertions(+) diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index cdf99be47..de6af3752 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -409,6 +409,31 @@ void MainWindow::launchMachine() { } keyboardInputMode = keyboardMachine ? KeyboardInputMode::Keyboard : KeyboardInputMode::Joystick; + // Add a 'reset' menu, possibly. + auto softResettable = machine->soft_resettable(); + auto hardResettable = machine->hard_resettable(); + if(softResettable || hardResettable) { + resetMenu = menuBar()->addMenu(tr("&Reset")); + + if(softResettable) { + QAction *const softResetAction = new QAction(tr("Soft"), this); + resetMenu->addAction(softResetAction); + connect(softResetAction, &QAction::triggered, this, [=, this] { + auto softResettable = machine->soft_resettable(); + if(softResettable) softResettable->soft_reset(); + }); + } + + if(hardResettable) { + QAction *const hardResetAction = new QAction(tr("Hard"), this); + resetMenu->addAction(hardResetAction); + connect(hardResetAction, &QAction::triggered, this, [=, this] { + auto hardResettable = machine->hard_resettable(); + if(hardResettable) hardResettable->hard_reset(); + }); + } + } + // Add machine-specific UI. const std::string settingsPrefix = Machine::ShortNameForTargetMachine(machineType); auto configurableMachine = machine->configurable_device(); diff --git a/OSBindings/Qt/mainwindow.h b/OSBindings/Qt/mainwindow.h index e724114f9..523522e9c 100644 --- a/OSBindings/Qt/mainwindow.h +++ b/OSBindings/Qt/mainwindow.h @@ -155,6 +155,7 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat void addHelpMenu(); QMenu *inputMenu = nullptr; + QMenu *resetMenu = nullptr; KeyboardMapper keyMapper;