diff options
author | Alexander Tkachev | 2016-07-04 14:06:34 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 8972f28bc17b6d2f6fee69adcb025c9a561e851f (patch) | |
tree | 68c5e4c40dfba2168fb7cb9c1a8bd2f6d3174ba3 /gui | |
parent | a37c63998671ad8a341e1b88aead758f408e5fc2 (diff) | |
download | scummvm-rg350-8972f28bc17b6d2f6fee69adcb025c9a561e851f.tar.gz scummvm-rg350-8972f28bc17b6d2f6fee69adcb025c9a561e851f.tar.bz2 scummvm-rg350-8972f28bc17b6d2f6fee69adcb025c9a561e851f.zip |
GUI: Add RemoteBrowser file list sorting
Because Dropbox has no means to specify files order.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/remotebrowser.cpp | 1 | ||||
-rw-r--r-- | gui/remotebrowser.h | 10 |
2 files changed, 11 insertions, 0 deletions
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; } diff --git a/gui/remotebrowser.h b/gui/remotebrowser.h index 0137c32dc0..be416154a1 100644 --- a/gui/remotebrowser.h +++ b/gui/remotebrowser.h @@ -66,6 +66,16 @@ protected: void listDirectory(Cloud::StorageFile node); void directoryListedCallback(Cloud::Storage::ListDirectoryResponse response); void directoryListedErrorCallback(Networking::ErrorResponse error); + + struct FileListOrder : public Common::BinaryFunction<Cloud::StorageFile, Cloud::StorageFile, bool> { + bool operator()(const Cloud::StorageFile &x, const Cloud::StorageFile &y) const { + if (x.isDirectory() != y.isDirectory()) { + return x.isDirectory(); //x < y (directory < not directory) or x > y (not directory > directory) + } + + return x.name() < y.name(); + } + }; }; } // End of namespace GUI |