mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +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
@ -99,6 +99,7 @@ void RemoteBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
|||||||
case kListItemActivatedCmd:
|
case kListItemActivatedCmd:
|
||||||
case kListItemDoubleClickedCmd:
|
case kListItemDoubleClickedCmd:
|
||||||
if (_nodeContent[data].isDirectory()) {
|
if (_nodeContent[data].isDirectory()) {
|
||||||
|
_rememberedNodeContents[_node.path()] = _nodeContent;
|
||||||
listDirectory(_nodeContent[data]);
|
listDirectory(_nodeContent[data]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -155,22 +156,30 @@ void RemoteBrowserDialog::updateListing() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RemoteBrowserDialog::goUp() {
|
void RemoteBrowserDialog::goUp() {
|
||||||
|
if (_rememberedNodeContents.contains(_node.path()))
|
||||||
|
_rememberedNodeContents.erase(_node.path());
|
||||||
|
|
||||||
Common::String path = _node.path();
|
Common::String path = _node.path();
|
||||||
if (path.size() && (path.lastChar() == '/' || path.lastChar() == '\\')) path.deleteLastChar();
|
if (path.size() && (path.lastChar() == '/' || path.lastChar() == '\\')) path.deleteLastChar();
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
draw();
|
_rememberedNodeContents.erase("");
|
||||||
return;
|
} else {
|
||||||
}
|
for (int i = path.size() - 1; i >= 0; --i)
|
||||||
for (int i = path.size()-1; i >= 0; --i)
|
|
||||||
if (i == 0 || path[i] == '/' || path[i] == '\\') {
|
if (i == 0 || path[i] == '/' || path[i] == '\\') {
|
||||||
path.erase(i);
|
path.erase(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
listDirectory(Cloud::StorageFile(path, 0, 0, true));
|
listDirectory(Cloud::StorageFile(path, 0, 0, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) {
|
void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) {
|
||||||
if (_navigationLocked || _workingRequest) return;
|
if (_navigationLocked || _workingRequest) return;
|
||||||
|
|
||||||
|
if (_rememberedNodeContents.contains(node.path())) {
|
||||||
|
_nodeContent = _rememberedNodeContents[node.path()];
|
||||||
|
} else {
|
||||||
_navigationLocked = true;
|
_navigationLocked = true;
|
||||||
|
|
||||||
_workingRequest = CloudMan.listDirectory(
|
_workingRequest = CloudMan.listDirectory(
|
||||||
@ -179,6 +188,7 @@ void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) {
|
|||||||
new Common::Callback<RemoteBrowserDialog, Networking::ErrorResponse>(this, &RemoteBrowserDialog::directoryListedErrorCallback),
|
new Common::Callback<RemoteBrowserDialog, Networking::ErrorResponse>(this, &RemoteBrowserDialog::directoryListedErrorCallback),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
_backupNode = _node;
|
_backupNode = _node;
|
||||||
_node = node;
|
_node = node;
|
||||||
|
@ -53,6 +53,7 @@ protected:
|
|||||||
StaticTextWidget *_currentPath;
|
StaticTextWidget *_currentPath;
|
||||||
Cloud::StorageFile _node, _backupNode;
|
Cloud::StorageFile _node, _backupNode;
|
||||||
Common::Array<Cloud::StorageFile> _nodeContent;
|
Common::Array<Cloud::StorageFile> _nodeContent;
|
||||||
|
Common::HashMap<Common::String, Common::Array<Cloud::StorageFile> > _rememberedNodeContents;
|
||||||
Cloud::StorageFile _choice;
|
Cloud::StorageFile _choice;
|
||||||
bool _navigationLocked;
|
bool _navigationLocked;
|
||||||
bool _updateList;
|
bool _updateList;
|
||||||
|
Loading…
Reference in New Issue
Block a user