Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into netjob_retry

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-10-16 23:13:53 +03:00
163 changed files with 5973 additions and 1781 deletions

View File

@ -89,4 +89,4 @@ QNetworkReply* Download::getReply(QNetworkRequest& request)
{
return m_network->get(request);
}
} // namespace Net
} // namespace Net

View File

@ -36,13 +36,18 @@
*/
#include "NetJob.h"
#include "Application.h"
#include "tasks/ConcurrentTask.h"
#if defined(LAUNCHER_APPLICATION)
#include "Application.h"
#include "ui/dialogs/CustomMessageBox.h"
#endif
NetJob::NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network)
: ConcurrentTask(nullptr, job_name, APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt()), m_network(network)
{}
NetJob::NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network) : ConcurrentTask(nullptr, job_name), m_network(network)
{
#if defined(LAUNCHER_APPLICATION)
setMaxConcurrent(APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
#endif
}
auto NetJob::addNetAction(NetAction::Ptr action) -> bool
{
@ -140,6 +145,7 @@ void NetJob::updateState()
void NetJob::emitFailed(QString reason)
{
#if defined(LAUNCHER_APPLICATION)
auto response = CustomMessageBox::selectable(nullptr, "Confirm retry",
"The tasks failed\n"
"Failed urls\n" +
@ -155,5 +161,6 @@ void NetJob::emitFailed(QString reason)
startNext();
return;
}
#endif
ConcurrentTask::emitFailed(reason);
}

View File

@ -46,6 +46,7 @@
#if defined(LAUNCHER_APPLICATION)
#include "Application.h"
#endif
#include "BuildConfig.h"
#include "net/NetAction.h"