MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / executeTask

Method executeTask

launcher/java/download/ArchiveDownloadTask.cpp:34–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32{}
33
34void ArchiveDownloadTask::executeTask()
35{
36 // JRE found ! download the zip
37 setStatus(tr("Downloading Java"));
38
39 MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("java", m_url.fileName());
40
41 auto download = makeShared<NetJob>(QString("JRE::DownloadJava"), APPLICATION->network());
42 auto action = Net::Download::makeCached(m_url, entry);
43 if (!m_checksum_hash.isEmpty() && !m_checksum_type.isEmpty()) {
44 auto hashType = QCryptographicHash::Algorithm::Sha1;
45 if (m_checksum_type == "sha256") {
46 hashType = QCryptographicHash::Algorithm::Sha256;
47 }
48 action->addValidator(new Net::ChecksumValidator(hashType, QByteArray::fromHex(m_checksum_hash.toUtf8())));
49 }
50 download->addNetAction(action);
51 auto fullPath = entry->getFullPath();
52
53 connect(download.get(), &Task::failed, this, &ArchiveDownloadTask::emitFailed);
54 connect(download.get(), &Task::progress, this, &ArchiveDownloadTask::setProgress);
55 connect(download.get(), &Task::stepProgress, this, &ArchiveDownloadTask::propagateStepProgress);
56 connect(download.get(), &Task::status, this, &ArchiveDownloadTask::setStatus);
57 connect(download.get(), &Task::details, this, &ArchiveDownloadTask::setDetails);
58 connect(download.get(), &Task::succeeded, [this, fullPath] {
59 // This should do all of the extracting and creating folders
60 extractJava(fullPath);
61 });
62 m_task = download;
63 m_task->start();
64}
65
66void ArchiveDownloadTask::extractJava(QString input)
67{

Callers

nothing calls this directly

Calls 10

QStringClass · 0.85
resolveEntryMethod · 0.80
metacacheMethod · 0.80
networkMethod · 0.80
addNetActionMethod · 0.80
getFullPathMethod · 0.80
isEmptyMethod · 0.45
addValidatorMethod · 0.45
getMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected