CLOUD: Rename _files to _pendingFiles in FolderDownloadRequest

This commit is contained in:
Peter Bozsó 2016-07-14 10:00:34 +02:00 committed by Alexander Tkachev
parent d8a43cf290
commit 7951a2ea16
2 changed files with 8 additions and 8 deletions

View file

@ -47,7 +47,7 @@ void FolderDownloadRequest::start() {
_ignoreCallback = true; _ignoreCallback = true;
if (_workingRequest) _workingRequest->finish(); if (_workingRequest) _workingRequest->finish();
_currentFile = StorageFile(); _currentFile = StorageFile();
_files.clear(); _pendingFiles.clear();
_failedFiles.clear(); _failedFiles.clear();
_ignoreCallback = false; _ignoreCallback = false;
_totalFiles = 0; _totalFiles = 0;
@ -64,8 +64,8 @@ void FolderDownloadRequest::start() {
void FolderDownloadRequest::directoryListedCallback(Storage::ListDirectoryResponse response) { void FolderDownloadRequest::directoryListedCallback(Storage::ListDirectoryResponse response) {
_workingRequest = nullptr; _workingRequest = nullptr;
if (_ignoreCallback) return; if (_ignoreCallback) return;
_files = response.value; _pendingFiles = response.value;
_totalFiles = _files.size(); _totalFiles = _pendingFiles.size();
downloadNextFile(); downloadNextFile();
} }
@ -90,13 +90,13 @@ void FolderDownloadRequest::fileDownloadedErrorCallback(Networking::ErrorRespons
void FolderDownloadRequest::downloadNextFile() { void FolderDownloadRequest::downloadNextFile() {
do { do {
if (_files.empty()) { if (_pendingFiles.empty()) {
finishDownload(_failedFiles); finishDownload(_failedFiles);
return; return;
} }
_currentFile = _files.back(); _currentFile = _pendingFiles.back();
_files.pop_back(); _pendingFiles.pop_back();
} while (_currentFile.isDirectory()); //TODO: may be create these directories (in case those are empty) } while (_currentFile.isDirectory()); //TODO: may be create these directories (in case those are empty)
sendCommand(GUI::kDownloadProgressCmd, (int)(getProgress() * 100)); sendCommand(GUI::kDownloadProgressCmd, (int)(getProgress() * 100));
@ -146,7 +146,7 @@ double FolderDownloadRequest::getProgress() const {
if (idDownloadRequest != nullptr) currentFileProgress = idDownloadRequest->getProgress(); if (idDownloadRequest != nullptr) currentFileProgress = idDownloadRequest->getProgress();
} }
return (double)(_totalFiles - _files.size() + currentFileProgress) / (double)(_totalFiles); return (double)(_totalFiles - _pendingFiles.size() + currentFileProgress) / (double)(_totalFiles);
} }
} // End of namespace Cloud } // End of namespace Cloud

View file

@ -35,7 +35,7 @@ class FolderDownloadRequest: public Networking::Request, public GUI::CommandSend
Storage::FileArrayCallback _fileArrayCallback; Storage::FileArrayCallback _fileArrayCallback;
Common::String _remoteDirectoryPath, _localDirectoryPath; Common::String _remoteDirectoryPath, _localDirectoryPath;
bool _recursive; bool _recursive;
Common::Array<StorageFile> _files, _failedFiles; Common::Array<StorageFile> _pendingFiles, _failedFiles;
StorageFile _currentFile; StorageFile _currentFile;
Request *_workingRequest; Request *_workingRequest;
bool _ignoreCallback; bool _ignoreCallback;