GUI: Add Refresh button in Options Cloud tab

Commit changes CloudManager and Storages so they would automatically
refresh the fields when the could.
This commit is contained in:
Alexander Tkachev 2016-06-09 18:49:17 +06:00
parent beb168a3a5
commit e6242b0be8
11 changed files with 167 additions and 62 deletions

View file

@ -135,6 +135,7 @@ void CloudManager::replaceStorage(Storage *storage, uint32 index) {
_activeStorage = storage;
_currentStorageIndex = index;
save();
if (_activeStorage) _activeStorage->info(nullptr, nullptr); //automatically calls setStorageUsername()
}
Storage *CloudManager::getCurrentStorage() const {
@ -209,6 +210,34 @@ void CloudManager::printBool(Storage::BoolResponse response) const {
debug("bool = %s", (response.value ? "true" : "false"));
}
Networking::Request *CloudManager::listDirectory(Common::String path, Storage::ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive) {
Storage *storage = getCurrentStorage();
if (storage) storage->listDirectory(path, callback, errorCallback, recursive);
else {
delete callback;
delete errorCallback;
//TODO: should we call errorCallback?
}
return nullptr;
}
Networking::Request *CloudManager::info(Storage::StorageInfoCallback callback, Networking::ErrorCallback errorCallback) {
Storage *storage = getCurrentStorage();
if (storage) storage->info(callback, errorCallback);
else {
delete callback;
delete errorCallback;
//TODO: should we call errorCallback?
}
return nullptr;
}
Common::String CloudManager::savesDirectoryPath() {
Storage *storage = getCurrentStorage();
if (storage) return storage->savesDirectoryPath();
return "";
}
SavesSyncRequest *CloudManager::syncSaves(Storage::BoolCallback callback, Networking::ErrorCallback errorCallback) {
Storage *storage = getCurrentStorage();
if (storage) {