From 0e4c122623d92c48cd0d0601aa608c3fa5281291 Mon Sep 17 00:00:00 2001 From: harry Date: Tue, 20 Feb 2024 05:11:58 -0500 Subject: [PATCH] Added a clear recent ROM list menu item to Qt GUI. --- src/drivers/Qt/ConsoleWindow.cpp | 23 +++++++++++++++++++++++ src/drivers/Qt/ConsoleWindow.h | 1 + 2 files changed, 24 insertions(+) diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index d6c16fc8..446ad872 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -2246,6 +2246,16 @@ void consoleWin_t::buildRecentRomMenu(void) g_config->setOption( buf, s); } } + // Add a dummy disable QAction to create a larger dead space between the ROM list and the clear item. + // Helps prevent accidental unintended clicking of the clear list item + recentRomMenu->addSeparator(); + act = new QAction(recentRomMenu); + act->setEnabled(false); + recentRomMenu->addAction(act); + + act = new QAction(tr("Clear Recent ROM List"), recentRomMenu); + connect(act, SIGNAL(triggered()), this, SLOT(clearRecentRomMenu(void)) ); + recentRomMenu->addAction(act); } //--------------------------------------------------------------------------- void consoleWin_t::saveRecentRomMenu(void) @@ -2275,6 +2285,19 @@ void consoleWin_t::saveRecentRomMenu(void) } //--------------------------------------------------------------------------- +void consoleWin_t::clearRecentRomMenu() +{ + char buf[128]; + for (int i = 0; i < 10; i++) + { + sprintf(buf, "SDL.RecentRom%02i", i); + g_config->setOption( buf, ""); + } + clearRomList(); + + recentRomMenuReset = true; +} +//--------------------------------------------------------------------------- void consoleWin_t::addRecentRom( const char *rom ) { std::string *s; diff --git a/src/drivers/Qt/ConsoleWindow.h b/src/drivers/Qt/ConsoleWindow.h index 23206dcf..f9ca2a33 100644 --- a/src/drivers/Qt/ConsoleWindow.h +++ b/src/drivers/Qt/ConsoleWindow.h @@ -389,6 +389,7 @@ class consoleWin_t : public QMainWindow void toggleGameGenie(bool checked); void loadGameGenieROM(void); void loadMostRecentROM(void); + void clearRecentRomMenu(void); void setRegionNTSC(void); void setRegionPAL(void); void setRegionDendy(void);