MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / ModDownloadTask

Method ModDownloadTask

launcher/ModDownloadTask.cpp:25–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include "minecraft/mod/ModFolderModel.h"
24
25ModDownloadTask::ModDownloadTask(ModPlatform::IndexedPack mod, ModPlatform::IndexedVersion version, const std::shared_ptr<ModFolderModel> mods, bool is_indexed)
26 : m_mod(mod), m_mod_version(version), mods(mods)
27{
28 if (is_indexed) {
29 m_update_task.reset(new LocalModUpdateTask(mods->indexDir(), m_mod, m_mod_version));
30 connect(m_update_task.get(), &LocalModUpdateTask::hasOldMod, this, &ModDownloadTask::hasOldMod);
31
32 addTask(m_update_task);
33 }
34
35 m_filesNetJob.reset(new NetJob(tr("Mod download"), APPLICATION->network()));
36 m_filesNetJob->setStatus(tr("Downloading mod:\n%1").arg(m_mod_version.downloadUrl));
37
38 m_filesNetJob->addNetAction(Net::Download::makeFile(m_mod_version.downloadUrl, mods->dir().absoluteFilePath(getFilename())));
39 connect(m_filesNetJob.get(), &NetJob::succeeded, this, &ModDownloadTask::downloadSucceeded);
40 connect(m_filesNetJob.get(), &NetJob::progress, this, &ModDownloadTask::downloadProgressChanged);
41 connect(m_filesNetJob.get(), &NetJob::failed, this, &ModDownloadTask::downloadFailed);
42
43 addTask(m_filesNetJob);
44}
45
46void ModDownloadTask::downloadSucceeded()
47{

Callers

nothing calls this directly

Calls 7

networkMethod · 0.80
addNetActionMethod · 0.80
dirMethod · 0.80
resetMethod · 0.45
indexDirMethod · 0.45
getMethod · 0.45
setStatusMethod · 0.45

Tested by

no test coverage detected