Implement open global settings

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2024-11-07 00:47:32 +00:00
parent 223b6b3b2b
commit e06b3e7a7a
No known key found for this signature in database
GPG Key ID: 5E39D70B4C93C38E
4 changed files with 27 additions and 10 deletions

View File

@ -972,7 +972,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
[[fallthrough]];
default: {
qDebug() << "Exiting because update lockfile is present";
QMetaObject::invokeMethod(this, []() { exit(1); }, Qt::QueuedConnection);
QMetaObject::invokeMethod(
this, []() { exit(1); }, Qt::QueuedConnection);
return;
}
}
@ -1004,7 +1005,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
[[fallthrough]];
default: {
qDebug() << "Exiting because update lockfile is present";
QMetaObject::invokeMethod(this, []() { exit(1); }, Qt::QueuedConnection);
QMetaObject::invokeMethod(
this, []() { exit(1); }, Qt::QueuedConnection);
return;
}
}
@ -1734,7 +1736,8 @@ QString Application::getJarPath(QString jarFile)
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
FS::PathCombine(m_rootPath, "share", BuildConfig.LAUNCHER_NAME),
#endif
FS::PathCombine(m_rootPath, "jars"), FS::PathCombine(applicationDirPath(), "jars"),
FS::PathCombine(m_rootPath, "jars"),
FS::PathCombine(applicationDirPath(), "jars"),
FS::PathCombine(applicationDirPath(), "..", "jars") // from inside build dir, for debuging
};
for (QString p : potentialPaths) {

View File

@ -51,7 +51,7 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget*
m_ui->settingsTabs->removeTab(1);
// Launch
m_ui->settingsTabs->removeTab(2);
m_ui->openGlobalJavaSettingsButton->setVisible(false);
m_ui->openGlobalSettingsButton->setVisible(false);
} else {
m_ui->showGameTime->setText(tr("Show time &playing this instance"));
m_ui->recordGameTime->setText(tr("&Record time playing this instance"));
@ -61,6 +61,8 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget*
m_ui->maximizedWarning->setText(
tr("<span style=\" font-weight:600; color:#f5c211;\">Warning</span><span style=\" color:#f5c211;\">: The maximized option is "
"not fully supported on this Minecraft version.</span>"));
connect(m_ui->openGlobalSettingsButton, &QCommandLinkButton::clicked, this, &MinecraftSettingsWidget::openGlobalSettings);
}
m_ui->maximizedWarning->hide();
@ -68,6 +70,10 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget*
connect(m_ui->maximizedCheckBox, &QCheckBox::toggled, this,
[this](const bool value) { m_ui->maximizedWarning->setVisible(value && (m_instance == nullptr || !m_instance->isLegacy())); });
#if !defined(Q_OS_LINUX)
m_ui->perfomanceGroupBox->hide();
#endif
loadSettings();
}
@ -136,10 +142,6 @@ void MinecraftSettingsWidget::loadSettings()
m_ui->useDiscreteGpuCheck->setChecked(settings->get("UseDiscreteGpu").toBool());
m_ui->useZink->setChecked(settings->get("UseZink").toBool());
#if !defined(Q_OS_LINUX)
m_ui->perfomanceGroupBox->hide();
#endif
if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) {
m_ui->enableFeralGamemodeCheck->setDisabled(true);
m_ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system."));
@ -311,6 +313,16 @@ void MinecraftSettingsWidget::saveSettings()
m_instance->updateRuntimeContext();
}
void MinecraftSettingsWidget::openGlobalSettings()
{
const QString id = m_ui->settingsTabs->currentWidget()->objectName();
if (id == "javaPage")
APPLICATION->ShowGlobalSettings(this, "java-settings");
else // TODO select tab
APPLICATION->ShowGlobalSettings(this, "minecraft-settings");
}
SettingsObjectPtr MinecraftSettingsWidget::getSettings() const
{
if (m_instance != nullptr)

View File

@ -51,6 +51,8 @@ class MinecraftSettingsWidget : public QWidget {
void loadSettings();
void saveSettings();
void openGlobalSettings();
private:
SettingsObjectPtr getSettings() const;

View File

@ -24,7 +24,7 @@
<number>0</number>
</property>
<item>
<widget class="QCommandLinkButton" name="openGlobalJavaSettingsButton">
<widget class="QCommandLinkButton" name="openGlobalSettingsButton">
<property name="text">
<string>Open &amp;Global Settings</string>
</property>
@ -61,7 +61,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-131</y>
<y>0</y>
<width>610</width>
<height>607</height>
</rect>