From 72b82bd2aa66223f6c740e7bf6dce316b2145b15 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 11:52:40 +0600 Subject: GUI: Add RemoteBrowserDialog WIP. Tested with Dropbox. --- gui/remotebrowser.cpp | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 gui/remotebrowser.cpp (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp new file mode 100644 index 0000000000..37a51d5341 --- /dev/null +++ b/gui/remotebrowser.cpp @@ -0,0 +1,220 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "gui/remotebrowser.h" +#include "gui/widgets/list.h" + +#include "common/config-manager.h" +#include "common/system.h" +#include "common/algorithm.h" + +#include "common/translation.h" +#include +#include +#include + +namespace GUI { + +enum { + kChooseCmd = 'Chos', + kGoUpCmd = 'GoUp', + kHiddenCmd = 'Hidd' +}; + +/* We want to use this as a general directory selector at some point... possible uses + * - to select the data dir for a game + * - to select the place where save games are stored + * - others??? + */ + +RemoteBrowserDialog::RemoteBrowserDialog(const char *title, bool dirRemoteBrowser) + : Dialog("Browser"), _navigationLocked(false), _updateList(false) { + + _isDirRemoteBrowser = dirRemoteBrowser; + _fileList = NULL; + _currentPath = NULL; + + // Headline - TODO: should be customizable during creation time + new StaticTextWidget(this, "Browser.Headline", title); + + // Current path - TODO: handle long paths ? + _currentPath = new StaticTextWidget(this, "Browser.Path", "DUMMY"); + + // Add file list + _fileList = new ListWidget(this, "Browser.List"); + _fileList->setNumberingMode(kListNumberingOff); + _fileList->setEditable(false); + + _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; + + // hide checkbox for the "show hidden files" state. + //_showHiddenWidget = new CheckboxWidget(this, "Browser.Hidden", _("Show hidden files"), _("Show files marked with the hidden attribute"), kHiddenCmd); + + // Buttons + if (g_system->getOverlayWidth() > 320) + new ButtonWidget(this, "Browser.Up", _("Go up"), _("Go to previous directory level"), kGoUpCmd); + else + new ButtonWidget(this, "Browser.Up", _c("Go up", "lowres"), _("Go to previous directory level"), kGoUpCmd); + new ButtonWidget(this, "Browser.Cancel", _("Cancel"), 0, kCloseCmd); + new ButtonWidget(this, "Browser.Choose", _("Choose"), 0, kChooseCmd); +} + +void RemoteBrowserDialog::open() { + Dialog::open(); + listDirectory(Cloud::StorageFile()); +} + +void RemoteBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + switch (cmd) { + case kChooseCmd: + if (_isDirRemoteBrowser) { + // If nothing is selected in the list widget, choose the current dir. + // Else, choose the dir that is selected. + int selection = _fileList->getSelected(); + if (selection >= 0) + _choice = _nodeContent[selection]; + else + _choice = _node; + setResult(1); + close(); + } else { + int selection = _fileList->getSelected(); + if (selection < 0) + break; + if (_nodeContent[selection].isDirectory()) { + _node = _nodeContent[selection]; + updateListing(); + } else { + _choice = _nodeContent[selection]; + setResult(1); + close(); + } + } + break; + case kGoUpCmd: + goUp(); + break; + case kListItemActivatedCmd: + case kListItemDoubleClickedCmd: + if (_nodeContent[data].isDirectory()) { + _node = _nodeContent[data]; + listDirectory(_node); + } else if (!_isDirRemoteBrowser) { //TODO: ???? + _choice = _nodeContent[data]; + setResult(1); + close(); + } + break; + case kListSelectionChangedCmd: + // We do not allow selecting directories in directory + // RemoteBrowser mode, thus we will invalidate the selection + // when the user selects an directory over here. + if (data != (uint32)-1 && _isDirRemoteBrowser && !_nodeContent[data].isDirectory()) + _fileList->setSelected(-1); + break; + default: + Dialog::handleCommand(sender, cmd, data); + } +} + +void RemoteBrowserDialog::handleTickle() { + if (_updateList) { + updateListing(); + _updateList = false; + } + + Dialog::handleTickle(); +} + +void RemoteBrowserDialog::updateListing() { + // Update the path display + Common::String path = _node.path(); + if (path.empty()) path = "/"; //root + _currentPath->setLabel(path); + + if (!_navigationLocked) { + // Populate the ListWidget + ListWidget::StringArray list; + ListWidget::ColorList colors; + for (Common::Array::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) { + if (i->isDirectory()) { + list.push_back(i->name() + "/"); + colors.push_back(ThemeEngine::kFontColorNormal); + } else { + list.push_back(i->name()); + colors.push_back(ThemeEngine::kFontColorAlternate); + } + } + + _fileList->setList(list, &colors); + _fileList->scrollTo(0); + } + + _fileList->setEnabled(!_navigationLocked); + + // Finally, redraw + draw(); +} + +void RemoteBrowserDialog::goUp() { + Common::String path = _node.path(); + if (path.size() && (path.lastChar() == '/' || path.lastChar() == '\\')) path.deleteLastChar(); + if (path.empty()) { + draw(); + return; + } + for (int i = path.size()-1; i >= 0; --i) + if (path[i] == '/' || path[i] == '\\') { + path.erase(i); + break; + } + listDirectory(Cloud::StorageFile(path, 0, 0, true)); +} + +void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) { + if (_navigationLocked) return; + _navigationLocked = true; + + _workingRequest = CloudMan.listDirectory( + node.path(), + new Common::Callback(this, &RemoteBrowserDialog::directoryListedCallback), + new Common::Callback(this, &RemoteBrowserDialog::directoryListedErrorCallback), + false + ); + + _node = node; + updateListing(); +} + +void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryResponse response) { + _navigationLocked = false; + //TODO: list files from response + _nodeContent = response.value; + _updateList = true; +} + +void RemoteBrowserDialog::directoryListedErrorCallback(Networking::ErrorResponse error) { + _navigationLocked = false; + //TODO: show error message +} + +} // End of namespace GUI -- cgit v1.2.3 From e388accda3d4af43c4ae5f060719c4f31bc5cce5 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 12:05:10 +0600 Subject: GUI: Fix "Go up" OneDrive and Google Drive paths do not start with '/', so one was unable to go up to root. --- gui/remotebrowser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index 37a51d5341..a1b0e3f098 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -183,7 +183,7 @@ void RemoteBrowserDialog::goUp() { return; } for (int i = path.size()-1; i >= 0; --i) - if (path[i] == '/' || path[i] == '\\') { + if (i == 0 || path[i] == '/' || path[i] == '\\') { path.erase(i); break; } -- cgit v1.2.3 From 4aa8e23ea24e275f6b68fe6ed773ee2129d4de26 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 13:00:13 +0600 Subject: GUI: Make RemoteBrowser show "Loading..." --- gui/remotebrowser.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index a1b0e3f098..ffa24ecf7a 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -149,6 +149,7 @@ void RemoteBrowserDialog::updateListing() { // Update the path display Common::String path = _node.path(); if (path.empty()) path = "/"; //root + if (_navigationLocked) path = "Loading... " + path; _currentPath->setLabel(path); if (!_navigationLocked) { -- cgit v1.2.3 From 73bb2e20afdd625998a1438adf29e5d9dbaa2929 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 13:00:26 +0600 Subject: GUI: Clean up in RemoteBrowser --- gui/remotebrowser.cpp | 82 +++++++++++++++------------------------------------ 1 file changed, 23 insertions(+), 59 deletions(-) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index ffa24ecf7a..fac0b02e35 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -36,40 +36,20 @@ namespace GUI { enum { kChooseCmd = 'Chos', - kGoUpCmd = 'GoUp', - kHiddenCmd = 'Hidd' + kGoUpCmd = 'GoUp' }; -/* We want to use this as a general directory selector at some point... possible uses - * - to select the data dir for a game - * - to select the place where save games are stored - * - others??? - */ - -RemoteBrowserDialog::RemoteBrowserDialog(const char *title, bool dirRemoteBrowser) +RemoteBrowserDialog::RemoteBrowserDialog(const char *title) : Dialog("Browser"), _navigationLocked(false), _updateList(false) { + _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; - _isDirRemoteBrowser = dirRemoteBrowser; - _fileList = NULL; - _currentPath = NULL; - - // Headline - TODO: should be customizable during creation time new StaticTextWidget(this, "Browser.Headline", title); - - // Current path - TODO: handle long paths ? _currentPath = new StaticTextWidget(this, "Browser.Path", "DUMMY"); - // Add file list _fileList = new ListWidget(this, "Browser.List"); _fileList->setNumberingMode(kListNumberingOff); _fileList->setEditable(false); - _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; - - // hide checkbox for the "show hidden files" state. - //_showHiddenWidget = new CheckboxWidget(this, "Browser.Hidden", _("Show hidden files"), _("Show files marked with the hidden attribute"), kHiddenCmd); - - // Buttons if (g_system->getOverlayWidth() > 320) new ButtonWidget(this, "Browser.Up", _("Go up"), _("Go to previous directory level"), kGoUpCmd); else @@ -85,50 +65,32 @@ void RemoteBrowserDialog::open() { void RemoteBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { - case kChooseCmd: - if (_isDirRemoteBrowser) { - // If nothing is selected in the list widget, choose the current dir. - // Else, choose the dir that is selected. - int selection = _fileList->getSelected(); - if (selection >= 0) - _choice = _nodeContent[selection]; - else - _choice = _node; - setResult(1); - close(); - } else { - int selection = _fileList->getSelected(); - if (selection < 0) - break; - if (_nodeContent[selection].isDirectory()) { - _node = _nodeContent[selection]; - updateListing(); - } else { - _choice = _nodeContent[selection]; - setResult(1); - close(); - } - } + case kChooseCmd: { + // If nothing is selected in the list widget, choose the current dir. + // Else, choose the dir that is selected. + int selection = _fileList->getSelected(); + if (selection >= 0) + _choice = _nodeContent[selection]; + else + _choice = _node; + setResult(1); + close(); break; + } case kGoUpCmd: goUp(); break; case kListItemActivatedCmd: case kListItemDoubleClickedCmd: - if (_nodeContent[data].isDirectory()) { - _node = _nodeContent[data]; - listDirectory(_node); - } else if (!_isDirRemoteBrowser) { //TODO: ???? - _choice = _nodeContent[data]; - setResult(1); - close(); + if (_nodeContent[data].isDirectory()) { + listDirectory(_nodeContent[data]); } break; case kListSelectionChangedCmd: - // We do not allow selecting directories in directory - // RemoteBrowser mode, thus we will invalidate the selection - // when the user selects an directory over here. - if (data != (uint32)-1 && _isDirRemoteBrowser && !_nodeContent[data].isDirectory()) + // We do not allow selecting directories, + // thus we will invalidate the selection + // when the user selects a directory over here. + if (data != (uint32)-1 && !_nodeContent[data].isDirectory()) _fileList->setSelected(-1); break; default: @@ -202,19 +164,21 @@ void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) { false ); + _backupNode = _node; _node = node; updateListing(); } void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryResponse response) { _navigationLocked = false; - //TODO: list files from response _nodeContent = response.value; _updateList = true; } void RemoteBrowserDialog::directoryListedErrorCallback(Networking::ErrorResponse error) { _navigationLocked = false; + _node = _backupNode; + _updateList = true; //TODO: show error message } -- cgit v1.2.3 From 51a7232c73b1f6c04103716cae88b3781fd8ab33 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 13:05:15 +0600 Subject: GUI: Fix RemoteBrowser Request handling Init with NULL, ignore callbacks, and such. --- gui/remotebrowser.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index fac0b02e35..995e6a654c 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -40,7 +40,7 @@ enum { }; RemoteBrowserDialog::RemoteBrowserDialog(const char *title) - : Dialog("Browser"), _navigationLocked(false), _updateList(false) { + : Dialog("Browser"), _navigationLocked(false), _updateList(false), _workingRequest(nullptr), _ignoreCallback(false) { _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; new StaticTextWidget(this, "Browser.Headline", title); @@ -58,11 +58,27 @@ RemoteBrowserDialog::RemoteBrowserDialog(const char *title) new ButtonWidget(this, "Browser.Choose", _("Choose"), 0, kChooseCmd); } +RemoteBrowserDialog::~RemoteBrowserDialog() { + if (_workingRequest) { + _ignoreCallback = true; + _workingRequest->finish(); + } +} + void RemoteBrowserDialog::open() { Dialog::open(); listDirectory(Cloud::StorageFile()); } +void RemoteBrowserDialog::close() { + Dialog::close(); + if (_workingRequest) { + _ignoreCallback = true; + _workingRequest->finish(); + _ignoreCallback = false; + } +} + void RemoteBrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { case kChooseCmd: { @@ -154,7 +170,7 @@ void RemoteBrowserDialog::goUp() { } void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) { - if (_navigationLocked) return; + if (_navigationLocked || _workingRequest) return; _navigationLocked = true; _workingRequest = CloudMan.listDirectory( @@ -170,12 +186,18 @@ void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) { } void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryResponse response) { + _workingRequest = nullptr; + if (_ignoreCallback) return; + _navigationLocked = false; _nodeContent = response.value; _updateList = true; } void RemoteBrowserDialog::directoryListedErrorCallback(Networking::ErrorResponse error) { + _workingRequest = nullptr; + if (_ignoreCallback) return; + _navigationLocked = false; _node = _backupNode; _updateList = true; -- cgit v1.2.3 From 6faf2c26173e0a1305e4cea07a04c2857586bf6f Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 13:26:33 +0600 Subject: 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). --- gui/remotebrowser.cpp | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index 995e6a654c..efeabb69a6 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -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(this, &RemoteBrowserDialog::directoryListedCallback), - new Common::Callback(this, &RemoteBrowserDialog::directoryListedErrorCallback), - false - ); + + if (_rememberedNodeContents.contains(node.path())) { + _nodeContent = _rememberedNodeContents[node.path()]; + } else { + _navigationLocked = true; + + _workingRequest = CloudMan.listDirectory( + node.path(), + new Common::Callback(this, &RemoteBrowserDialog::directoryListedCallback), + new Common::Callback(this, &RemoteBrowserDialog::directoryListedErrorCallback), + false + ); + } _backupNode = _node; _node = node; -- cgit v1.2.3 From 8972f28bc17b6d2f6fee69adcb025c9a561e851f Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 14:06:34 +0600 Subject: GUI: Add RemoteBrowser file list sorting Because Dropbox has no means to specify files order. --- gui/remotebrowser.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index efeabb69a6..e8921b905a 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -201,6 +201,7 @@ void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryR _navigationLocked = false; _nodeContent = response.value; + Common::sort(_nodeContent.begin(), _nodeContent.end(), FileListOrder()); _updateList = true; } -- cgit v1.2.3 From c32d6fa047d03ca7be0e060aadcf33e5ee7d6d4a Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 14:17:35 +0600 Subject: GUI: Add error message in RemoteBrowser For the error callback case. --- gui/remotebrowser.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index e8921b905a..d176d29b02 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -31,6 +31,7 @@ #include #include #include +#include "message.h" namespace GUI { @@ -39,8 +40,9 @@ enum { kGoUpCmd = 'GoUp' }; -RemoteBrowserDialog::RemoteBrowserDialog(const char *title) - : Dialog("Browser"), _navigationLocked(false), _updateList(false), _workingRequest(nullptr), _ignoreCallback(false) { +RemoteBrowserDialog::RemoteBrowserDialog(const char *title): + Dialog("Browser"), _navigationLocked(false), _updateList(false), _showError(false), + _workingRequest(nullptr), _ignoreCallback(false) { _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; new StaticTextWidget(this, "Browser.Headline", title); @@ -121,6 +123,12 @@ void RemoteBrowserDialog::handleTickle() { _updateList = false; } + if (_showError) { + _showError = false; + MessageDialog alert(_("ScummVM couldn't list the directory!")); + alert.runModal(); + } + Dialog::handleTickle(); } @@ -212,7 +220,7 @@ void RemoteBrowserDialog::directoryListedErrorCallback(Networking::ErrorResponse _navigationLocked = false; _node = _backupNode; _updateList = true; - //TODO: show error message + _showError = true; } } // End of namespace GUI -- cgit v1.2.3 From 438ba985a4a97a8695a6e6fdda6930694976c07b Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Thu, 21 Jul 2016 11:44:36 +0600 Subject: JANITORIAL: Remove spaces at the end of the line I knew there were some, but I wanted to fix them once, instead of doing it all the time. --- gui/remotebrowser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index d176d29b02..49f35edc16 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -67,7 +67,7 @@ RemoteBrowserDialog::~RemoteBrowserDialog() { } } -void RemoteBrowserDialog::open() { +void RemoteBrowserDialog::open() { Dialog::open(); listDirectory(Cloud::StorageFile()); } @@ -176,7 +176,7 @@ void RemoteBrowserDialog::goUp() { if (i == 0 || path[i] == '/' || path[i] == '\\') { path.erase(i); break; - } + } } listDirectory(Cloud::StorageFile(path, 0, 0, true)); -- cgit v1.2.3 From 53aa0c46f1a5d6aefe3f2a087c60d9a59439aedf Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 22 Jul 2016 15:48:46 +0300 Subject: GUI: JANITORIAL: Fix code formatting --- gui/remotebrowser.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'gui/remotebrowser.cpp') diff --git a/gui/remotebrowser.cpp b/gui/remotebrowser.cpp index 49f35edc16..b87fc60f7e 100644 --- a/gui/remotebrowser.cpp +++ b/gui/remotebrowser.cpp @@ -135,8 +135,10 @@ void RemoteBrowserDialog::handleTickle() { void RemoteBrowserDialog::updateListing() { // Update the path display Common::String path = _node.path(); - if (path.empty()) path = "/"; //root - if (_navigationLocked) path = "Loading... " + path; + if (path.empty()) + path = "/"; //root + if (_navigationLocked) + path = "Loading... " + path; _currentPath->setLabel(path); if (!_navigationLocked) { @@ -168,7 +170,8 @@ void RemoteBrowserDialog::goUp() { _rememberedNodeContents.erase(_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()) { _rememberedNodeContents.erase(""); } else { @@ -183,7 +186,8 @@ void RemoteBrowserDialog::goUp() { } void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) { - if (_navigationLocked || _workingRequest) return; + if (_navigationLocked || _workingRequest) + return; if (_rememberedNodeContents.contains(node.path())) { _nodeContent = _rememberedNodeContents[node.path()]; @@ -205,7 +209,8 @@ void RemoteBrowserDialog::listDirectory(Cloud::StorageFile node) { void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryResponse response) { _workingRequest = nullptr; - if (_ignoreCallback) return; + if (_ignoreCallback) + return; _navigationLocked = false; _nodeContent = response.value; @@ -215,7 +220,8 @@ void RemoteBrowserDialog::directoryListedCallback(Cloud::Storage::ListDirectoryR void RemoteBrowserDialog::directoryListedErrorCallback(Networking::ErrorResponse error) { _workingRequest = nullptr; - if (_ignoreCallback) return; + if (_ignoreCallback) + return; _navigationLocked = false; _node = _backupNode; -- cgit v1.2.3