added settings entires for auto updating mods

Signed-off-by: dyredhead <danielyentin@gmail.com>
This commit is contained in:
dyredhead 2026-05-29 00:59:08 -04:00
parent f5d7e76ac4
commit b8d996530c
3 changed files with 69 additions and 2 deletions

View file

@ -263,10 +263,16 @@ void MinecraftInstance::loadSpecificSettings()
connect(dataPacksEnabled.get(), &Setting::SettingChanged, this, [this] { m_data_pack_list.reset(); });
connect(dataPacksPath.get(), &Setting::SettingChanged, this, [this] { m_data_pack_list.reset(); });
// Join server on launch, this does not have a global override
// Set mod downloaders, this does not have a global override
m_settings->registerSetting("OverrideModDownloadLoaders", false);
m_settings->registerSetting("ModDownloadLoaders", "[]");
// Enable automatic mod updates, this does not have a global override
m_settings->registerSetting("AutomaticallyUpdateMods", false);
m_settings->registerSetting("AutomaticallyUpdateModsAll", false);
m_settings->registerSetting("AutomaticallyUpdateModsEnabled", true);
// m_settings->registerSetting("AutomaticallyUpdateModsSpecified", "[]");
qDebug() << "Instance-type specific settings were loaded!";
setSpecificSettingsLoaded(true);

View file

@ -61,6 +61,7 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstance* instance, QW
m_ui->serverJoinGroupBox->hide();
m_ui->globalDataPacksGroupBox->hide();
m_ui->loaderGroup->hide();
m_ui->autoModUpdateGroup->hide();
} else {
m_javaSettings = new JavaSettingsWidget(m_instance, this);
m_ui->javaScrollArea->setWidget(m_javaSettings);
@ -120,6 +121,18 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstance* instance, QW
m_ui->legacyFabric, m_ui->ornithe, m_ui->rift }) {
connect(c, &QCheckBox::stateChanged, this, &MinecraftSettingsWidget::saveSelectedLoaders);
}
connect(m_ui->autoModUpdateGroup, &QGroupBox::toggled, this, [this](bool value) {
m_instance->settings()->set("AutomaticallyUpdateMods", value);
// if (!value) {
// m_instance->settings()->reset("AutomaticallyUpdateModsAll");
// m_instance->settings()->reset("AutomaticallyUpdateModsEnabled");
// }
});
connect(m_ui->allMods, &QAbstractButton::toggled, this,
[this](bool value) { m_instance->settings()->set("AutomaticallyUpdateModsAll", value); });
connect(m_ui->enabledMods, &QAbstractButton::toggled, this,
[this](bool value) { m_instance->settings()->set("AutomaticallyUpdateModsEnabled", value); });
}
m_ui->maximizedWarning->hide();
@ -248,6 +261,10 @@ void MinecraftSettingsWidget::loadSettings()
m_ui->serverJoinGroupBox->setChecked(settings->get("JoinServerOnLaunch").toBool());
m_ui->autoModUpdateGroup->setChecked(settings->get("AutomaticallyUpdateMods").toBool());
m_ui->allMods->setChecked(settings->get("AutomaticallyUpdateModsAll").toBool());
m_ui->enabledMods->setChecked(settings->get("AutomaticallyUpdateModsEnabled").toBool());
m_ui->instanceAccountGroupBox->setChecked(settings->get("UseAccountForInstance").toBool());
updateAccountsMenu(*settings);
@ -455,6 +472,21 @@ void MinecraftSettingsWidget::saveSettings()
settings->reset("JoinWorldOnLaunch");
}
bool automaticallyUpdateMods = m_ui->autoModUpdateGroup->isChecked();
settings->set("AutomaticallyUpdateMods", automaticallyUpdateMods);
// if (automaticallyUpdateMods) {
if (m_ui->allMods->isChecked()) {
settings->set("AutomaticallyUpdateModsAll", true);
settings->set("AutomaticallyUpdateModsEnabled", false);
} else {
settings->set("AutomaticallyUpdateModsAll", false);
settings->set("AutomaticallyUpdateModsEnabled", true);
}
// } else {
// settings->reset("AutomaticallyUpdateModsAll");
// settings->reset("AutomaticallyUpdateModsEnabled");
// }
// Use an account for this instance
bool useAccountForInstance = m_ui->instanceAccountGroupBox->isChecked();
settings->set("UseAccountForInstance", useAccountForInstance);

View file

@ -268,7 +268,7 @@
<widget class="QLabel" name="label_3">
<property name="text">
<string>Allows installing data packs across all worlds if an applicable mod is installed.
It is most likely you will need to change the path - please refer to the mod's website.</string>
It is most likely you will need to change the path - please refer to the mod's website.</string>
</property>
</widget>
</item>
@ -554,6 +554,35 @@ It is most likely you will need to change the path - please refer to the mod's w
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="autoModUpdateGroup">
<property name="title">
<string>Automatically Update Mods</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_19">
<item>
<widget class="QRadioButton" name="allMods">
<property name="text">
<string>All mods</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="enabledMods">
<property name="text">
<string>Enabled mods only</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">