diff options
Diffstat (limited to 'backends/cloud/savessyncrequest.cpp')
-rw-r--r-- | backends/cloud/savessyncrequest.cpp | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp index 32b22edcaa..014e6a0ae6 100644 --- a/backends/cloud/savessyncrequest.cpp +++ b/backends/cloud/savessyncrequest.cpp @@ -117,17 +117,15 @@ void SavesSyncRequest::directoryListedCallback(Storage::ListDirectoryResponse re if (i->_value) _filesToUpload.push_back(i->_key); } - /////// - debug("\ndownload files:"); + debug(9, "\ndownload files:"); for (uint32 i = 0; i < _filesToDownload.size(); ++i) { - debug("%s", _filesToDownload[i].name().c_str()); + debug(9, "%s", _filesToDownload[i].name().c_str()); } - debug("\nupload files:"); + debug(9, "\nupload files:"); for (uint32 i = 0; i < _filesToUpload.size(); ++i) { - debug("%s", _filesToUpload[i].c_str()); + debug(9, "%s", _filesToUpload[i].c_str()); } _totalFilesToHandle = _filesToDownload.size() + _filesToUpload.size(); - /////// //start downloading files downloadNextFile(); @@ -162,13 +160,11 @@ void SavesSyncRequest::directoryListedErrorCallback(Networking::ErrorResponse er } } } - - //TODO: Google Drive-related JSON error } delete value; } - //Google Drive-related ScummVM-based error + //Google Drive and Box-related ScummVM-based error if (error.response.contains("subdirectory not found")) { irrecoverable = false; //base "/ScummVM/" folder not found } else if (error.response.contains("no such file found in its parent directory")) { @@ -184,7 +180,7 @@ void SavesSyncRequest::directoryListedErrorCallback(Networking::ErrorResponse er //we're lucky - user just lacks his "/cloud/" folder - let's create one Common::String dir = _storage->savesDirectoryPath(); if (dir.lastChar() == '/') dir.deleteLastChar(); - debug("creating %s", dir.c_str()); + debug(9, "creating %s", dir.c_str()); _workingRequest = _storage->createDirectory(dir, new Common::Callback<SavesSyncRequest, Storage::BoolResponse>(this, &SavesSyncRequest::directoryCreatedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::directoryCreatedErrorCallback) @@ -227,10 +223,8 @@ void SavesSyncRequest::downloadNextFile() { _filesToDownload.pop_back(); sendCommand(GUI::kSavesSyncProgressCmd, (int)(getDownloadingProgress() * 100)); - - /////// - debug("downloading %s (%d %%)", _currentDownloadingFile.name().c_str(), (int)(getProgress() * 100)); - /////// + + debug(9, "downloading %s (%d %%)", _currentDownloadingFile.name().c_str(), (int)(getProgress() * 100)); _workingRequest = _storage->downloadById(_currentDownloadingFile.id(), DefaultSaveFileManager::concatWithSavesPath(_currentDownloadingFile.name()), new Common::Callback<SavesSyncRequest, Storage::BoolResponse>(this, &SavesSyncRequest::fileDownloadedCallback), new Common::Callback<SavesSyncRequest, Networking::ErrorResponse>(this, &SavesSyncRequest::fileDownloadedErrorCallback) @@ -275,10 +269,8 @@ void SavesSyncRequest::uploadNextFile() { _currentUploadingFile = _filesToUpload.back(); _filesToUpload.pop_back(); - - /////// - debug("uploading %s (%d %%)", _currentUploadingFile.c_str(), (int)(getProgress()*100)); - /////// + + debug(9, "uploading %s (%d %%)", _currentUploadingFile.c_str(), (int)(getProgress()*100)); if (_storage->uploadStreamSupported()) { _workingRequest = _storage->upload(_storage->savesDirectoryPath() + _currentUploadingFile, g_system->getSavefileManager()->openRawFile(_currentUploadingFile), new Common::Callback<SavesSyncRequest, Storage::UploadResponse>(this, &SavesSyncRequest::fileUploadedCallback), @@ -318,7 +310,7 @@ void SavesSyncRequest::handle() {} void SavesSyncRequest::restart() { start(); } -double SavesSyncRequest::getDownloadingProgress() { +double SavesSyncRequest::getDownloadingProgress() const { if (_totalFilesToHandle == 0) { if (_state == Networking::FINISHED) return 1; //nothing to upload and download => Request ends soon return 0; //directory not listed yet @@ -331,7 +323,7 @@ double SavesSyncRequest::getDownloadingProgress() { return (double)(totalFilesToDownload - filesLeftToDownload) / (double)(totalFilesToDownload); } -double SavesSyncRequest::getProgress() { +double SavesSyncRequest::getProgress() const { if (_totalFilesToHandle == 0) { if (_state == Networking::FINISHED) return 1; //nothing to upload and download => Request ends soon return 0; //directory not listed yet |