| 112 | } |
| 113 | |
| 114 | void PackFetchTask::fileDownloadFinished() |
| 115 | { |
| 116 | jobPtr.reset(); |
| 117 | |
| 118 | QStringList failedLists; |
| 119 | |
| 120 | if(!parseAndAddPacks(publicModpacksXmlFileData, PackType::Public, publicPacks)) |
| 121 | { |
| 122 | failedLists.append(tr("Public Packs")); |
| 123 | } |
| 124 | |
| 125 | if(!parseAndAddPacks(thirdPartyModpacksXmlFileData, PackType::ThirdParty, thirdPartyPacks)) |
| 126 | { |
| 127 | failedLists.append(tr("Third Party Packs")); |
| 128 | } |
| 129 | |
| 130 | if(failedLists.size() > 0) |
| 131 | { |
| 132 | emit failed(tr("Failed to download some pack lists: %1").arg(failedLists.join("\n- "))); |
| 133 | } |
| 134 | else |
| 135 | { |
| 136 | emit finished(publicPacks, thirdPartyPacks); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | bool PackFetchTask::parseAndAddPacks(QByteArray &data, PackType packType, ModpackList &list) |
| 141 | { |