Revert concurrent syntax

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2023-04-06 19:58:09 +01:00
parent d7a137ad13
commit 012d8bb468

View File

@ -20,14 +20,12 @@
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QFileInfo> #include <QFileInfo>
#include <QFileInfoList>
#include <QMessageBox> #include <QMessageBox>
#include <QtConcurrentRun>
#include "Json.h" #include "Json.h"
#include "MMCZip.h" #include "MMCZip.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h" #include "minecraft/PackProfile.h"
#include "minecraft/mod/ModFolderModel.h" #include "minecraft/mod/ModFolderModel.h"
#include "modplatform/modrinth/ModrinthAPI.h"
const QStringList ModrinthPackExportTask::PREFIXES({ "mods", "coremods", "resourcepacks", "texturepacks", "shaderpacks" }); const QStringList ModrinthPackExportTask::PREFIXES({ "mods", "coremods", "resourcepacks", "texturepacks", "shaderpacks" });
@ -190,13 +188,11 @@ void ModrinthPackExportTask::parseApiResponse(QByteArray* response)
qWarning() << "Failed to parse versions response" << e.what(); qWarning() << "Failed to parse versions response" << e.what();
} }
pendingHashes.clear(); pendingHashes.clear();
buildZip();
} }
void ModrinthPackExportTask::buildZip() void ModrinthPackExportTask::buildZip()
{ {
QThreadPool::globalInstance()->start([this]() { static_cast<void>(QtConcurrent::run(QThreadPool::globalInstance(), [this]() {
setStatus("Adding files..."); setStatus("Adding files...");
QuaZip zip(output); QuaZip zip(output);
if (!zip.open(QuaZip::mdCreate)) { if (!zip.open(QuaZip::mdCreate)) {
@ -249,7 +245,7 @@ void ModrinthPackExportTask::buildZip()
} }
QMetaObject::invokeMethod(this, &ModrinthPackExportTask::emitSucceeded, Qt::QueuedConnection); QMetaObject::invokeMethod(this, &ModrinthPackExportTask::emitSucceeded, Qt::QueuedConnection);
}); }));
} }
QByteArray ModrinthPackExportTask::generateIndex() QByteArray ModrinthPackExportTask::generateIndex()
@ -301,6 +297,7 @@ QByteArray ModrinthPackExportTask::generateIndex()
QJsonObject hashes; QJsonObject hashes;
hashes["sha1"] = value.sha1; hashes["sha1"] = value.sha1;
hashes["sha512"] = value.sha512; hashes["sha512"] = value.sha512;
file["hashes"] = hashes; file["hashes"] = hashes;
file["fileSize"] = value.size; file["fileSize"] = value.size;