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

Method executeTask

launcher/InstanceImportTask.cpp:76–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76void InstanceImportTask::executeTask()
77{
78 setAbortable(true);
79
80 if (m_sourceUrl.isLocalFile()) {
81 m_archivePath = m_sourceUrl.toLocalFile();
82 processZipPack();
83 } else {
84 setStatus(tr("Downloading modpack:\n%1").arg(m_sourceUrl.toString()));
85 m_downloadRequired = true;
86
87 const QString path(m_sourceUrl.host() + '/' + m_sourceUrl.path());
88
89 auto entry = APPLICATION->metacache()->resolveEntry("general", path);
90 entry->setStale(true);
91 m_archivePath = entry->getFullPath();
92
93 m_filesNetJob = new NetJob(tr("Modpack download"), APPLICATION->network());
94 m_filesNetJob->addNetAction(Net::Download::makeCached(m_sourceUrl, entry));
95
96 connect(m_filesNetJob.get(), &NetJob::succeeded, this, &InstanceImportTask::downloadSucceeded);
97 connect(m_filesNetJob.get(), &NetJob::progress, this, &InstanceImportTask::downloadProgressChanged);
98 connect(m_filesNetJob.get(), &NetJob::failed, this, &InstanceImportTask::downloadFailed);
99 connect(m_filesNetJob.get(), &NetJob::aborted, this, &InstanceImportTask::downloadAborted);
100
101 m_filesNetJob->start();
102 }
103}
104
105void InstanceImportTask::downloadSucceeded()
106{

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected