diff options
author | Alexander Tkachev | 2016-07-14 15:45:03 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 85adefdb86e914a789a0db18c767c8ef5902f846 (patch) | |
tree | db1dd930577f5b5ea729f66d1465c95981d725c2 | |
parent | 479c76bbd2752f0bf2d1bab2a00cb7dd1544d1a8 (diff) | |
download | scummvm-rg350-85adefdb86e914a789a0db18c767c8ef5902f846.tar.gz scummvm-rg350-85adefdb86e914a789a0db18c767c8ef5902f846.tar.bz2 scummvm-rg350-85adefdb86e914a789a0db18c767c8ef5902f846.zip |
CLOUD: Update FolderDownloadRequest::getProgress()
It now is based on downloaded size, not number of files.
-rw-r--r-- | backends/cloud/folderdownloadrequest.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/backends/cloud/folderdownloadrequest.cpp b/backends/cloud/folderdownloadrequest.cpp index ca3f9a1c99..6a7b5d3aaf 100644 --- a/backends/cloud/folderdownloadrequest.cpp +++ b/backends/cloud/folderdownloadrequest.cpp @@ -149,18 +149,8 @@ void FolderDownloadRequest::finishDownload(Common::Array<StorageFile> &files) { } double FolderDownloadRequest::getProgress() const { - if (_totalFiles == 0) return 0; - - double currentFileProgress = 0; - DownloadRequest *downloadRequest = dynamic_cast<DownloadRequest *>(_workingRequest); - if (downloadRequest != nullptr) currentFileProgress = downloadRequest->getProgress(); - else { - Id::IdDownloadRequest *idDownloadRequest = dynamic_cast<Id::IdDownloadRequest *>(_workingRequest); - if (idDownloadRequest != nullptr) currentFileProgress = idDownloadRequest->getProgress(); - } - - uint32 uploadedFiles = _totalFiles - _pendingFiles.size() - 1; // -1 because currently downloaded file is already removed from _pendingFiles - return (double)(uploadedFiles + currentFileProgress) / (double)(_totalFiles); + if (_totalFiles == 0 || _totalBytes == 0) return 0; + return (double)getDownloadedBytes() / (double)getTotalBytesToDownload(); } uint64 FolderDownloadRequest::getDownloadedBytes() const { |