From 85adefdb86e914a789a0db18c767c8ef5902f846 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Thu, 14 Jul 2016 15:45:03 +0600 Subject: CLOUD: Update FolderDownloadRequest::getProgress() It now is based on downloaded size, not number of files. --- backends/cloud/folderdownloadrequest.cpp | 14 ++------------ 1 file 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 &files) { } double FolderDownloadRequest::getProgress() const { - if (_totalFiles == 0) return 0; - - double currentFileProgress = 0; - DownloadRequest *downloadRequest = dynamic_cast(_workingRequest); - if (downloadRequest != nullptr) currentFileProgress = downloadRequest->getProgress(); - else { - Id::IdDownloadRequest *idDownloadRequest = dynamic_cast(_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 { -- cgit v1.2.3