| 32 | {} |
| 33 | |
| 34 | void 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 | |
| 66 | void ArchiveDownloadTask::extractJava(QString input) |
| 67 | { |
nothing calls this directly
no test coverage detected