Skip to content

Commit a3fb82f

Browse files
author
FreesmModders
committed
fix: Adjust modpack creator workflow to compare with baseline
Signed-off-by: FreesmModders <freesmmodders@users.noreply.github.com>
1 parent 2df8605 commit a3fb82f

6 files changed

Lines changed: 40 additions & 15 deletions

File tree

launcher/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,8 +1639,8 @@ if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
16391639
target_compile_options(Launcher_logic PRIVATE /wd4100) # C4100 - unused parameter
16401640
target_compile_options(${Launcher_Name} PRIVATE /wd4100) # C4100 - unused parameter
16411641
else()
1642-
target_compile_options(Launcher_logic PRIVATE -Wno-unused-parameter -Wno-missing-field-initializers)
1643-
target_compile_options(${Launcher_Name} PRIVATE -Wno-unused-parameter -Wno-missing-field-initializers)
1642+
target_compile_options(Launcher_logic PRIVATE -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=sfinae-incomplete)
1643+
target_compile_options(${Launcher_Name} PRIVATE -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=sfinae-incomplete)
16441644
endif()
16451645

16461646
#### The bundle mess! ####

launcher/InstancePageProvider.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#pragma once
2+
#include "ui/pages/instance/InstanceSettingsPage.h"
3+
#include "ui/pages/instance/LogPage.h"
24
#include <FileSystem.h>
35
#include <ui/pages/instance/DataPackPage.h>
46
#include "minecraft/MinecraftInstance.h"
57
#include "ui/pages/BasePage.h"
68
#include "ui/pages/BasePageProvider.h"
7-
#include "ui/pages/instance/InstanceSettingsPage.h"
8-
#include "ui/pages/instance/LogPage.h"
99
#include "ui/pages/instance/ManagedPackPage.h"
1010
#include "ui/pages/instance/ModFolderPage.h"
1111
#include "ui/pages/instance/ModpackCreatorPage.h"

launcher/minecraft/mod/ModpackChangelogGenerator.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,24 +378,24 @@ ModpackChangelog ModpackChangelogGenerator::generateChangelog()
378378
previousSnapshot = history.last();
379379
}
380380

381-
// Create the new snapshot
382-
auto newSnapshot = createSnapshot();
381+
// Create a snapshot of the current state but DO NOT save it
382+
int nextVersion = previousSnapshot.versionNumber + 1;
383+
auto currentSnapshot = buildSnapshotFromCurrentMods(nextVersion);
383384

384-
// If there was no previous snapshot, return an empty changelog
385+
// If there was no previous snapshot, return all mods as added
385386
if (previousSnapshot.versionNumber == 0) {
386387
ModpackChangelog changelog;
387388
changelog.fromVersion = 0;
388-
changelog.toVersion = newSnapshot.versionNumber;
389-
// First snapshot — treat all mods as "added"
390-
for (const auto& mod : newSnapshot.mods) {
389+
changelog.toVersion = currentSnapshot.versionNumber;
390+
for (const auto& mod : currentSnapshot.mods) {
391391
ChangelogEntry entry;
392392
entry.modName = mod.name;
393393
changelog.addedMods.append(entry);
394394
}
395395
return changelog;
396396
}
397397

398-
return compareSnapshots(previousSnapshot, newSnapshot);
398+
return compareSnapshots(previousSnapshot, currentSnapshot);
399399
}
400400

401401
QList<ModpackVersionSnapshot> ModpackChangelogGenerator::getVersionHistory() const

launcher/ui/pages/instance/ModpackCreatorPage.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <QTimer>
2626

2727
#include "minecraft/mod/ModpackChangelogGenerator.h"
28+
#include "minecraft/MinecraftInstance.h"
2829

2930
ModpackCreatorPage::ModpackCreatorPage(MinecraftInstance* inst, QWidget* parent)
3031
: QWidget(parent), ui(new Ui::ModpackCreatorPage), m_inst(inst)
@@ -33,7 +34,6 @@ ModpackCreatorPage::ModpackCreatorPage(MinecraftInstance* inst, QWidget* parent)
3334

3435
// Load existing metadata
3536
auto* settings = m_inst->settings();
36-
bool isModpack = settings->get("ModpackCreatorEnabled").toBool();
3737
QString modpackName = settings->get("ModpackCreatorName").toString();
3838
QString modpackAuthor = settings->get("ModpackCreatorAuthor").toString();
3939

@@ -85,6 +85,15 @@ void ModpackCreatorPage::on_markAsModpackBtn_clicked()
8585
updateUI();
8686
}
8787

88+
void ModpackCreatorPage::on_markAsOldVersionBtn_clicked()
89+
{
90+
ModpackChangelogGenerator generator(m_inst);
91+
generator.createSnapshot();
92+
93+
// Auto-generate the changelog immediately after taking the snapshot to show it
94+
on_generateChangelogBtn_clicked();
95+
}
96+
8897
void ModpackCreatorPage::on_generateChangelogBtn_clicked()
8998
{
9099
ModpackChangelogGenerator generator(m_inst);
@@ -167,7 +176,7 @@ void ModpackCreatorPage::refreshVersionInfo()
167176
int snapshotCount = generator.getSnapshotCount();
168177

169178
if (snapshotCount == 0) {
170-
ui->versionInfoLabel->setText(tr("No snapshots yet. Click \"Generate Changelog\" to create the first one."));
179+
ui->versionInfoLabel->setText(tr("No snapshots yet. Click \"Mark as Old Version\" to create the baseline."));
171180
} else {
172181
auto latest = generator.getLatestSnapshot();
173182
ui->versionInfoLabel->setText(

launcher/ui/pages/instance/ModpackCreatorPage.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020

2121
#include <QWidget>
2222

23-
#include "minecraft/MinecraftInstance.h"
23+
#include "BaseInstance.h"
2424
#include "ui/pages/BasePage.h"
2525

26+
class MinecraftInstance;
27+
2628
namespace Ui {
2729
class ModpackCreatorPage;
2830
}
@@ -52,6 +54,7 @@ class ModpackCreatorPage : public QWidget, public BasePage {
5254

5355
private slots:
5456
void on_markAsModpackBtn_clicked();
57+
void on_markAsOldVersionBtn_clicked();
5558
void on_generateChangelogBtn_clicked();
5659
void on_copyChangelogBtn_clicked();
5760
void on_clearHistoryBtn_clicked();

launcher/ui/pages/instance/ModpackCreatorPage.ui

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,26 @@
102102
<!-- Buttons row -->
103103
<item>
104104
<layout class="QHBoxLayout" name="changelogButtonsLayout">
105+
<item>
106+
<widget class="QPushButton" name="markAsOldVersionBtn">
107+
<property name="text">
108+
<string>Mark as Old Version</string>
109+
</property>
110+
<property name="toolTip">
111+
<string>Save the current mod list as the baseline to compare against later</string>
112+
</property>
113+
<property name="minimumHeight">
114+
<number>32</number>
115+
</property>
116+
</widget>
117+
</item>
105118
<item>
106119
<widget class="QPushButton" name="generateChangelogBtn">
107120
<property name="text">
108121
<string>Generate Changelog</string>
109122
</property>
110123
<property name="toolTip">
111-
<string>Create a new version snapshot and compare with the previous one to generate a changelog</string>
124+
<string>Compare the current mods with the latest saved old version</string>
112125
</property>
113126
<property name="minimumHeight">
114127
<number>32</number>

0 commit comments

Comments
 (0)