MCPcopy Create free account
hub / github.com/MultiMC/Launcher / executeTask

Method executeTask

launcher/InstanceImportTask.cpp:43–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void InstanceImportTask::executeTask()
44{
45 if (m_sourceUrl.isLocalFile())
46 {
47 m_archivePath = m_sourceUrl.toLocalFile();
48 processZipPack();
49 }
50 else
51 {
52 setStatus(tr("Downloading modpack:\n%1").arg(m_sourceUrl.toString()));
53 m_downloadRequired = true;
54
55 const QString path = m_sourceUrl.host() + '/' + m_sourceUrl.path();
56 auto entry = APPLICATION->metacache()->resolveEntry("general", path);
57 entry->setStale(true);
58 m_filesNetJob.reset(new NetJob(tr("Modpack download")));
59 m_filesNetJob->addNetAction(Net::Download::makeCached(m_sourceUrl, entry));
60 m_archivePath = entry->getFullPath();
61 auto job = m_filesNetJob.get();
62 connect(job, &NetJob::succeeded, this, &InstanceImportTask::downloadSucceeded);
63 connect(job, &NetJob::progress, this, &InstanceImportTask::downloadProgressChanged);
64 connect(job, &NetJob::failed, this, &InstanceImportTask::downloadFailed);
65 m_filesNetJob->start(APPLICATION->network());
66 }
67}
68
69void InstanceImportTask::downloadSucceeded()
70{

Callers

nothing calls this directly

Calls 11

pathMethod · 0.80
resolveEntryMethod · 0.80
metacacheMethod · 0.80
addNetActionMethod · 0.80
getFullPathMethod · 0.80
networkMethod · 0.80
toStringMethod · 0.45
setStaleMethod · 0.45
resetMethod · 0.45
getMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected