GUI: Better error handling in icons downloader

This commit is contained in:
Eugene Sandulenko 2021-11-17 12:50:26 +01:00
parent 192b05930a
commit f23e41d346
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 10 additions and 1 deletions

View File

@ -71,6 +71,7 @@ DownloadIconsDialog::DownloadIconsDialog() :
_cancelButton = new ButtonWidget(this, "GlobalOptions_DownloadIconsDialog.MainButton", _c("Cancel download", "lowres"), Common::U32String(), kDownloadIconsDialogButtonCmd);
_closeButton = new ButtonWidget(this, "GlobalOptions_DownloadIconsDialog.CloseButton", _("Hide"), Common::U32String(), kCloseCmd);
_closeButton->setEnabled(false);
refreshWidgets();
CloudMan.setDownloadTarget(this);
@ -196,8 +197,14 @@ void DownloadIconsDialog::downloadListCallback(Networking::DataResponse response
sendCommand(kListEndedCmd, 0);
}
void DownloadIconsDialog::setError(Common::U32String &msg) {
_errorText->setLabel(msg);
}
void DownloadIconsDialog::errorCallback(Networking::ErrorResponse error) {
warning("Error %ld: %s", error.httpResponseCode, error.response.c_str());
Common::U32String message = Common::U32String::format(_("ERROR %d: %s"), error.httpResponseCode, error.response.c_str());
g_dialog->setError(message);
}
void DownloadIconsDialog::downloadList() {

View File

@ -73,6 +73,8 @@ public:
void downloadListCallback(Networking::DataResponse response);
void errorCallback(Networking::ErrorResponse error);
void setError(Common::U32String &msg);
private:
void downloadList();
void calculateList();