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

Method loadVersionInfo

launcher/updater/DownloadTask.cpp:46–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void DownloadTask::loadVersionInfo()
47{
48 setStatus(tr("Loading version information..."));
49
50 NetJob *netJob = new NetJob("Version Info", m_network);
51
52 // Find the index URL.
53 QUrl newIndexUrl = QUrl(m_status.newRepoUrl).resolved(QString::number(m_status.newVersionId) + ".json");
54 qDebug() << m_status.newRepoUrl << " turns into " << newIndexUrl;
55
56 netJob->addNetAction(m_newVersionFileListDownload = Net::Download::makeByteArray(newIndexUrl, &newVersionFileListData));
57
58 // If we have a current version URL, get that one too.
59 if (!m_status.currentRepoUrl.isEmpty())
60 {
61 QUrl cIndexUrl = QUrl(m_status.currentRepoUrl).resolved(QString::number(m_status.currentVersionId) + ".json");
62 netJob->addNetAction(m_currentVersionFileListDownload = Net::Download::makeByteArray(cIndexUrl, &currentVersionFileListData));
63 qDebug() << m_status.currentRepoUrl << " turns into " << cIndexUrl;
64 }
65
66 // connect signals and start the job
67 connect(netJob, &NetJob::succeeded, this, &DownloadTask::processDownloadedVersionInfo);
68 connect(netJob, &NetJob::failed, this, &DownloadTask::vinfoDownloadFailed);
69 m_vinfoNetJob.reset(netJob);
70 netJob->start();
71}
72
73void DownloadTask::vinfoDownloadFailed()
74{

Callers

nothing calls this directly

Calls 5

QUrlClass · 0.85
addNetActionMethod · 0.80
isEmptyMethod · 0.80
resetMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected