mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
GUI: Add error callback in Options' Cloud tab
Shows OSD message.
This commit is contained in:
parent
1d78d20fcf
commit
63311bac26
@ -1624,10 +1624,17 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
|||||||
}
|
}
|
||||||
case kRefreshStorageCmd:
|
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();
|
Common::String dir = CloudMan.savesDirectoryPath();
|
||||||
if (dir.lastChar() == '/') dir.deleteLastChar();
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case kDownloadStorageCmd:
|
case kDownloadStorageCmd:
|
||||||
@ -1825,6 +1832,14 @@ void GlobalOptionsDialog::storageListDirectoryCallback(Cloud::Storage::ListDirec
|
|||||||
CloudMan.setStorageUsedSpace(CloudMan.getStorageIndex(), totalSize);
|
CloudMan.setStorageUsedSpace(CloudMan.getStorageIndex(), totalSize);
|
||||||
_redrawCloudTab = true;
|
_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
|
#endif
|
||||||
|
|
||||||
} // End of namespace GUI
|
} // End of namespace GUI
|
||||||
|
@ -277,6 +277,7 @@ protected:
|
|||||||
#ifdef USE_LIBCURL
|
#ifdef USE_LIBCURL
|
||||||
void storageInfoCallback(Cloud::Storage::StorageInfoResponse response);
|
void storageInfoCallback(Cloud::Storage::StorageInfoResponse response);
|
||||||
void storageListDirectoryCallback(Cloud::Storage::ListDirectoryResponse response);
|
void storageListDirectoryCallback(Cloud::Storage::ListDirectoryResponse response);
|
||||||
|
void storageErrorCallback(Networking::ErrorResponse response);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user