aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/technic
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/modplatform/technic')
-rw-r--r--launcher/modplatform/technic/SingleZipPackInstallTask.cpp11
-rw-r--r--launcher/modplatform/technic/SingleZipPackInstallTask.h2
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.cpp14
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.h6
4 files changed, 20 insertions, 13 deletions
diff --git a/launcher/modplatform/technic/SingleZipPackInstallTask.cpp b/launcher/modplatform/technic/SingleZipPackInstallTask.cpp
index f2aa37a0..0ab9f3c0 100644
--- a/launcher/modplatform/technic/SingleZipPackInstallTask.cpp
+++ b/launcher/modplatform/technic/SingleZipPackInstallTask.cpp
@@ -15,12 +15,13 @@
#include "SingleZipPackInstallTask.h"
-#include "Env.h"
+#include <QtConcurrent>
+
#include "MMCZip.h"
#include "TechnicPackProcessor.h"
+#include "FileSystem.h"
-#include <QtConcurrent>
-#include <FileSystem.h>
+#include "Application.h"
Technic::SingleZipPackInstallTask::SingleZipPackInstallTask(const QUrl &sourceUrl, const QString &minecraftVersion)
{
@@ -41,7 +42,7 @@ void Technic::SingleZipPackInstallTask::executeTask()
setStatus(tr("Downloading modpack:\n%1").arg(m_sourceUrl.toString()));
const QString path = m_sourceUrl.host() + '/' + m_sourceUrl.path();
- auto entry = ENV->metacache()->resolveEntry("general", path);
+ auto entry = APPLICATION->metacache()->resolveEntry("general", path);
entry->setStale(true);
m_filesNetJob.reset(new NetJob(tr("Modpack download")));
m_filesNetJob->addNetAction(Net::Download::makeCached(m_sourceUrl, entry));
@@ -50,7 +51,7 @@ void Technic::SingleZipPackInstallTask::executeTask()
connect(job, &NetJob::succeeded, this, &Technic::SingleZipPackInstallTask::downloadSucceeded);
connect(job, &NetJob::progress, this, &Technic::SingleZipPackInstallTask::downloadProgressChanged);
connect(job, &NetJob::failed, this, &Technic::SingleZipPackInstallTask::downloadFailed);
- m_filesNetJob->start();
+ m_filesNetJob->start(APPLICATION->network());
}
void Technic::SingleZipPackInstallTask::downloadSucceeded()
diff --git a/launcher/modplatform/technic/SingleZipPackInstallTask.h b/launcher/modplatform/technic/SingleZipPackInstallTask.h
index 80f10a98..74f60941 100644
--- a/launcher/modplatform/technic/SingleZipPackInstallTask.h
+++ b/launcher/modplatform/technic/SingleZipPackInstallTask.h
@@ -55,7 +55,7 @@ private:
QUrl m_sourceUrl;
QString m_minecraftVersion;
QString m_archivePath;
- NetJobPtr m_filesNetJob;
+ NetJob::Ptr m_filesNetJob;
std::unique_ptr<QuaZip> m_packZip;
QFuture<nonstd::optional<QStringList>> m_extractFuture;
QFutureWatcher<nonstd::optional<QStringList>> m_extractFutureWatcher;
diff --git a/launcher/modplatform/technic/SolderPackInstallTask.cpp b/launcher/modplatform/technic/SolderPackInstallTask.cpp
index 1b4186d4..2492ee81 100644
--- a/launcher/modplatform/technic/SolderPackInstallTask.cpp
+++ b/launcher/modplatform/technic/SolderPackInstallTask.cpp
@@ -21,10 +21,14 @@
#include <MMCZip.h>
#include "TechnicPackProcessor.h"
-Technic::SolderPackInstallTask::SolderPackInstallTask(const QUrl &sourceUrl, const QString &minecraftVersion)
-{
+Technic::SolderPackInstallTask::SolderPackInstallTask(
+ shared_qobject_ptr<QNetworkAccessManager> network,
+ const QUrl &sourceUrl,
+ const QString &minecraftVersion
+) {
m_sourceUrl = sourceUrl;
m_minecraftVersion = minecraftVersion;
+ m_network = network;
}
bool Technic::SolderPackInstallTask::abort() {
@@ -43,7 +47,7 @@ void Technic::SolderPackInstallTask::executeTask()
auto job = m_filesNetJob.get();
connect(job, &NetJob::succeeded, this, &Technic::SolderPackInstallTask::versionSucceeded);
connect(job, &NetJob::failed, this, &Technic::SolderPackInstallTask::downloadFailed);
- m_filesNetJob->start();
+ m_filesNetJob->start(m_network);
}
void Technic::SolderPackInstallTask::versionSucceeded()
@@ -68,7 +72,7 @@ void Technic::SolderPackInstallTask::versionSucceeded()
auto job = m_filesNetJob.get();
connect(job, &NetJob::succeeded, this, &Technic::SolderPackInstallTask::fileListSucceeded);
connect(job, &NetJob::failed, this, &Technic::SolderPackInstallTask::downloadFailed);
- m_filesNetJob->start();
+ m_filesNetJob->start(m_network);
}
void Technic::SolderPackInstallTask::fileListSucceeded()
@@ -109,7 +113,7 @@ void Technic::SolderPackInstallTask::fileListSucceeded()
connect(m_filesNetJob.get(), &NetJob::succeeded, this, &Technic::SolderPackInstallTask::downloadSucceeded);
connect(m_filesNetJob.get(), &NetJob::progress, this, &Technic::SolderPackInstallTask::downloadProgressChanged);
connect(m_filesNetJob.get(), &NetJob::failed, this, &Technic::SolderPackInstallTask::downloadFailed);
- m_filesNetJob->start();
+ m_filesNetJob->start(m_network);
}
void Technic::SolderPackInstallTask::downloadSucceeded()
diff --git a/launcher/modplatform/technic/SolderPackInstallTask.h b/launcher/modplatform/technic/SolderPackInstallTask.h
index 6e1057eb..9b2058d8 100644
--- a/launcher/modplatform/technic/SolderPackInstallTask.h
+++ b/launcher/modplatform/technic/SolderPackInstallTask.h
@@ -27,7 +27,7 @@ namespace Technic
{
Q_OBJECT
public:
- explicit SolderPackInstallTask(const QUrl &sourceUrl, const QString &minecraftVersion);
+ explicit SolderPackInstallTask(shared_qobject_ptr<QNetworkAccessManager> network, const QUrl &sourceUrl, const QString &minecraftVersion);
bool canAbort() const override { return true; }
bool abort() override;
@@ -48,7 +48,9 @@ namespace Technic
private:
bool m_abortable = false;
- NetJobPtr m_filesNetJob;
+ shared_qobject_ptr<QNetworkAccessManager> m_network;
+
+ NetJob::Ptr m_filesNetJob;
QUrl m_sourceUrl;
QString m_minecraftVersion;
QByteArray m_response;