feat: add setting to control the loaders for mod search
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
b4a998e992
commit
492769aea6
5 changed files with 136 additions and 10 deletions
|
@ -250,6 +250,10 @@ void MinecraftInstance::loadSpecificSettings()
|
||||||
m_settings->registerSetting("ExportOptionalFiles", true);
|
m_settings->registerSetting("ExportOptionalFiles", true);
|
||||||
m_settings->registerSetting("ExportRecommendedRAM");
|
m_settings->registerSetting("ExportRecommendedRAM");
|
||||||
|
|
||||||
|
// Join server on launch, this does not have a global override
|
||||||
|
m_settings->registerSetting("OverrideModDownloadLoaders", false);
|
||||||
|
m_settings->registerSetting("ModDownloadLoaders", QStringList());
|
||||||
|
|
||||||
qDebug() << "Instance-type specific settings were loaded!";
|
qDebug() << "Instance-type specific settings were loaded!";
|
||||||
|
|
||||||
setSpecificSettingsLoaded(true);
|
setSpecificSettingsLoaded(true);
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "BuildConfig.h"
|
#include "BuildConfig.h"
|
||||||
|
#include "minecraft/PackProfile.h"
|
||||||
#include "minecraft/WorldList.h"
|
#include "minecraft/WorldList.h"
|
||||||
#include "minecraft/auth/AccountList.h"
|
#include "minecraft/auth/AccountList.h"
|
||||||
#include "settings/Setting.h"
|
#include "settings/Setting.h"
|
||||||
|
@ -55,6 +56,7 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance,
|
||||||
m_ui->openGlobalSettingsButton->setVisible(false);
|
m_ui->openGlobalSettingsButton->setVisible(false);
|
||||||
m_ui->instanceAccountGroupBox->hide();
|
m_ui->instanceAccountGroupBox->hide();
|
||||||
m_ui->serverJoinGroupBox->hide();
|
m_ui->serverJoinGroupBox->hide();
|
||||||
|
m_ui->loaderGroup->hide();
|
||||||
} else {
|
} else {
|
||||||
m_javaSettings = new JavaSettingsWidget(m_instance, this);
|
m_javaSettings = new JavaSettingsWidget(m_instance, this);
|
||||||
m_ui->javaScrollArea->setWidget(m_javaSettings);
|
m_ui->javaScrollArea->setWidget(m_javaSettings);
|
||||||
|
@ -93,6 +95,17 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance,
|
||||||
connect(m_ui->openGlobalSettingsButton, &QCommandLinkButton::clicked, this, &MinecraftSettingsWidget::openGlobalSettings);
|
connect(m_ui->openGlobalSettingsButton, &QCommandLinkButton::clicked, this, &MinecraftSettingsWidget::openGlobalSettings);
|
||||||
connect(m_ui->serverJoinAddressButton, &QAbstractButton::toggled, m_ui->serverJoinAddress, &QWidget::setEnabled);
|
connect(m_ui->serverJoinAddressButton, &QAbstractButton::toggled, m_ui->serverJoinAddress, &QWidget::setEnabled);
|
||||||
connect(m_ui->worldJoinButton, &QAbstractButton::toggled, m_ui->worldsCb, &QWidget::setEnabled);
|
connect(m_ui->worldJoinButton, &QAbstractButton::toggled, m_ui->worldsCb, &QWidget::setEnabled);
|
||||||
|
|
||||||
|
connect(m_ui->loaderGroup, &QGroupBox::toggled, this, [this](bool value) {
|
||||||
|
m_instance->settings()->set("OverrideModDownloadLoaders", value);
|
||||||
|
if (!value)
|
||||||
|
m_instance->settings()->reset("ModDownloadLoaders");
|
||||||
|
});
|
||||||
|
connect(m_ui->neoForge, &QCheckBox::stateChanged, this, &MinecraftSettingsWidget::selectedLoadersChanged);
|
||||||
|
connect(m_ui->forge, &QCheckBox::stateChanged, this, &MinecraftSettingsWidget::selectedLoadersChanged);
|
||||||
|
connect(m_ui->fabric, &QCheckBox::stateChanged, this, &MinecraftSettingsWidget::selectedLoadersChanged);
|
||||||
|
connect(m_ui->quilt, &QCheckBox::stateChanged, this, &MinecraftSettingsWidget::selectedLoadersChanged);
|
||||||
|
connect(m_ui->liteLoader, &QCheckBox::stateChanged, this, &MinecraftSettingsWidget::selectedLoadersChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->maximizedWarning->hide();
|
m_ui->maximizedWarning->hide();
|
||||||
|
@ -220,6 +233,35 @@ void MinecraftSettingsWidget::loadSettings()
|
||||||
|
|
||||||
m_ui->instanceAccountGroupBox->setChecked(settings->get("UseAccountForInstance").toBool());
|
m_ui->instanceAccountGroupBox->setChecked(settings->get("UseAccountForInstance").toBool());
|
||||||
updateAccountsMenu(*settings);
|
updateAccountsMenu(*settings);
|
||||||
|
|
||||||
|
m_ui->loaderGroup->blockSignals(true);
|
||||||
|
m_ui->neoForge->blockSignals(true);
|
||||||
|
m_ui->forge->blockSignals(true);
|
||||||
|
m_ui->fabric->blockSignals(true);
|
||||||
|
m_ui->quilt->blockSignals(true);
|
||||||
|
m_ui->liteLoader->blockSignals(true);
|
||||||
|
auto instLoaders = m_instance->getPackProfile()->getSupportedModLoaders().value();
|
||||||
|
m_ui->loaderGroup->setChecked(settings->get("OverrideModDownloadLoaders").toBool());
|
||||||
|
auto loaders = settings->get("ModDownloadLoaders").toStringList();
|
||||||
|
if (loaders.isEmpty()) {
|
||||||
|
m_ui->neoForge->setChecked(instLoaders & ModPlatform::NeoForge);
|
||||||
|
m_ui->forge->setChecked(instLoaders & ModPlatform::Forge);
|
||||||
|
m_ui->fabric->setChecked(instLoaders & ModPlatform::Fabric);
|
||||||
|
m_ui->quilt->setChecked(instLoaders & ModPlatform::Quilt);
|
||||||
|
m_ui->liteLoader->setChecked(instLoaders & ModPlatform::LiteLoader);
|
||||||
|
} else {
|
||||||
|
m_ui->neoForge->setChecked(loaders.contains(getModLoaderAsString(ModPlatform::NeoForge)));
|
||||||
|
m_ui->forge->setChecked(loaders.contains(getModLoaderAsString(ModPlatform::Forge)));
|
||||||
|
m_ui->fabric->setChecked(loaders.contains(getModLoaderAsString(ModPlatform::Fabric)));
|
||||||
|
m_ui->quilt->setChecked(loaders.contains(getModLoaderAsString(ModPlatform::Quilt)));
|
||||||
|
m_ui->liteLoader->setChecked(loaders.contains(getModLoaderAsString(ModPlatform::LiteLoader)));
|
||||||
|
}
|
||||||
|
m_ui->loaderGroup->blockSignals(false);
|
||||||
|
m_ui->neoForge->blockSignals(false);
|
||||||
|
m_ui->forge->blockSignals(false);
|
||||||
|
m_ui->fabric->blockSignals(false);
|
||||||
|
m_ui->quilt->blockSignals(false);
|
||||||
|
m_ui->liteLoader->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->legacySettingsGroupBox->setChecked(settings->get("OverrideLegacySettings").toBool());
|
m_ui->legacySettingsGroupBox->setChecked(settings->get("OverrideLegacySettings").toBool());
|
||||||
|
@ -238,7 +280,6 @@ void MinecraftSettingsWidget::saveSettings()
|
||||||
{
|
{
|
||||||
SettingsObject::Lock lock(settings);
|
SettingsObject::Lock lock(settings);
|
||||||
|
|
||||||
|
|
||||||
// Console
|
// Console
|
||||||
bool console = m_instance == nullptr || m_ui->consoleSettingsBox->isChecked();
|
bool console = m_instance == nullptr || m_ui->consoleSettingsBox->isChecked();
|
||||||
|
|
||||||
|
@ -267,7 +308,7 @@ void MinecraftSettingsWidget::saveSettings()
|
||||||
settings->set("LaunchMaximized", m_ui->maximizedCheckBox->isChecked());
|
settings->set("LaunchMaximized", m_ui->maximizedCheckBox->isChecked());
|
||||||
settings->set("MinecraftWinWidth", m_ui->windowWidthSpinBox->value());
|
settings->set("MinecraftWinWidth", m_ui->windowWidthSpinBox->value());
|
||||||
settings->set("MinecraftWinHeight", m_ui->windowHeightSpinBox->value());
|
settings->set("MinecraftWinHeight", m_ui->windowHeightSpinBox->value());
|
||||||
settings->set("CloseAfterLaunch", m_ui->closeAfterLaunchCheck->isChecked());
|
settings->set("CloseAfterLaunch", m_ui->closeAfterLaunchCheck->isChecked());
|
||||||
settings->set("QuitAfterGameStop", m_ui->quitAfterGameStopCheck->isChecked());
|
settings->set("QuitAfterGameStop", m_ui->quitAfterGameStopCheck->isChecked());
|
||||||
} else {
|
} else {
|
||||||
settings->reset("LaunchMaximized");
|
settings->reset("LaunchMaximized");
|
||||||
|
@ -444,3 +485,19 @@ bool MinecraftSettingsWidget::isQuickPlaySupported()
|
||||||
{
|
{
|
||||||
return m_instance->traits().contains("feature:is_quick_play_singleplayer");
|
return m_instance->traits().contains("feature:is_quick_play_singleplayer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MinecraftSettingsWidget::selectedLoadersChanged()
|
||||||
|
{
|
||||||
|
QStringList loaders;
|
||||||
|
if (m_ui->neoForge->isChecked())
|
||||||
|
loaders << getModLoaderAsString(ModPlatform::NeoForge);
|
||||||
|
if (m_ui->forge->isChecked())
|
||||||
|
loaders << getModLoaderAsString(ModPlatform::Forge);
|
||||||
|
if (m_ui->fabric->isChecked())
|
||||||
|
loaders << getModLoaderAsString(ModPlatform::Fabric);
|
||||||
|
if (m_ui->quilt->isChecked())
|
||||||
|
loaders << getModLoaderAsString(ModPlatform::Quilt);
|
||||||
|
if (m_ui->liteLoader->isChecked())
|
||||||
|
loaders << getModLoaderAsString(ModPlatform::LiteLoader);
|
||||||
|
m_instance->settings()->set("ModDownloadLoaders", loaders);
|
||||||
|
}
|
|
@ -56,6 +56,8 @@ class MinecraftSettingsWidget : public QWidget {
|
||||||
void openGlobalSettings();
|
void openGlobalSettings();
|
||||||
void updateAccountsMenu(const SettingsObject& settings);
|
void updateAccountsMenu(const SettingsObject& settings);
|
||||||
bool isQuickPlaySupported();
|
bool isQuickPlaySupported();
|
||||||
|
private slots:
|
||||||
|
void selectedLoadersChanged();
|
||||||
|
|
||||||
MinecraftInstancePtr m_instance;
|
MinecraftInstancePtr m_instance;
|
||||||
Ui::MinecraftSettingsWidget* m_ui;
|
Ui::MinecraftSettingsWidget* m_ui;
|
||||||
|
|
|
@ -58,9 +58,9 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-207</y>
|
<y>-537</y>
|
||||||
<width>603</width>
|
<width>623</width>
|
||||||
<height>694</height>
|
<height>1007</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
@ -394,11 +394,67 @@
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="loaderGroup">
|
||||||
|
<property name="title">
|
||||||
|
<string>Override Mod Download &Loaders</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="neoForge">
|
||||||
|
<property name="text">
|
||||||
|
<string>NeoForge</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="forge">
|
||||||
|
<property name="text">
|
||||||
|
<string>Forge</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="fabric">
|
||||||
|
<property name="text">
|
||||||
|
<string>Fabric</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="quilt">
|
||||||
|
<property name="text">
|
||||||
|
<string>Quilt</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="liteLoader">
|
||||||
|
<property name="text">
|
||||||
|
<string>LiteLoader</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -433,8 +489,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>624</width>
|
<width>98</width>
|
||||||
<height>487</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -457,8 +513,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>624</width>
|
<width>299</width>
|
||||||
<height>487</height>
|
<height>499</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
|
|
@ -218,7 +218,14 @@ void ModFilterWidget::prepareBasicFilter()
|
||||||
if (m_instance) {
|
if (m_instance) {
|
||||||
m_filter->hideInstalled = false;
|
m_filter->hideInstalled = false;
|
||||||
m_filter->side = ""; // or "both"
|
m_filter->side = ""; // or "both"
|
||||||
auto loaders = m_instance->getPackProfile()->getSupportedModLoaders().value();
|
ModPlatform::ModLoaderTypes loaders;
|
||||||
|
if (m_instance->settings()->get("OverrideModDownloadLoaders").toBool()) {
|
||||||
|
for (auto loader : m_instance->settings()->get("ModDownloadLoaders").toStringList()) {
|
||||||
|
loaders |= ModPlatform::getModLoaderFromString(loader);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loaders = m_instance->getPackProfile()->getSupportedModLoaders().value();
|
||||||
|
}
|
||||||
ui->neoForge->setChecked(loaders & ModPlatform::NeoForge);
|
ui->neoForge->setChecked(loaders & ModPlatform::NeoForge);
|
||||||
ui->forge->setChecked(loaders & ModPlatform::Forge);
|
ui->forge->setChecked(loaders & ModPlatform::Forge);
|
||||||
ui->fabric->setChecked(loaders & ModPlatform::Fabric);
|
ui->fabric->setChecked(loaders & ModPlatform::Fabric);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue