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

Method executeTask

launcher/InstanceImportTask.cpp:46–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected