| 445 | } |
| 446 | |
| 447 | void PackInstallTask::installConfigs() |
| 448 | { |
| 449 | qDebug() << "PackInstallTask::installConfigs: " << QThread::currentThreadId(); |
| 450 | setStatus(tr("Downloading configs...")); |
| 451 | jobPtr = new NetJob(tr("Config download"), APPLICATION->network()); |
| 452 | |
| 453 | auto path = QString("Configs/%1/%2.zip").arg(m_pack).arg(m_version_name); |
| 454 | auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.zip") |
| 455 | .arg(m_pack).arg(m_version_name); |
| 456 | auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", path); |
| 457 | entry->setStale(true); |
| 458 | |
| 459 | auto dl = Net::Download::makeCached(url, entry); |
| 460 | if (!m_version.configs.sha1.isEmpty()) { |
| 461 | auto rawSha1 = QByteArray::fromHex(m_version.configs.sha1.toLatin1()); |
| 462 | dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawSha1)); |
| 463 | } |
| 464 | jobPtr->addNetAction(dl); |
| 465 | archivePath = entry->getFullPath(); |
| 466 | |
| 467 | connect(jobPtr.get(), &NetJob::succeeded, this, [&]() |
| 468 | { |
| 469 | abortable = false; |
| 470 | jobPtr.reset(); |
| 471 | extractConfigs(); |
| 472 | }); |
| 473 | connect(jobPtr.get(), &NetJob::failed, [&](QString reason) |
| 474 | { |
| 475 | abortable = false; |
| 476 | jobPtr.reset(); |
| 477 | emitFailed(reason); |
| 478 | }); |
| 479 | connect(jobPtr.get(), &NetJob::progress, [&](qint64 current, qint64 total) |
| 480 | { |
| 481 | abortable = true; |
| 482 | setProgress(current, total); |
| 483 | }); |
| 484 | |
| 485 | jobPtr->start(); |
| 486 | } |
| 487 | |
| 488 | void PackInstallTask::extractConfigs() |
| 489 | { |
nothing calls this directly
no test coverage detected