Added condition for modlist
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
25579fbedc
commit
4a84084d9d
@ -118,7 +118,7 @@ void FlamePackExportTask::collectHashes()
|
||||
}
|
||||
if (mod->metadata() && mod->metadata()->provider == ModPlatform::ResourceProvider::FLAME) {
|
||||
resolvedFiles.insert(mod->fileinfo().absoluteFilePath(),
|
||||
{ mod->metadata()->project_id.toInt(), mod->metadata()->file_id.toInt(), mod->enabled(),
|
||||
{ mod->metadata()->project_id.toInt(), mod->metadata()->file_id.toInt(), mod->enabled(), true,
|
||||
mod->metadata()->name, mod->metadata()->slug, mod->authors().join(", ") });
|
||||
setProgress(m_progress + 1, totalProgres);
|
||||
continue;
|
||||
@ -128,7 +128,7 @@ void FlamePackExportTask::collectHashes()
|
||||
connect(hash_task.get(), &Hashing::Hasher::resultsReady, [this, mod, totalProgres](QString hash) {
|
||||
if (m_state == Task::State::Running) {
|
||||
setProgress(m_progress + 1, totalProgres);
|
||||
pendingHashes.insert(hash, { mod->name(), mod->fileinfo().absoluteFilePath(), mod->enabled() });
|
||||
pendingHashes.insert(hash, { mod->name(), mod->fileinfo().absoluteFilePath(), mod->enabled(), true });
|
||||
}
|
||||
});
|
||||
connect(hash_task.get(), &Task::failed, this, &FlamePackExportTask::emitFailed);
|
||||
@ -215,8 +215,8 @@ void FlamePackExportTask::makeApiRequest()
|
||||
|
||||
setStatus(tr("Parsing API response from CurseForge for '%1'...").arg(mod->name));
|
||||
if (Json::ensureBoolean(file_obj, "isAvailable", false, "isAvailable"))
|
||||
resolvedFiles.insert(mod->path,
|
||||
{ Json::requireInteger(file_obj, "modId"), Json::requireInteger(file_obj, "id"), mod->enabled });
|
||||
resolvedFiles.insert(mod->path, { Json::requireInteger(file_obj, "modId"), Json::requireInteger(file_obj, "id"),
|
||||
mod->enabled, mod->isMod });
|
||||
}
|
||||
|
||||
} catch (Json::JsonException& e) {
|
||||
@ -336,11 +336,13 @@ void FlamePackExportTask::buildZip()
|
||||
}
|
||||
QString content = "";
|
||||
for (auto mod : resolvedFiles) {
|
||||
content += QString(TEMPLATE)
|
||||
.replace("{name}", mod.name)
|
||||
.replace("{url}", ModPlatform::getMetaURL(ModPlatform::ResourceProvider::FLAME, mod.slug))
|
||||
.replace("{authors}", mod.authors) +
|
||||
"\n";
|
||||
if (mod.isMod) {
|
||||
content += QString(TEMPLATE)
|
||||
.replace("{name}", mod.name)
|
||||
.replace("{url}", ModPlatform::getMetaURL(ModPlatform::ResourceProvider::FLAME, mod.slug))
|
||||
.replace("{authors}", mod.authors) +
|
||||
"\n";
|
||||
}
|
||||
}
|
||||
content = "<ul>" + content + "</ul>";
|
||||
modlist.write(content.toUtf8());
|
||||
|
@ -57,6 +57,7 @@ class FlamePackExportTask : public Task {
|
||||
int addonId;
|
||||
int version;
|
||||
bool enabled;
|
||||
bool isMod;
|
||||
|
||||
QString name;
|
||||
QString slug;
|
||||
@ -66,6 +67,7 @@ class FlamePackExportTask : public Task {
|
||||
QString name;
|
||||
QString path;
|
||||
bool enabled;
|
||||
bool isMod;
|
||||
};
|
||||
|
||||
FlameAPI api;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "modplatform/flame/FlamePackExportTask.h"
|
||||
#include "ui/dialogs/CustomMessageBox.h"
|
||||
#include "ui/dialogs/ProgressDialog.h"
|
||||
#include "ui_ExportMrPackDialog.h"
|
||||
#include "ui_ExportPackDialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileSystemModel>
|
||||
|
Loading…
x
Reference in New Issue
Block a user