aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-20 13:02:18 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit63311bac267ed0ebacc10068d8ffd2354a5f4371 (patch)
tree4ada46d1e1a2484a3b1575ed4c1a458dd652329c /gui
parent1d78d20fcf59d772688f9f32d81670548d6569f9 (diff)
downloadscummvm-rg350-63311bac267ed0ebacc10068d8ffd2354a5f4371.tar.gz
scummvm-rg350-63311bac267ed0ebacc10068d8ffd2354a5f4371.tar.bz2
scummvm-rg350-63311bac267ed0ebacc10068d8ffd2354a5f4371.zip
GUI: Add error callback in Options' Cloud tab
Shows OSD message.
Diffstat (limited to 'gui')
-rw-r--r--gui/options.cpp19
-rw-r--r--gui/options.h1
2 files changed, 18 insertions, 2 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index f3afd58c96..ac548f53c7 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1624,10 +1624,17 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
case kRefreshStorageCmd:
{
- CloudMan.info(new Common::Callback<GlobalOptionsDialog, Cloud::Storage::StorageInfoResponse>(this, &GlobalOptionsDialog::storageInfoCallback), nullptr);
+ CloudMan.info(
+ new Common::Callback<GlobalOptionsDialog, Cloud::Storage::StorageInfoResponse>(this, &GlobalOptionsDialog::storageInfoCallback),
+ new Common::Callback<GlobalOptionsDialog, Networking::ErrorResponse>(this, &GlobalOptionsDialog::storageErrorCallback)
+ );
Common::String dir = CloudMan.savesDirectoryPath();
if (dir.lastChar() == '/') dir.deleteLastChar();
- CloudMan.listDirectory(dir, new Common::Callback<GlobalOptionsDialog, Cloud::Storage::ListDirectoryResponse>(this, &GlobalOptionsDialog::storageListDirectoryCallback), nullptr);
+ CloudMan.listDirectory(
+ dir,
+ new Common::Callback<GlobalOptionsDialog, Cloud::Storage::ListDirectoryResponse>(this, &GlobalOptionsDialog::storageListDirectoryCallback),
+ new Common::Callback<GlobalOptionsDialog, Networking::ErrorResponse>(this, &GlobalOptionsDialog::storageErrorCallback)
+ );
break;
}
case kDownloadStorageCmd:
@@ -1825,6 +1832,14 @@ void GlobalOptionsDialog::storageListDirectoryCallback(Cloud::Storage::ListDirec
CloudMan.setStorageUsedSpace(CloudMan.getStorageIndex(), totalSize);
_redrawCloudTab = true;
}
+
+void GlobalOptionsDialog::storageErrorCallback(Networking::ErrorResponse response) {
+ debug("error response (%s, %ld):", (response.failed ? "failed" : "interrupted"), response.httpResponseCode);
+ debug("%s", response.response.c_str());
+
+ if (!response.interrupted)
+ g_system->displayMessageOnOSD(_("Request failed.\nCheck your Internet connection."));
+}
#endif
} // End of namespace GUI
diff --git a/gui/options.h b/gui/options.h
index e68778cf8e..a7e98adff6 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -277,6 +277,7 @@ protected:
#ifdef USE_LIBCURL
void storageInfoCallback(Cloud::Storage::StorageInfoResponse response);
void storageListDirectoryCallback(Cloud::Storage::ListDirectoryResponse response);
+ void storageErrorCallback(Networking::ErrorResponse response);
#endif
};