mirror of https://github.com/stella-emu/stella.git
Restore 'lastrom' functionality; partially broken in a previous refactoring.
This commit is contained in:
parent
69967fc598
commit
1fc3c62a91
|
@ -34,16 +34,19 @@ FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FileListWidget::setDirectory(const FilesystemNode& node, string select)
|
||||
void FileListWidget::setDirectory(const FilesystemNode& node,
|
||||
const string& select)
|
||||
{
|
||||
_node = node;
|
||||
|
||||
// We always want a directory listing
|
||||
if(!_node.isDirectory() && _node.hasParent())
|
||||
{
|
||||
select = _node.getName();
|
||||
_selectedFile = _node.getName();
|
||||
_node = _node.getParent();
|
||||
}
|
||||
else
|
||||
_selectedFile = select;
|
||||
|
||||
// Initialize history
|
||||
FilesystemNode tmp = _node;
|
||||
|
@ -62,11 +65,12 @@ void FileListWidget::setDirectory(const FilesystemNode& node, string select)
|
|||
_history.reverse();
|
||||
|
||||
// Finally, go to this location
|
||||
setLocation(_node, select);
|
||||
setLocation(_node, _selectedFile);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FileListWidget::setLocation(const FilesystemNode& node, const string& select)
|
||||
void FileListWidget::setLocation(const FilesystemNode& node,
|
||||
const string& select)
|
||||
{
|
||||
_node = node;
|
||||
|
||||
|
@ -90,7 +94,7 @@ void FileListWidget::setLocation(const FilesystemNode& node, const string& selec
|
|||
void FileListWidget::selectDirectory()
|
||||
{
|
||||
_history.push(selected().getName());
|
||||
setLocation(selected());
|
||||
setLocation(selected(), _selectedFile);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -64,7 +64,7 @@ class FileListWidget : public StringListWidget
|
|||
will instead be used, and the file will be selected
|
||||
@param select An optional entry to select (if applicable)
|
||||
*/
|
||||
void setDirectory(const FilesystemNode& node, string select = "");
|
||||
void setDirectory(const FilesystemNode& node, const string& select = EmptyString);
|
||||
|
||||
/** Select parent directory (if applicable) */
|
||||
void selectParent();
|
||||
|
@ -83,7 +83,7 @@ class FileListWidget : public StringListWidget
|
|||
|
||||
private:
|
||||
/** Very similar to setDirectory(), but also updates the history */
|
||||
void setLocation(const FilesystemNode& node, const string& select = EmptyString);
|
||||
void setLocation(const FilesystemNode& node, const string& select);
|
||||
|
||||
/** Descend into currently selected directory */
|
||||
void selectDirectory();
|
||||
|
@ -99,6 +99,7 @@ class FileListWidget : public StringListWidget
|
|||
|
||||
Common::FixedStack<string> _history;
|
||||
uInt32 _selected{0};
|
||||
string _selectedFile;
|
||||
|
||||
string _quickSelectStr;
|
||||
uInt64 _quickSelectTime{0};
|
||||
|
|
Loading…
Reference in New Issue