mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 12:09:15 +00:00
GUI: Add RemoteBrowser parent directories remembering
No wait when "Go up" is pressed. These contents could be invalid, though. In order to refresh contents, one has to go up one more time and then get back inside (in root folder - just press "Go up" to refresh it).
This commit is contained in:
parent
51a7232c73
commit
6faf2c2617
@ -98,7 +98,8 @@ void RemoteBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||
break;
|
||||
case kListItemActivatedCmd:
|
||||
case kListItemDoubleClickedCmd:
|
||||
if (_nodeContent[data].isDirectory()) {
|
||||
if (_nodeContent[data].isDirectory()) {
|
||||
_rememberedNodeContents[_node.path()] = _nodeContent;
|
||||
listDirectory(_nodeContent[data]);
|
||||
}
|
||||
break;
|
||||
@ -155,30 +156,39 @@ void RemoteBrowserDialog::updateListing() {
|
||||
}
|
||||
|
||||
void RemoteBrowserDialog::goUp() {
|
||||
if (_rememberedNodeContents.contains(_node.path()))
|
||||
_rememberedNodeContents.erase(_node.path());
|
||||
|
||||
Common::String path = _node.path();
|
||||
if (path.size() && (path.lastChar() == '/' || path.lastChar() == '\\')) path.deleteLastChar();
|
||||
if (path.empty()) {
|
||||
draw();
|
||||
return;
|
||||
_rememberedNodeContents.erase("");
|
||||
} else {
|
||||
for (int i = path.size() - 1; i >= 0; --i)
|
||||
if (i == 0 || path[i] == '/' || path[i] == '\\') {
|
||||
path.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = path.size()-1; i >= 0; --i)
|
||||
if (i == 0 || path[i] == '/' || path[i] == '\\') {
|
||||
path.erase(i);
|
||||
break;
|
||||
}
|
||||
|
||||
listDirectory(Cloud::StorageFile(path, 0, 0, true));
|
||||
}
|
||||
|
||||
void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) {
|
||||
if (_navigationLocked || _workingRequest) return;
|
||||
_navigationLocked = true;
|
||||
|
||||
_workingRequest = CloudMan.listDirectory(
|
||||
node.path(),
|
||||
new Common::Callback<RemoteBrowserDialog, Cloud::Storage::ListDirectoryResponse>(this, &RemoteBrowserDialog::directoryListedCallback),
|
||||
new Common::Callback<RemoteBrowserDialog, Networking::ErrorResponse>(this, &RemoteBrowserDialog::directoryListedErrorCallback),
|
||||
false
|
||||
);
|
||||
if (_rememberedNodeContents.contains(node.path())) {
|
||||
_nodeContent = _rememberedNodeContents[node.path()];
|
||||
} else {
|
||||
_navigationLocked = true;
|
||||
|
||||
_workingRequest = CloudMan.listDirectory(
|
||||
node.path(),
|
||||
new Common::Callback<RemoteBrowserDialog, Cloud::Storage::ListDirectoryResponse>(this, &RemoteBrowserDialog::directoryListedCallback),
|
||||
new Common::Callback<RemoteBrowserDialog, Networking::ErrorResponse>(this, &RemoteBrowserDialog::directoryListedErrorCallback),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
_backupNode = _node;
|
||||
_node = node;
|
||||
|
@ -53,6 +53,7 @@ protected:
|
||||
StaticTextWidget *_currentPath;
|
||||
Cloud::StorageFile _node, _backupNode;
|
||||
Common::Array<Cloud::StorageFile> _nodeContent;
|
||||
Common::HashMap<Common::String, Common::Array<Cloud::StorageFile> > _rememberedNodeContents;
|
||||
Cloud::StorageFile _choice;
|
||||
bool _navigationLocked;
|
||||
bool _updateList;
|
||||
|
Loading…
Reference in New Issue
Block a user