mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-05 04:46:57 +03:00
Backport new NetJob failure dialog from Octol1ttle's libcurl PR
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com> Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
c16a25faef
commit
e6d7e5cdae
5 changed files with 221 additions and 11 deletions
|
|
@ -42,7 +42,7 @@
|
|||
#if defined(LAUNCHER_APPLICATION)
|
||||
#include "Application.h"
|
||||
#include "settings/SettingsObject.h"
|
||||
#include "ui/dialogs/CustomMessageBox.h"
|
||||
#include "ui/dialogs/NetworkJobFailedDialog.h"
|
||||
#endif
|
||||
|
||||
NetJob::NetJob(QString job_name, QNetworkAccessManager* network, int max_concurrent) : ConcurrentTask(job_name), m_network(network)
|
||||
|
|
@ -164,23 +164,23 @@ void NetJob::emitFailed(QString reason)
|
|||
|
||||
if (APPLICATION_DYN && m_ask_retry && m_manual_try < APPLICATION->settings()->get("NumberOfManualRetries").toInt() && isOnline()) {
|
||||
m_manual_try++;
|
||||
auto response = CustomMessageBox::selectable(nullptr, "Confirm retry",
|
||||
"The tasks failed.\n"
|
||||
"Failed urls\n" +
|
||||
getFailedFiles().join("\n\t") +
|
||||
".\n"
|
||||
"If this continues to happen please check the logs of the application.\n"
|
||||
"Do you want to retry?",
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
auto failed = getFailedActions();
|
||||
auto dialog = NetworkJobFailedDialog(objectName(), m_try, m_done.size(), failed.size(), nullptr);
|
||||
|
||||
if (response == QMessageBox::Yes) {
|
||||
int i = 0;
|
||||
for (const auto& request : failed) {
|
||||
dialog.addFailedRequest(i, request->url(), request->errorString());
|
||||
++i;
|
||||
}
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
m_try = 0;
|
||||
executeNextSubTask();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ConcurrentTask::emitFailed(reason);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue