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