Removed modlist checkbox

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-06-24 11:12:23 +03:00
parent 377707d3db
commit cd1e8dc8cc
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
4 changed files with 15 additions and 34 deletions

View File

@ -41,7 +41,6 @@ FlamePackExportTask::FlamePackExportTask(const QString& name,
const QString& version, const QString& version,
const QString& author, const QString& author,
const QVariant& projectID, const QVariant& projectID,
const bool generateModList,
InstancePtr instance, InstancePtr instance,
const QString& output, const QString& output,
MMCZip::FilterFunction filter) MMCZip::FilterFunction filter)
@ -54,7 +53,6 @@ FlamePackExportTask::FlamePackExportTask(const QString& name,
, gameRoot(instance->gameRoot()) , gameRoot(instance->gameRoot())
, output(output) , output(output)
, filter(filter) , filter(filter)
, generateModList(generateModList)
{} {}
void FlamePackExportTask::executeTask() void FlamePackExportTask::executeTask()
@ -218,10 +216,6 @@ void FlamePackExportTask::makeApiRequest()
void FlamePackExportTask::getProjectsInfo() void FlamePackExportTask::getProjectsInfo()
{ {
if (!generateModList) {
buildZip();
return;
}
setStatus(tr("Find project info from curseforge...")); setStatus(tr("Find project info from curseforge..."));
QList<QString> addonIds; QList<QString> addonIds;
for (auto resolved : resolvedFiles) { for (auto resolved : resolvedFiles) {
@ -319,23 +313,21 @@ void FlamePackExportTask::buildZip()
} }
indexFile.write(generateIndex()); indexFile.write(generateIndex());
if (generateModList) { QuaZipFile modlist(&zip);
QuaZipFile modlist(&zip); if (!modlist.open(QIODevice::WriteOnly, QuaZipNewInfo("modlist.html"))) {
if (!modlist.open(QIODevice::WriteOnly, QuaZipNewInfo("modlist.html"))) { QFile::remove(output);
QFile::remove(output); return BuildZipResult(tr("Could not create index"));
return BuildZipResult(tr("Could not create index"));
}
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";
}
content = "<ul>" + content + "</ul>";
modlist.write(content.toUtf8());
} }
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";
}
content = "<ul>" + content + "</ul>";
modlist.write(content.toUtf8());
size_t progress = 0; size_t progress = 0;
for (const QFileInfo& file : files) { for (const QFileInfo& file : files) {

View File

@ -32,7 +32,6 @@ class FlamePackExportTask : public Task {
const QString& version, const QString& version,
const QString& author, const QString& author,
const QVariant& projectID, const QVariant& projectID,
const bool generateModList,
InstancePtr instance, InstancePtr instance,
const QString& output, const QString& output,
MMCZip::FilterFunction filter); MMCZip::FilterFunction filter);
@ -52,7 +51,6 @@ class FlamePackExportTask : public Task {
const QDir gameRoot; const QDir gameRoot;
const QString output; const QString output;
const MMCZip::FilterFunction filter; const MMCZip::FilterFunction filter;
const bool generateModList;
typedef std::optional<QString> BuildZipResult; typedef std::optional<QString> BuildZipResult;
struct ResolvedFile { struct ResolvedFile {

View File

@ -43,7 +43,6 @@ ExportMrPackDialog::ExportMrPackDialog(InstancePtr instance, QWidget* parent, Mo
ui->summary->setText(instance->notes().split(QRegularExpression("\\r?\\n"))[0]); ui->summary->setText(instance->notes().split(QRegularExpression("\\r?\\n"))[0]);
ui->author->hide(); ui->author->hide();
ui->authorLabel->hide(); ui->authorLabel->hide();
ui->gnerateModlist->hide();
} else { } else {
setWindowTitle("Export CurseForge Pack"); setWindowTitle("Export CurseForge Pack");
ui->version->setText(""); ui->version->setText("");
@ -118,8 +117,7 @@ void ExportMrPackDialog::done(int result)
task = new ModrinthPackExportTask(ui->name->text(), ui->version->text(), ui->summary->text(), instance, output, task = new ModrinthPackExportTask(ui->name->text(), ui->version->text(), ui->summary->text(), instance, output,
[this](const QString& path) { return proxy->blockedPaths().covers(path); }); [this](const QString& path) { return proxy->blockedPaths().covers(path); });
else else
task = new FlamePackExportTask(ui->name->text(), ui->version->text(), ui->author->text(), ui->summary->text(), task = new FlamePackExportTask(ui->name->text(), ui->version->text(), ui->author->text(), ui->summary->text(), instance, output,
ui->gnerateModlist->isChecked(), instance, output,
[this](const QString& path) { return proxy->blockedPaths().covers(path); }); [this](const QString& path) { return proxy->blockedPaths().covers(path); });
connect(task, &Task::failed, connect(task, &Task::failed,

View File

@ -67,13 +67,6 @@
<item row="4" column="1"> <item row="4" column="1">
<widget class="QLineEdit" name="author"/> <widget class="QLineEdit" name="author"/>
</item> </item>
<item row="5" column="2">
<widget class="QCheckBox" name="gnerateModlist">
<property name="text">
<string>Generate modlist</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>