mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 17:32:17 -07:00
[Oracle] Don't report a cancelled card database update as successful (#3470)
Took 3 minutes
This commit is contained in:
parent
1ed9823b56
commit
687a012d9b
7 changed files with 43 additions and 9 deletions
|
|
@ -95,5 +95,6 @@ int main(int argc, char *argv[])
|
|||
QTimer::singleShot(0, &wizard, [&wizard]() { wizard.runInBackground(); });
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
const int execResult = app.exec();
|
||||
return wizard.wasCancelled() ? 1 : execResult;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,18 @@ void OracleWizard::accept()
|
|||
QDialog::accept();
|
||||
}
|
||||
|
||||
void OracleWizard::reject()
|
||||
{
|
||||
cancelled = true;
|
||||
|
||||
const auto replies = nam->findChildren<QNetworkReply *>();
|
||||
for (QNetworkReply *reply : replies) {
|
||||
reply->abort();
|
||||
}
|
||||
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void OracleWizard::enableButtons()
|
||||
{
|
||||
button(QWizard::NextButton)->setDisabled(false);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ class OracleWizard : public QWizard
|
|||
public:
|
||||
explicit OracleWizard(QWidget *parent = nullptr);
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
bool wasCancelled()
|
||||
{
|
||||
return cancelled;
|
||||
}
|
||||
void enableButtons();
|
||||
void disableButtons();
|
||||
void retranslateUi();
|
||||
|
|
@ -74,6 +79,7 @@ private:
|
|||
QByteArray tokensData;
|
||||
QString cardSourceUrl;
|
||||
QString cardSourceVersion;
|
||||
bool cancelled = false;
|
||||
|
||||
void migrateOracleSettings();
|
||||
|
||||
|
|
|
|||
|
|
@ -350,6 +350,10 @@ void LoadSetsPage::actDownloadFinishedSetsFile()
|
|||
{
|
||||
// check for a reply
|
||||
auto *reply = dynamic_cast<QNetworkReply *>(sender());
|
||||
if (wizard()->wasCancelled()) {
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
auto errorCode = reply->error();
|
||||
if (errorCode != QNetworkReply::NoError) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Network error: %1.").arg(reply->errorString()));
|
||||
|
|
|
|||
|
|
@ -163,6 +163,10 @@ void SimpleDownloadFilePage::actDownloadFinished()
|
|||
{
|
||||
// check for a reply
|
||||
auto *reply = dynamic_cast<QNetworkReply *>(sender());
|
||||
if (wizard()->wasCancelled()) {
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
QNetworkReply::NetworkError errorCode = reply->error();
|
||||
if (errorCode != QNetworkReply::NoError) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Network error: %1.").arg(reply->errorString()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue