diff options
author | Petr Mrázek <peterix@gmail.com> | 2021-11-21 23:21:12 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2021-11-21 23:21:12 +0100 |
commit | 69213b1206e97f7d4db4270a4b3b0af41dc9e6fc (patch) | |
tree | b53ca69422ce22cceee9e648171a678679075c1a /launcher/modplatform | |
parent | c2c56a2f6ceaedb8a3fa88c848b345db0fec7f9c (diff) | |
download | PrismLauncher-69213b1206e97f7d4db4270a4b3b0af41dc9e6fc.tar.gz PrismLauncher-69213b1206e97f7d4db4270a4b3b0af41dc9e6fc.tar.bz2 PrismLauncher-69213b1206e97f7d4db4270a4b3b0af41dc9e6fc.zip |
NOISSUE continue refactoring things to make tests pass
Diffstat (limited to 'launcher/modplatform')
14 files changed, 87 insertions, 71 deletions
diff --git a/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp b/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp index 66b592bb..9ef32db1 100644 --- a/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp +++ b/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp @@ -1,13 +1,13 @@ -#include <Env.h> -#include <quazip.h> -#include <QtConcurrent/QtConcurrent> -#include <MMCZip.h> -#include <minecraft/OneSixVersionFormat.h> -#include <Version.h> -#include <net/ChecksumValidator.h> #include "ATLPackInstallTask.h" -#include "BuildConfig.h" +#include <QtConcurrent/QtConcurrent> + +#include <quazip.h> + +#include "MMCZip.h" +#include "minecraft/OneSixVersionFormat.h" +#include "Version.h" +#include "net/ChecksumValidator.h" #include "FileSystem.h" #include "Json.h" #include "minecraft/MinecraftInstance.h" @@ -17,6 +17,9 @@ #include "meta/Version.h" #include "meta/VersionList.h" +#include "BuildConfig.h" +#include "Application.h" + namespace ATLauncher { PackInstallTask::PackInstallTask(UserInteractionSupport *support, QString pack, QString version) @@ -43,7 +46,7 @@ void PackInstallTask::executeTask() .arg(m_pack).arg(m_version_name); netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response)); jobPtr = netJob; - jobPtr->start(); + jobPtr->start(APPLICATION->network()); QObject::connect(netJob, &NetJob::succeeded, this, &PackInstallTask::onDownloadSucceeded); QObject::connect(netJob, &NetJob::failed, this, &PackInstallTask::onDownloadFailed); @@ -76,7 +79,7 @@ void PackInstallTask::onDownloadSucceeded() } m_version = version; - auto vlist = ENV->metadataIndex()->get("net.minecraft"); + auto vlist = APPLICATION->metadataIndex()->get("net.minecraft"); if(!vlist) { emitFailed(tr("Failed to get local metadata index for %1").arg("net.minecraft")); @@ -157,7 +160,7 @@ QString PackInstallTask::getDirForModType(ModType type, QString raw) QString PackInstallTask::getVersionForLoader(QString uid) { if(m_version.loader.recommended || m_version.loader.latest || m_version.loader.choose) { - auto vlist = ENV->metadataIndex()->get(uid); + auto vlist = APPLICATION->metadataIndex()->get(uid); if(!vlist) { emitFailed(tr("Failed to get local metadata index for %1").arg(uid)); @@ -409,7 +412,7 @@ void PackInstallTask::installConfigs() auto path = QString("Configs/%1/%2.zip").arg(m_pack).arg(m_version_name); auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.zip") .arg(m_pack).arg(m_version_name); - auto entry = ENV->metacache()->resolveEntry("ATLauncherPacks", path); + auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", path); entry->setStale(true); auto dl = Net::Download::makeCached(url, entry); @@ -438,7 +441,7 @@ void PackInstallTask::installConfigs() setProgress(current, total); }); - jobPtr->start(); + jobPtr->start(APPLICATION->network()); } void PackInstallTask::extractConfigs() @@ -516,7 +519,7 @@ void PackInstallTask::downloadMods() auto cacheName = fileName.completeBaseName() + "-" + mod.md5 + "." + fileName.suffix(); if (mod.type == ModType::Extract || mod.type == ModType::TexturePackExtract || mod.type == ModType::ResourcePackExtract) { - auto entry = ENV->metacache()->resolveEntry("ATLauncherPacks", cacheName); + auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", cacheName); entry->setStale(true); modsToExtract.insert(entry->getFullPath(), mod); @@ -528,7 +531,7 @@ void PackInstallTask::downloadMods() jobPtr->addNetAction(dl); } else if(mod.type == ModType::Decomp) { - auto entry = ENV->metacache()->resolveEntry("ATLauncherPacks", cacheName); + auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", cacheName); entry->setStale(true); modsToDecomp.insert(entry->getFullPath(), mod); @@ -543,7 +546,7 @@ void PackInstallTask::downloadMods() auto relpath = getDirForModType(mod.type, mod.type_raw); if(relpath == Q_NULLPTR) continue; - auto entry = ENV->metacache()->resolveEntry("ATLauncherPacks", cacheName); + auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", cacheName); entry->setStale(true); auto dl = Net::Download::makeCached(url, entry); @@ -558,7 +561,7 @@ void PackInstallTask::downloadMods() modsToCopy[entry->getFullPath()] = path; if(mod.type == ModType::Forge) { - auto vlist = ENV->metadataIndex()->get("net.minecraftforge"); + auto vlist = APPLICATION->metadataIndex()->get("net.minecraftforge"); if(vlist) { auto ver = vlist->getVersion(mod.version); @@ -593,7 +596,7 @@ void PackInstallTask::downloadMods() setProgress(current, total); }); - jobPtr->start(); + jobPtr->start(APPLICATION->network()); } void PackInstallTask::onModsDownloaded() { diff --git a/launcher/modplatform/atlauncher/ATLPackInstallTask.h b/launcher/modplatform/atlauncher/ATLPackInstallTask.h index 39e2b013..f8ea2d54 100644 --- a/launcher/modplatform/atlauncher/ATLPackInstallTask.h +++ b/launcher/modplatform/atlauncher/ATLPackInstallTask.h @@ -74,7 +74,7 @@ private: bool abortable = false; - NetJobPtr jobPtr; + NetJob::Ptr jobPtr; QByteArray response; QString m_pack; diff --git a/launcher/modplatform/flame/FileResolvingTask.cpp b/launcher/modplatform/flame/FileResolvingTask.cpp index 295574f0..06f0cf2b 100644 --- a/launcher/modplatform/flame/FileResolvingTask.cpp +++ b/launcher/modplatform/flame/FileResolvingTask.cpp @@ -5,8 +5,8 @@ namespace { const char * metabase = "https://cursemeta.dries007.net"; } -Flame::FileResolvingTask::FileResolvingTask(Flame::Manifest& toProcess) - : m_toProcess(toProcess) +Flame::FileResolvingTask::FileResolvingTask(shared_qobject_ptr<QNetworkAccessManager> network, Flame::Manifest& toProcess) + : m_network(network), m_toProcess(toProcess) { } @@ -14,7 +14,7 @@ void Flame::FileResolvingTask::executeTask() { setStatus(tr("Resolving mod IDs...")); setProgress(0, m_toProcess.files.size()); - m_dljob.reset(new NetJob("Mod id resolver")); + m_dljob = new NetJob("Mod id resolver"); results.resize(m_toProcess.files.size()); int index = 0; for(auto & file: m_toProcess.files) @@ -27,7 +27,7 @@ void Flame::FileResolvingTask::executeTask() index ++; } connect(m_dljob.get(), &NetJob::finished, this, &Flame::FileResolvingTask::netJobFinished); - m_dljob->start(); + m_dljob->start(m_network); } void Flame::FileResolvingTask::netJobFinished() diff --git a/launcher/modplatform/flame/FileResolvingTask.h b/launcher/modplatform/flame/FileResolvingTask.h index 78a38fcb..5e5adcd7 100644 --- a/launcher/modplatform/flame/FileResolvingTask.h +++ b/launcher/modplatform/flame/FileResolvingTask.h @@ -10,7 +10,7 @@ class FileResolvingTask : public Task { Q_OBJECT public: - explicit FileResolvingTask(Flame::Manifest &toProcess); + explicit FileResolvingTask(shared_qobject_ptr<QNetworkAccessManager> network, Flame::Manifest &toProcess); virtual ~FileResolvingTask() {}; const Flame::Manifest &getResults() const @@ -25,8 +25,9 @@ protected slots: void netJobFinished(); private: /* data */ + shared_qobject_ptr<QNetworkAccessManager> m_network; Flame::Manifest m_toProcess; QVector<QByteArray> results; - NetJobPtr m_dljob; + NetJob::Ptr m_dljob; }; } diff --git a/launcher/modplatform/legacy_ftb/PackFetchTask.cpp b/launcher/modplatform/legacy_ftb/PackFetchTask.cpp index c2ef6436..ecf36188 100644 --- a/launcher/modplatform/legacy_ftb/PackFetchTask.cpp +++ b/launcher/modplatform/legacy_ftb/PackFetchTask.cpp @@ -2,7 +2,8 @@ #include "PrivatePackManager.h" #include <QDomDocument> -#include <BuildConfig.h> +#include "BuildConfig.h" +#include "Application.h" namespace LegacyFTB { @@ -11,21 +12,20 @@ void PackFetchTask::fetch() publicPacks.clear(); thirdPartyPacks.clear(); - NetJob *netJob = new NetJob("LegacyFTB::ModpackFetch"); + jobPtr = new NetJob("LegacyFTB::ModpackFetch"); QUrl publicPacksUrl = QUrl(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/modpacks.xml"); qDebug() << "Downloading public version info from" << publicPacksUrl.toString(); - netJob->addNetAction(Net::Download::makeByteArray(publicPacksUrl, &publicModpacksXmlFileData)); + jobPtr->addNetAction(Net::Download::makeByteArray(publicPacksUrl, &publicModpacksXmlFileData)); QUrl thirdPartyUrl = QUrl(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/thirdparty.xml"); qDebug() << "Downloading thirdparty version info from" << thirdPartyUrl.toString(); - netJob->addNetAction(Net::Download::makeByteArray(thirdPartyUrl, &thirdPartyModpacksXmlFileData)); + jobPtr->addNetAction(Net::Download::makeByteArray(thirdPartyUrl, &thirdPartyModpacksXmlFileData)); - QObject::connect(netJob, &NetJob::succeeded, this, &PackFetchTask::fileDownloadFinished); - QObject::connect(netJob, &NetJob::failed, this, &PackFetchTask::fileDownloadFailed); + QObject::connect(jobPtr.get(), &NetJob::succeeded, this, &PackFetchTask::fileDownloadFinished); + QObject::connect(jobPtr.get(), &NetJob::failed, this, &PackFetchTask::fileDownloadFailed); - jobPtr.reset(netJob); - netJob->start(); + jobPtr->start(m_network); } void PackFetchTask::fetchPrivate(const QStringList & toFetch) @@ -63,7 +63,7 @@ void PackFetchTask::fetchPrivate(const QStringList & toFetch) delete data; }); - job->start(); + job->start(m_network); } } diff --git a/launcher/modplatform/legacy_ftb/PackFetchTask.h b/launcher/modplatform/legacy_ftb/PackFetchTask.h index 3ab32fab..f1667e90 100644 --- a/launcher/modplatform/legacy_ftb/PackFetchTask.h +++ b/launcher/modplatform/legacy_ftb/PackFetchTask.h @@ -13,14 +13,15 @@ class PackFetchTask : public QObject { Q_OBJECT public: - PackFetchTask() = default; + PackFetchTask(shared_qobject_ptr<QNetworkAccessManager> network) : QObject(nullptr), m_network(network) {}; virtual ~PackFetchTask() = default; void fetch(); void fetchPrivate(const QStringList &toFetch); private: - NetJobPtr jobPtr; + shared_qobject_ptr<QNetworkAccessManager> m_network; + NetJob::Ptr jobPtr; QByteArray publicModpacksXmlFileData; QByteArray thirdPartyModpacksXmlFileData; diff --git a/launcher/modplatform/legacy_ftb/PackInstallTask.cpp b/launcher/modplatform/legacy_ftb/PackInstallTask.cpp index 70b0ab94..64aecb39 100644 --- a/launcher/modplatform/legacy_ftb/PackInstallTask.cpp +++ b/launcher/modplatform/legacy_ftb/PackInstallTask.cpp @@ -1,24 +1,25 @@ #include "PackInstallTask.h" -#include "Env.h" -#include "MMCZip.h" +#include <QtConcurrent> +#include "MMCZip.h" #include "BaseInstance.h" #include "FileSystem.h" #include "settings/INISettingsObject.h" #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" #include "minecraft/GradleSpecifier.h" -#include "BuildConfig.h" -#include <QtConcurrent> +#include "BuildConfig.h" +#include "Application.h" namespace LegacyFTB { -PackInstallTask::PackInstallTask(Modpack pack, QString version) +PackInstallTask::PackInstallTask(shared_qobject_ptr<QNetworkAccessManager> network, Modpack pack, QString version) { m_pack = pack; m_version = version; + m_network = network; } void PackInstallTask::executeTask() @@ -31,8 +32,8 @@ void PackInstallTask::downloadPack() setStatus(tr("Downloading zip for %1").arg(m_pack.name)); auto packoffset = QString("%1/%2/%3").arg(m_pack.dir, m_version.replace(".", "_"), m_pack.file); - auto entry = ENV->metacache()->resolveEntry("FTBPacks", packoffset); - NetJob *job = new NetJob("Download FTB Pack"); + auto entry = APPLICATION->metacache()->resolveEntry("FTBPacks", packoffset); + netJobContainer = new NetJob("Download FTB Pack"); entry->setStale(true); QString url; @@ -44,14 +45,13 @@ void PackInstallTask::downloadPack() { url = QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "modpacks/%1").arg(packoffset); } - job->addNetAction(Net::Download::makeCached(url, entry)); + netJobContainer->addNetAction(Net::Download::makeCached(url, entry)); archivePath = entry->getFullPath(); - netJobContainer.reset(job); - connect(job, &NetJob::succeeded, this, &PackInstallTask::onDownloadSucceeded); - connect(job, &NetJob::failed, this, &PackInstallTask::onDownloadFailed); - connect(job, &NetJob::progress, this, &PackInstallTask::onDownloadProgress); - job->start(); + connect(netJobContainer.get(), &NetJob::succeeded, this, &PackInstallTask::onDownloadSucceeded); + connect(netJobContainer.get(), &NetJob::failed, this, &PackInstallTask::onDownloadFailed); + connect(netJobContainer.get(), &NetJob::progress, this, &PackInstallTask::onDownloadProgress); + netJobContainer->start(m_network); progress(1, 4); } diff --git a/launcher/modplatform/legacy_ftb/PackInstallTask.h b/launcher/modplatform/legacy_ftb/PackInstallTask.h index 600f72e7..305635a1 100644 --- a/launcher/modplatform/legacy_ftb/PackInstallTask.h +++ b/launcher/modplatform/legacy_ftb/PackInstallTask.h @@ -8,6 +8,8 @@ #include "meta/VersionList.h" #include "PackHelpers.h" +#include "net/NetJob.h" + #include <nonstd/optional> namespace LegacyFTB { @@ -17,7 +19,7 @@ class PackInstallTask : public InstanceTask Q_OBJECT public: - explicit PackInstallTask(Modpack pack, QString version); + explicit PackInstallTask(shared_qobject_ptr<QNetworkAccessManager> network, Modpack pack, QString version); virtual ~PackInstallTask(){} bool canAbort() const override { return true; } @@ -41,11 +43,12 @@ private slots: void onUnzipCanceled(); private: /* data */ + shared_qobject_ptr<QNetworkAccessManager> m_network; bool abortable = false; std::unique_ptr<QuaZip> m_packZip; QFuture<nonstd::optional<QStringList>> m_extractFuture; QFutureWatcher<nonstd::optional<QStringList>> m_extractFutureWatcher; - NetJobPtr netJobContainer; + NetJob::Ptr netJobContainer; QString archivePath; Modpack m_pack; diff --git a/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp b/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp index 785d3dd6..563b5cfa 100644 --- a/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp +++ b/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp @@ -1,7 +1,5 @@ #include "FTBPackInstallTask.h" -#include "BuildConfig.h" -#include "Env.h" #include "FileSystem.h" #include "Json.h" #include "minecraft/MinecraftInstance.h" @@ -9,6 +7,9 @@ #include "net/ChecksumValidator.h" #include "settings/INISettingsObject.h" +#include "BuildConfig.h" +#include "Application.h" + namespace ModpacksCH { PackInstallTask::PackInstallTask(Modpack pack, QString version) @@ -50,7 +51,7 @@ void PackInstallTask::executeTask() .arg(m_pack.id).arg(version.id); netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response)); jobPtr = netJob; - jobPtr->start(); + jobPtr->start(APPLICATION->network()); QObject::connect(netJob, &NetJob::succeeded, this, &PackInstallTask::onDownloadSucceeded); QObject::connect(netJob, &NetJob::failed, this, &PackInstallTask::onDownloadFailed); @@ -95,14 +96,14 @@ void PackInstallTask::downloadPack() { setStatus(tr("Downloading mods...")); - jobPtr.reset(new NetJob(tr("Mod download"))); + jobPtr = new NetJob(tr("Mod download")); for(auto file : m_version.files) { if(file.serverOnly) continue; QFileInfo fileName(file.name); auto cacheName = fileName.completeBaseName() + "-" + file.sha1 + "." + fileName.suffix(); - auto entry = ENV->metacache()->resolveEntry("ModpacksCHPacks", cacheName); + auto entry = APPLICATION->metacache()->resolveEntry("ModpacksCHPacks", cacheName); entry->setStale(true); auto relpath = FS::PathCombine("minecraft", file.path, file.name); @@ -141,7 +142,7 @@ void PackInstallTask::downloadPack() setProgress(current, total); }); - jobPtr->start(); + jobPtr->start(APPLICATION->network()); } void PackInstallTask::install() diff --git a/launcher/modplatform/modpacksch/FTBPackInstallTask.h b/launcher/modplatform/modpacksch/FTBPackInstallTask.h index fdd84c4e..23362dc9 100644 --- a/launcher/modplatform/modpacksch/FTBPackInstallTask.h +++ b/launcher/modplatform/modpacksch/FTBPackInstallTask.h @@ -32,7 +32,7 @@ private: private: bool abortable = false; - NetJobPtr jobPtr; + NetJob::Ptr jobPtr; QByteArray response; Modpack m_pack; 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; |