diff options
author | flow <flowlnlnln@gmail.com> | 2022-09-07 08:26:28 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-07 08:26:28 -0300 |
commit | 8e3f5c33057175b83ef276914d81ed4d5616d6e5 (patch) | |
tree | f9459100d3dc7d9abde05272e12fe72e99f35b12 /launcher/ui/pages | |
parent | 3c0a6987cd0163934f2bf85f354d99b06fdffea9 (diff) | |
parent | 064ae49d2b227bbc64c687e2d05fc0554ada6a31 (diff) | |
download | PrismLauncher-8e3f5c33057175b83ef276914d81ed4d5616d6e5.tar.gz PrismLauncher-8e3f5c33057175b83ef276914d81ed4d5616d6e5.tar.bz2 PrismLauncher-8e3f5c33057175b83ef276914d81ed4d5616d6e5.zip |
Merge pull request #966 from flowln/refactor_tasks
Reduce code duplication in tasks, fix some bugs and add some tests
Diffstat (limited to 'launcher/ui/pages')
-rw-r--r-- | launcher/ui/pages/modplatform/ModModel.cpp | 5 | ||||
-rw-r--r-- | launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/launcher/ui/pages/modplatform/ModModel.cpp b/launcher/ui/pages/modplatform/ModModel.cpp index 94b1f099..06a6f6b8 100644 --- a/launcher/ui/pages/modplatform/ModModel.cpp +++ b/launcher/ui/pages/modplatform/ModModel.cpp @@ -230,10 +230,11 @@ void ListModel::searchRequestFinished(QJsonDocument& doc) void ListModel::searchRequestFailed(QString reason) { - if (!jobPtr->first()->m_reply) { + auto failed_action = jobPtr->getFailedActions().at(0); + if (!failed_action->m_reply) { // Network error QMessageBox::critical(nullptr, tr("Error"), tr("A network error occurred. Could not load mods.")); - } else if (jobPtr->first()->m_reply && jobPtr->first()->m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 409) { + } else if (failed_action->m_reply && failed_action->m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 409) { // 409 Gone, notify user to update QMessageBox::critical(nullptr, tr("Error"), //: %1 refers to the launcher itself diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp index 3633d575..614be434 100644 --- a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp +++ b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp @@ -301,10 +301,11 @@ void ModpackListModel::searchRequestFinished(QJsonDocument& doc_all) void ModpackListModel::searchRequestFailed(QString reason) { - if (!jobPtr->first()->m_reply) { + auto failed_action = jobPtr->getFailedActions().at(0); + if (!failed_action->m_reply) { // Network error QMessageBox::critical(nullptr, tr("Error"), tr("A network error occurred. Could not load modpacks.")); - } else if (jobPtr->first()->m_reply && jobPtr->first()->m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 409) { + } else if (failed_action->m_reply && failed_action->m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 409) { // 409 Gone, notify user to update QMessageBox::critical(nullptr, tr("Error"), //: %1 refers to the launcher itself |