From 2db390d8c067b1d19aa4cea902ea648327844e0b Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Wed, 16 Jun 2021 17:23:24 +0200 Subject: [PATCH] added directory navigation support to launcher 'Select' button --- docs/index.html | 2 +- src/gui/FileListWidget.hxx | 5 ++--- src/gui/LauncherDialog.cxx | 11 ++++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/index.html b/docs/index.html index c7061af15..262f1083b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -629,7 +629,7 @@ The tables below show the default settings.

Note: All key names are based on the US QWERTY - keyboard layout.. If you use a different layout some keys may differ. You can use the + keyboard layout. If you use a different layout some keys may differ. You can use the following layout image as reference where to find the US keys on your keyboard.

diff --git a/src/gui/FileListWidget.hxx b/src/gui/FileListWidget.hxx index 474742104..c6a964c38 100644 --- a/src/gui/FileListWidget.hxx +++ b/src/gui/FileListWidget.hxx @@ -77,6 +77,8 @@ class FileListWidget : public StringListWidget /** Select parent directory (if applicable) */ void selectParent(); + /** Descend into currently selected directory */ + void selectDirectory(); /** Reload current location (file or directory) */ void reload(); @@ -98,9 +100,6 @@ class FileListWidget : public StringListWidget /** Very similar to setDirectory(), but also updates the history */ void setLocation(const FilesystemNode& node, const string& select); - /** Descend into currently selected directory */ - void selectDirectory(); - bool handleText(char text) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 4adba0787..473c92b1d 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -287,7 +287,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, "Select", kLoadROMCmd); wid.push_back(myStartButton); #endif - myStartButton->setToolTip("Start emulation of selected ROM."); + myStartButton->setToolTip("Start emulation of selected ROM\nor switch to selected directory."); } if(myUseMinimalUI) // Highlight 'Rom Listing' mySelectedItem = 0; @@ -789,6 +789,15 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd, break; case kLoadROMCmd: + if(myList->selected().isDirectory()) + { + if(myList->selected().getName() == " [..]") + myList->selectParent(); + else + myList->selectDirectory(); + break; + } + [[fallthrough]]; case FileListWidget::ItemActivated: saveConfig(); loadRom();