mirror of https://github.com/stella-emu/stella.git
added launcher reload delay while typing filter
This commit is contained in:
parent
7049bbfd66
commit
6e4052763b
|
@ -88,6 +88,7 @@ class FileListWidget : public StringListWidget
|
||||||
const FilesystemNode& currentDir() const { return _node; }
|
const FilesystemNode& currentDir() const { return _node; }
|
||||||
|
|
||||||
static void setQuickSelectDelay(uInt64 time) { _QUICK_SELECT_DELAY = time; }
|
static void setQuickSelectDelay(uInt64 time) { _QUICK_SELECT_DELAY = time; }
|
||||||
|
uInt64 getQuickSelectDelay() { return _QUICK_SELECT_DELAY; }
|
||||||
|
|
||||||
ProgressDialog& progress();
|
ProgressDialog& progress();
|
||||||
void incProgress();
|
void incProgress();
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "ProgressDialog.hxx"
|
#include "ProgressDialog.hxx"
|
||||||
#include "MessageBox.hxx"
|
#include "MessageBox.hxx"
|
||||||
#include "ToolTip.hxx"
|
#include "ToolTip.hxx"
|
||||||
|
#include "TimerManager.hxx"
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
#include "FBSurface.hxx"
|
#include "FBSurface.hxx"
|
||||||
|
@ -358,6 +359,16 @@ void LauncherDialog::reload()
|
||||||
{
|
{
|
||||||
myMD5List.clear();
|
myMD5List.clear();
|
||||||
myList->reload();
|
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:
|
case EditableWidget::kChangedCmd:
|
||||||
{
|
{
|
||||||
bool subAllowed = myPattern->getText().length() >= MIN_SUBDIRS_CHARS;
|
bool subAllowed = myPattern->getText().length() >= MIN_SUBDIRS_CHARS;
|
||||||
|
bool subDirs = subAllowed && mySubDirs->getState();
|
||||||
|
|
||||||
mySubDirs->setEnabled(subAllowed);
|
mySubDirs->setEnabled(subAllowed);
|
||||||
myList->setIncludeSubDirs(mySubDirs->getState() && subAllowed);
|
myList->setIncludeSubDirs(subDirs);
|
||||||
applyFiltering(); // pattern matching taken care of directly in this method
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ class LauncherDialog : public Dialog
|
||||||
*/
|
*/
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
|
void tick() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr int MIN_LAUNCHER_CHARS = 24;
|
static constexpr int MIN_LAUNCHER_CHARS = 24;
|
||||||
static constexpr int MIN_ROMINFO_CHARS = 30;
|
static constexpr int MIN_ROMINFO_CHARS = 30;
|
||||||
|
@ -194,6 +196,8 @@ class LauncherDialog : public Dialog
|
||||||
bool myUseMinimalUI{false};
|
bool myUseMinimalUI{false};
|
||||||
bool myEventHandled{false};
|
bool myEventHandled{false};
|
||||||
bool myShortCount{false};
|
bool myShortCount{false};
|
||||||
|
bool myPendingReload{false};
|
||||||
|
uInt64 myReloadTime{0};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kAllfilesCmd = 'lalf', // show all files (or ROMs only)
|
kAllfilesCmd = 'lalf', // show all files (or ROMs only)
|
||||||
|
|
|
@ -49,6 +49,7 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const
|
||||||
add(ypos, "enhanced cut/copy/paste for text editing");
|
add(ypos, "enhanced cut/copy/paste for text editing");
|
||||||
add(ypos, "added undo and redo to text editing");
|
add(ypos, "added undo and redo to text editing");
|
||||||
add(ypos, "added wildcard support to launcher dialog filter");
|
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, "added tooltips to many UI items");
|
||||||
add(ypos, "increased sample size for CDFJ+");
|
add(ypos, "increased sample size for CDFJ+");
|
||||||
add(ypos, ELLIPSIS + " (for a complete list see 'docs/Changes.txt')");
|
add(ypos, ELLIPSIS + " (for a complete list see 'docs/Changes.txt')");
|
||||||
|
|
Loading…
Reference in New Issue