| 117 | } |
| 118 | |
| 119 | void PackInstallTask::unzip() |
| 120 | { |
| 121 | progress(2, 4); |
| 122 | setStatus(tr("Extracting modpack")); |
| 123 | QDir extractDir(m_stagingPath); |
| 124 | |
| 125 | m_packZip.reset(new QuaZip(archivePath)); |
| 126 | if(!m_packZip->open(QuaZip::mdUnzip)) |
| 127 | { |
| 128 | emitFailed(tr("Failed to open modpack file %1!").arg(archivePath)); |
| 129 | return; |
| 130 | } |
| 131 | |
| 132 | #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
| 133 | m_extractFuture = QtConcurrent::run(QThreadPool::globalInstance(), QOverload<QString, QString>::of(MMCZip::extractDir), archivePath, extractDir.absolutePath() + "/unzip"); |
| 134 | #else |
| 135 | m_extractFuture = QtConcurrent::run(QThreadPool::globalInstance(), MMCZip::extractDir, archivePath, extractDir.absolutePath() + "/unzip"); |
| 136 | #endif |
| 137 | connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::finished, this, &PackInstallTask::onUnzipFinished); |
| 138 | connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::canceled, this, &PackInstallTask::onUnzipCanceled); |
| 139 | m_extractFutureWatcher.setFuture(m_extractFuture); |
| 140 | } |
| 141 | |
| 142 | void PackInstallTask::onUnzipFinished() |
| 143 | { |