diff --git a/src/gui/FileListWidget.hxx b/src/gui/FileListWidget.hxx index b5ba5bf7e..98c149223 100644 --- a/src/gui/FileListWidget.hxx +++ b/src/gui/FileListWidget.hxx @@ -88,6 +88,7 @@ class FileListWidget : public StringListWidget const FilesystemNode& currentDir() const { return _node; } static void setQuickSelectDelay(uInt64 time) { _QUICK_SELECT_DELAY = time; } + uInt64 getQuickSelectDelay() { return _QUICK_SELECT_DELAY; } ProgressDialog& progress(); void incProgress(); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 03be5adf3..74f08328a 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -35,6 +35,7 @@ #include "ProgressDialog.hxx" #include "MessageBox.hxx" #include "ToolTip.hxx" +#include "TimerManager.hxx" #include "OSystem.hxx" #include "FrameBuffer.hxx" #include "FBSurface.hxx" @@ -358,6 +359,16 @@ void LauncherDialog::reload() { myMD5List.clear(); myList->reload(); + myPendingReload = false; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void LauncherDialog::tick() +{ + if(myPendingReload && myReloadTime < TimerManager::getTicks() / 1000) + reload(); + + Dialog::tick(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -771,11 +782,20 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd, case EditableWidget::kChangedCmd: { bool subAllowed = myPattern->getText().length() >= MIN_SUBDIRS_CHARS; + bool subDirs = subAllowed && mySubDirs->getState(); mySubDirs->setEnabled(subAllowed); - myList->setIncludeSubDirs(mySubDirs->getState() && subAllowed); + myList->setIncludeSubDirs(subDirs); applyFiltering(); // pattern matching taken care of directly in this method - reload(); + + if(subDirs) + { + // delay (potentially slow) subdirectories reloads until user stops typing + myReloadTime = TimerManager::getTicks() / 1000 + myList->getQuickSelectDelay(); + myPendingReload = true; + } + else + reload(); break; } diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index 44601d48d..a415f1403 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -95,6 +95,8 @@ class LauncherDialog : public Dialog */ void reload(); + void tick() override; + private: static constexpr int MIN_LAUNCHER_CHARS = 24; static constexpr int MIN_ROMINFO_CHARS = 30; @@ -194,6 +196,8 @@ class LauncherDialog : public Dialog bool myUseMinimalUI{false}; bool myEventHandled{false}; bool myShortCount{false}; + bool myPendingReload{false}; + uInt64 myReloadTime{0}; enum { kAllfilesCmd = 'lalf', // show all files (or ROMs only) diff --git a/src/gui/WhatsNewDialog.cxx b/src/gui/WhatsNewDialog.cxx index 5892bfcfd..7c26ca186 100644 --- a/src/gui/WhatsNewDialog.cxx +++ b/src/gui/WhatsNewDialog.cxx @@ -49,6 +49,7 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const add(ypos, "enhanced cut/copy/paste for text editing"); add(ypos, "added undo and redo to text editing"); add(ypos, "added wildcard support to launcher dialog filter"); + add(ypos, "added option to search subdirectories in launcher"); add(ypos, "added tooltips to many UI items"); add(ypos, "increased sample size for CDFJ+"); add(ypos, ELLIPSIS + " (for a complete list see 'docs/Changes.txt')");