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

View file

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