minor refactoring

This commit is contained in:
Thomas Jentzsch 2021-12-12 09:23:13 +01:00
parent 1aa11150c6
commit ed547df8ad
3 changed files with 25 additions and 10 deletions

View File

@ -325,6 +325,21 @@ void FileListWidget::handleCommand(CommandSender* sender, int cmd, int data, int
{
switch (cmd)
{
case FileListWidget::kHomeDirCmd:
// Do not let the boss know
selectHomeDir();
return;
case FileListWidget::kPrevDirCmd:
// Do not let the boss know
selectPrevHistory();
return;
case FileListWidget::kNextDirCmd:
// Do not let the boss know
selectNextHistory();
return;
case ListWidget::kParentDirCmd:
selectParent();
// Do not let the boss know

View File

@ -86,12 +86,6 @@ class FileListWidget : public StringListWidget
virtual void selectDirectory();
/** Select parent directory (if applicable) */
void selectParent();
/** Select to home directory */
void selectHomeDir();
/** Select previous directory in history (if applicable) */
void selectPrevHistory();
/** Select next directory in history (if applicable) */
void selectNextHistory();
/** Check if the there is a previous directory in history */
bool hasPrevHistory();
/** Check if the there is a next directory in history */
@ -145,6 +139,12 @@ class FileListWidget : public StringListWidget
protected:
/** Very similar to setDirectory(), but also updates the history */
void setLocation(const FilesystemNode& node, const string select);
/** Select to home directory */
void selectHomeDir();
/** Select previous directory in history (if applicable) */
void selectPrevHistory();
/** Select next directory in history (if applicable) */
void selectNextHistory();
virtual bool isDirectory(const FilesystemNode& node) const;
virtual void getChildren(const FilesystemNode::CancelCheck& isCancelled);
virtual void extendLists(StringList& list) { }

View File

@ -1008,19 +1008,19 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
break;
case FileListWidget::kHomeDirCmd:
myList->selectHomeDir();
myList->sendCommand(FileListWidget::kHomeDirCmd, 0, 0);
break;
case FileListWidget::kPrevDirCmd:
myList->selectPrevHistory();
myList->sendCommand(FileListWidget::kPrevDirCmd, 0, 0);
break;
case FileListWidget::kNextDirCmd:
myList->selectNextHistory();
myList->sendCommand(FileListWidget::kNextDirCmd, 0, 0);
break;
case ListWidget::kParentDirCmd:
myList->selectParent();
myList->sendCommand(ListWidget::kParentDirCmd, 0, 0);
break;
case kLoadROMCmd: