| 128 | } |
| 129 | |
| 130 | void PackInstallTask::resolveMods() |
| 131 | { |
| 132 | setStatus(tr("Resolving mods...")); |
| 133 | setProgress(0, 100); |
| 134 | |
| 135 | m_file_id_map.clear(); |
| 136 | |
| 137 | Flame::Manifest manifest; |
| 138 | for (auto const& file : m_version.files) { |
| 139 | if (!file.serverOnly && file.url.isEmpty()) { |
| 140 | if (file.curseforge.file_id <= 0) { |
| 141 | emitFailed(tr("Invalid manifest: There's no information available to download the file '%1'!").arg(file.name)); |
| 142 | return; |
| 143 | } |
| 144 | |
| 145 | Flame::File flame_file; |
| 146 | flame_file.projectId = file.curseforge.project_id; |
| 147 | flame_file.fileId = file.curseforge.file_id; |
| 148 | flame_file.hash = file.sha1; |
| 149 | |
| 150 | manifest.files.insert(flame_file.fileId, flame_file); |
| 151 | m_file_id_map.append(flame_file.fileId); |
| 152 | } else { |
| 153 | m_file_id_map.append(-1); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | m_mod_id_resolver_task = new Flame::FileResolvingTask(APPLICATION->network(), manifest); |
| 158 | |
| 159 | connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::succeeded, this, &PackInstallTask::onResolveModsSucceeded); |
| 160 | connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::failed, this, &PackInstallTask::onResolveModsFailed); |
| 161 | connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::progress, this, &PackInstallTask::setProgress); |
| 162 | |
| 163 | m_mod_id_resolver_task->start(); |
| 164 | } |
| 165 | |
| 166 | void PackInstallTask::onResolveModsSucceeded() |
| 167 | { |