mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-29 22:24:26 +02:00
Unify instance and global settings pt.1
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
4a92573235
commit
e6d4e5d78d
@ -59,8 +59,6 @@
|
||||
#include "ui/pages/BasePageProvider.h"
|
||||
#include "ui/pages/global/APIPage.h"
|
||||
#include "ui/pages/global/AccountListPage.h"
|
||||
#include "ui/pages/global/CustomCommandsPage.h"
|
||||
#include "ui/pages/global/EnvironmentVariablesPage.h"
|
||||
#include "ui/pages/global/ExternalToolsPage.h"
|
||||
#include "ui/pages/global/JavaPage.h"
|
||||
#include "ui/pages/global/LanguagePage.h"
|
||||
@ -801,8 +799,6 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
||||
m_globalSettingsProvider->addPage<MinecraftPage>();
|
||||
m_globalSettingsProvider->addPage<JavaPage>();
|
||||
m_globalSettingsProvider->addPage<LanguagePage>();
|
||||
m_globalSettingsProvider->addPage<CustomCommandsPage>();
|
||||
m_globalSettingsProvider->addPage<EnvironmentVariablesPage>();
|
||||
m_globalSettingsProvider->addPage<ProxyPage>();
|
||||
m_globalSettingsProvider->addPage<ExternalToolsPage>();
|
||||
m_globalSettingsProvider->addPage<AccountListPage>();
|
||||
|
@ -908,7 +908,6 @@ SET(LAUNCHER_SOURCES
|
||||
ui/pages/instance/NotesPage.h
|
||||
ui/pages/instance/LogPage.cpp
|
||||
ui/pages/instance/LogPage.h
|
||||
ui/pages/instance/InstanceSettingsPage.cpp
|
||||
ui/pages/instance/InstanceSettingsPage.h
|
||||
ui/pages/instance/ScreenshotsPage.cpp
|
||||
ui/pages/instance/ScreenshotsPage.h
|
||||
@ -922,17 +921,12 @@ SET(LAUNCHER_SOURCES
|
||||
# GUI - global settings pages
|
||||
ui/pages/global/AccountListPage.cpp
|
||||
ui/pages/global/AccountListPage.h
|
||||
ui/pages/global/CustomCommandsPage.cpp
|
||||
ui/pages/global/CustomCommandsPage.h
|
||||
ui/pages/global/EnvironmentVariablesPage.cpp
|
||||
ui/pages/global/EnvironmentVariablesPage.h
|
||||
ui/pages/global/ExternalToolsPage.cpp
|
||||
ui/pages/global/ExternalToolsPage.h
|
||||
ui/pages/global/JavaPage.cpp
|
||||
ui/pages/global/JavaPage.h
|
||||
ui/pages/global/LanguagePage.cpp
|
||||
ui/pages/global/LanguagePage.h
|
||||
ui/pages/global/MinecraftPage.cpp
|
||||
ui/pages/global/MinecraftPage.h
|
||||
ui/pages/global/LauncherPage.cpp
|
||||
ui/pages/global/LauncherPage.h
|
||||
@ -1128,6 +1122,8 @@ SET(LAUNCHER_SOURCES
|
||||
ui/widgets/WideBar.cpp
|
||||
ui/widgets/ThemeCustomizationWidget.h
|
||||
ui/widgets/ThemeCustomizationWidget.cpp
|
||||
ui/widgets/MinecraftSettingsWidget.h
|
||||
ui/widgets/MinecraftSettingsWidget.cpp
|
||||
|
||||
# GUI - instance group view
|
||||
ui/instanceview/InstanceProxyModel.cpp
|
||||
@ -1171,7 +1167,6 @@ qt_wrap_ui(LAUNCHER_UI
|
||||
ui/pages/global/LauncherPage.ui
|
||||
ui/pages/global/APIPage.ui
|
||||
ui/pages/global/ProxyPage.ui
|
||||
ui/pages/global/MinecraftPage.ui
|
||||
ui/pages/global/ExternalToolsPage.ui
|
||||
ui/pages/instance/ExternalResourcesPage.ui
|
||||
ui/pages/instance/NotesPage.ui
|
||||
@ -1179,7 +1174,6 @@ qt_wrap_ui(LAUNCHER_UI
|
||||
ui/pages/instance/ServersPage.ui
|
||||
ui/pages/instance/GameOptionsPage.ui
|
||||
ui/pages/instance/OtherLogsPage.ui
|
||||
ui/pages/instance/InstanceSettingsPage.ui
|
||||
ui/pages/instance/VersionPage.ui
|
||||
ui/pages/instance/ManagedPackPage.ui
|
||||
ui/pages/instance/WorldListPage.ui
|
||||
@ -1202,6 +1196,7 @@ qt_wrap_ui(LAUNCHER_UI
|
||||
ui/widgets/ModFilterWidget.ui
|
||||
ui/widgets/SubTaskProgressBar.ui
|
||||
ui/widgets/ThemeCustomizationWidget.ui
|
||||
ui/widgets/MinecraftSettingsWidget.ui
|
||||
ui/dialogs/CopyInstanceDialog.ui
|
||||
ui/dialogs/ProfileSetupDialog.ui
|
||||
ui/dialogs/ProgressDialog.ui
|
||||
@ -1222,7 +1217,6 @@ qt_wrap_ui(LAUNCHER_UI
|
||||
ui/dialogs/ScrollMessageBox.ui
|
||||
ui/dialogs/BlockedModsDialog.ui
|
||||
ui/dialogs/ChooseProviderDialog.ui
|
||||
|
||||
ui/dialogs/skins/SkinManageDialog.ui
|
||||
)
|
||||
|
||||
|
@ -43,7 +43,7 @@ class InstancePageProvider : protected QObject, public BasePageProvider {
|
||||
values.append(new ServersPage(onesix));
|
||||
// values.append(new GameOptionsPage(onesix.get()));
|
||||
values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots")));
|
||||
values.append(new InstanceSettingsPage(onesix.get()));
|
||||
values.append(new InstanceSettingsPage(onesix));
|
||||
auto logMatcher = inst->getLogFileMatcher();
|
||||
if (logMatcher) {
|
||||
values.append(new OtherLogsPage(inst->getLogFileRoot(), logMatcher));
|
||||
|
@ -1,84 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
*
|
||||
* Copyright 2013-2021 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "CustomCommandsPage.h"
|
||||
#include <QTabBar>
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
CustomCommandsPage::CustomCommandsPage(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
auto verticalLayout = new QVBoxLayout(this);
|
||||
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
|
||||
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
auto tabWidget = new QTabWidget(this);
|
||||
tabWidget->setObjectName(QStringLiteral("tabWidget"));
|
||||
commands = new CustomCommands(this);
|
||||
commands->setContentsMargins(6, 6, 6, 6);
|
||||
tabWidget->addTab(commands, "Foo");
|
||||
tabWidget->tabBar()->hide();
|
||||
verticalLayout->addWidget(tabWidget);
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
CustomCommandsPage::~CustomCommandsPage() {}
|
||||
|
||||
bool CustomCommandsPage::apply()
|
||||
{
|
||||
applySettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CustomCommandsPage::applySettings()
|
||||
{
|
||||
auto s = APPLICATION->settings();
|
||||
s->set("PreLaunchCommand", commands->prelaunchCommand());
|
||||
s->set("WrapperCommand", commands->wrapperCommand());
|
||||
s->set("PostExitCommand", commands->postexitCommand());
|
||||
}
|
||||
|
||||
void CustomCommandsPage::loadSettings()
|
||||
{
|
||||
auto s = APPLICATION->settings();
|
||||
commands->initialize(false, true, s->get("PreLaunchCommand").toString(), s->get("WrapperCommand").toString(),
|
||||
s->get("PostExitCommand").toString());
|
||||
}
|
||||
|
||||
void CustomCommandsPage::retranslate()
|
||||
{
|
||||
commands->retranslate();
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QTabBar>
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "EnvironmentVariablesPage.h"
|
||||
|
||||
EnvironmentVariablesPage::EnvironmentVariablesPage(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
auto verticalLayout = new QVBoxLayout(this);
|
||||
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
|
||||
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
auto tabWidget = new QTabWidget(this);
|
||||
tabWidget->setObjectName(QStringLiteral("tabWidget"));
|
||||
variables = new EnvironmentVariables(this);
|
||||
variables->setContentsMargins(6, 6, 6, 6);
|
||||
tabWidget->addTab(variables, "Foo");
|
||||
tabWidget->tabBar()->hide();
|
||||
verticalLayout->addWidget(tabWidget);
|
||||
|
||||
variables->initialize(false, false, APPLICATION->settings()->get("Env").toMap());
|
||||
}
|
||||
|
||||
QString EnvironmentVariablesPage::displayName() const
|
||||
{
|
||||
return tr("Environment Variables");
|
||||
}
|
||||
|
||||
QIcon EnvironmentVariablesPage::icon() const
|
||||
{
|
||||
return APPLICATION->getThemedIcon("environment-variables");
|
||||
}
|
||||
|
||||
QString EnvironmentVariablesPage::id() const
|
||||
{
|
||||
return "environment-variables";
|
||||
}
|
||||
|
||||
QString EnvironmentVariablesPage::helpPage() const
|
||||
{
|
||||
return "Environment-variables";
|
||||
}
|
||||
|
||||
bool EnvironmentVariablesPage::apply()
|
||||
{
|
||||
APPLICATION->settings()->set("Env", variables->value());
|
||||
return true;
|
||||
}
|
||||
|
||||
void EnvironmentVariablesPage::retranslate()
|
||||
{
|
||||
variables->retranslate();
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
#include "ui/pages/BasePage.h"
|
||||
#include "ui/widgets/EnvironmentVariables.h"
|
||||
|
||||
class EnvironmentVariablesPage : public QWidget, public BasePage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EnvironmentVariablesPage(QWidget* parent = nullptr);
|
||||
|
||||
QString displayName() const override;
|
||||
QIcon icon() const override;
|
||||
QString id() const override;
|
||||
QString helpPage() const override;
|
||||
|
||||
bool apply() override;
|
||||
void retranslate() override;
|
||||
|
||||
private:
|
||||
EnvironmentVariables* variables;
|
||||
};
|
@ -1,185 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
*
|
||||
* Copyright 2013-2021 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "MinecraftPage.h"
|
||||
#include "BuildConfig.h"
|
||||
#include "ui_MinecraftPage.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <QTabBar>
|
||||
|
||||
#include "Application.h"
|
||||
#include "settings/SettingsObject.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include "MangoHud.h"
|
||||
#endif
|
||||
|
||||
MinecraftPage::MinecraftPage(QWidget* parent) : QWidget(parent), ui(new Ui::MinecraftPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->useNativeGLFWCheck, &QAbstractButton::toggled, this, &MinecraftPage::onUseNativeGLFWChanged);
|
||||
connect(ui->useNativeOpenALCheck, &QAbstractButton::toggled, this, &MinecraftPage::onUseNativeOpenALChanged);
|
||||
loadSettings();
|
||||
updateCheckboxStuff();
|
||||
}
|
||||
|
||||
MinecraftPage::~MinecraftPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool MinecraftPage::apply()
|
||||
{
|
||||
applySettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
void MinecraftPage::updateCheckboxStuff()
|
||||
{
|
||||
ui->windowWidthSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked());
|
||||
ui->windowHeightSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked());
|
||||
}
|
||||
|
||||
void MinecraftPage::on_maximizedCheckBox_clicked(bool checked)
|
||||
{
|
||||
Q_UNUSED(checked);
|
||||
updateCheckboxStuff();
|
||||
}
|
||||
|
||||
void MinecraftPage::onUseNativeGLFWChanged(bool checked)
|
||||
{
|
||||
ui->lineEditGLFWPath->setEnabled(checked);
|
||||
}
|
||||
|
||||
void MinecraftPage::onUseNativeOpenALChanged(bool checked)
|
||||
{
|
||||
ui->lineEditOpenALPath->setEnabled(checked);
|
||||
}
|
||||
|
||||
void MinecraftPage::applySettings()
|
||||
{
|
||||
auto s = APPLICATION->settings();
|
||||
|
||||
// Window Size
|
||||
s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
|
||||
s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
|
||||
s->set("MinecraftWinHeight", ui->windowHeightSpinBox->value());
|
||||
|
||||
// Native library workarounds
|
||||
s->set("UseNativeGLFW", ui->useNativeGLFWCheck->isChecked());
|
||||
s->set("CustomGLFWPath", ui->lineEditGLFWPath->text());
|
||||
s->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked());
|
||||
s->set("CustomOpenALPath", ui->lineEditOpenALPath->text());
|
||||
|
||||
// Peformance related options
|
||||
s->set("EnableFeralGamemode", ui->enableFeralGamemodeCheck->isChecked());
|
||||
s->set("EnableMangoHud", ui->enableMangoHud->isChecked());
|
||||
s->set("UseDiscreteGpu", ui->useDiscreteGpuCheck->isChecked());
|
||||
s->set("UseZink", ui->useZink->isChecked());
|
||||
|
||||
// Game time
|
||||
s->set("ShowGameTime", ui->showGameTime->isChecked());
|
||||
s->set("ShowGlobalGameTime", ui->showGlobalGameTime->isChecked());
|
||||
s->set("RecordGameTime", ui->recordGameTime->isChecked());
|
||||
s->set("ShowGameTimeWithoutDays", ui->showGameTimeWithoutDays->isChecked());
|
||||
|
||||
// Miscellaneous
|
||||
s->set("CloseAfterLaunch", ui->closeAfterLaunchCheck->isChecked());
|
||||
s->set("QuitAfterGameStop", ui->quitAfterGameStopCheck->isChecked());
|
||||
|
||||
// Legacy settings
|
||||
s->set("OnlineFixes", ui->onlineFixes->isChecked());
|
||||
}
|
||||
|
||||
void MinecraftPage::loadSettings()
|
||||
{
|
||||
auto s = APPLICATION->settings();
|
||||
|
||||
// Window Size
|
||||
ui->maximizedCheckBox->setChecked(s->get("LaunchMaximized").toBool());
|
||||
ui->windowWidthSpinBox->setValue(s->get("MinecraftWinWidth").toInt());
|
||||
ui->windowHeightSpinBox->setValue(s->get("MinecraftWinHeight").toInt());
|
||||
|
||||
ui->useNativeGLFWCheck->setChecked(s->get("UseNativeGLFW").toBool());
|
||||
ui->lineEditGLFWPath->setText(s->get("CustomGLFWPath").toString());
|
||||
ui->lineEditGLFWPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.GLFW_LIBRARY_NAME));
|
||||
#ifdef Q_OS_LINUX
|
||||
if (!APPLICATION->m_detectedGLFWPath.isEmpty())
|
||||
ui->lineEditGLFWPath->setPlaceholderText(tr("Auto detected path: %1").arg(APPLICATION->m_detectedGLFWPath));
|
||||
#endif
|
||||
ui->useNativeOpenALCheck->setChecked(s->get("UseNativeOpenAL").toBool());
|
||||
ui->lineEditOpenALPath->setText(s->get("CustomOpenALPath").toString());
|
||||
ui->lineEditOpenALPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.OPENAL_LIBRARY_NAME));
|
||||
#ifdef Q_OS_LINUX
|
||||
if (!APPLICATION->m_detectedOpenALPath.isEmpty())
|
||||
ui->lineEditOpenALPath->setPlaceholderText(tr("Auto detected path: %1").arg(APPLICATION->m_detectedOpenALPath));
|
||||
#endif
|
||||
|
||||
ui->enableFeralGamemodeCheck->setChecked(s->get("EnableFeralGamemode").toBool());
|
||||
ui->enableMangoHud->setChecked(s->get("EnableMangoHud").toBool());
|
||||
ui->useDiscreteGpuCheck->setChecked(s->get("UseDiscreteGpu").toBool());
|
||||
ui->useZink->setChecked(s->get("UseZink").toBool());
|
||||
|
||||
#if !defined(Q_OS_LINUX)
|
||||
ui->perfomanceGroupBox->setVisible(false);
|
||||
#endif
|
||||
|
||||
if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) {
|
||||
ui->enableFeralGamemodeCheck->setDisabled(true);
|
||||
ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system."));
|
||||
}
|
||||
|
||||
if (!(APPLICATION->capabilities() & Application::SupportsMangoHud)) {
|
||||
ui->enableMangoHud->setDisabled(true);
|
||||
ui->enableMangoHud->setToolTip(tr("MangoHud could not be found on your system."));
|
||||
}
|
||||
|
||||
ui->showGameTime->setChecked(s->get("ShowGameTime").toBool());
|
||||
ui->showGlobalGameTime->setChecked(s->get("ShowGlobalGameTime").toBool());
|
||||
ui->recordGameTime->setChecked(s->get("RecordGameTime").toBool());
|
||||
ui->showGameTimeWithoutDays->setChecked(s->get("ShowGameTimeWithoutDays").toBool());
|
||||
|
||||
ui->closeAfterLaunchCheck->setChecked(s->get("CloseAfterLaunch").toBool());
|
||||
ui->quitAfterGameStopCheck->setChecked(s->get("QuitAfterGameStop").toBool());
|
||||
|
||||
ui->onlineFixes->setChecked(s->get("OnlineFixes").toBool());
|
||||
}
|
||||
|
||||
void MinecraftPage::retranslate()
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
@ -39,6 +39,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include <Application.h>
|
||||
#include <ui/widgets/MinecraftSettingsWidget.h>
|
||||
#include "java/JavaChecker.h"
|
||||
#include "ui/pages/BasePage.h"
|
||||
|
||||
@ -48,31 +49,20 @@ namespace Ui {
|
||||
class MinecraftPage;
|
||||
}
|
||||
|
||||
class MinecraftPage : public QWidget, public BasePage {
|
||||
class MinecraftPage : public MinecraftSettingsWidget, public BasePage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MinecraftPage(QWidget* parent = 0);
|
||||
~MinecraftPage();
|
||||
explicit MinecraftPage(QWidget* parent = nullptr) : MinecraftSettingsWidget(nullptr, parent) {}
|
||||
~MinecraftPage() override {}
|
||||
|
||||
QString displayName() const override { return tr("Minecraft"); }
|
||||
QIcon icon() const override { return APPLICATION->getThemedIcon("minecraft"); }
|
||||
QString id() const override { return "minecraft-settings"; }
|
||||
QString helpPage() const override { return "Minecraft-settings"; }
|
||||
bool apply() override;
|
||||
void retranslate() override;
|
||||
|
||||
private:
|
||||
void updateCheckboxStuff();
|
||||
void applySettings();
|
||||
void loadSettings();
|
||||
|
||||
private slots:
|
||||
void on_maximizedCheckBox_clicked(bool checked);
|
||||
|
||||
void onUseNativeGLFWChanged(bool checked);
|
||||
void onUseNativeOpenALChanged(bool checked);
|
||||
|
||||
private:
|
||||
Ui::MinecraftPage* ui;
|
||||
bool apply() override
|
||||
{
|
||||
saveSettings();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -1,611 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
* Copyright (C) 2022 TheKodeToad <TheKodeToad@proton.me>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
*
|
||||
* Copyright 2013-2021 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "InstanceSettingsPage.h"
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/WorldList.h"
|
||||
#include "settings/Setting.h"
|
||||
#include "ui/dialogs/CustomMessageBox.h"
|
||||
#include "ui/java/InstallJavaDialog.h"
|
||||
#include "ui_InstanceSettingsPage.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <sys.h>
|
||||
|
||||
#include "ui/dialogs/VersionSelectDialog.h"
|
||||
#include "ui/widgets/CustomCommands.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "BuildConfig.h"
|
||||
#include "JavaCommon.h"
|
||||
#include "minecraft/auth/AccountList.h"
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include "java/JavaInstallList.h"
|
||||
#include "java/JavaUtils.h"
|
||||
|
||||
InstanceSettingsPage::InstanceSettingsPage(BaseInstance* inst, QWidget* parent)
|
||||
: QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst)
|
||||
{
|
||||
m_settings = inst->settings();
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->javaDownloadBtn->setHidden(!BuildConfig.JAVA_DOWNLOADER_ENABLED);
|
||||
|
||||
connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked);
|
||||
connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings);
|
||||
connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings);
|
||||
connect(ui->instanceAccountSelector, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&InstanceSettingsPage::changeInstanceAccount);
|
||||
|
||||
connect(ui->useNativeGLFWCheck, &QAbstractButton::toggled, this, &InstanceSettingsPage::onUseNativeGLFWChanged);
|
||||
connect(ui->useNativeOpenALCheck, &QAbstractButton::toggled, this, &InstanceSettingsPage::onUseNativeOpenALChanged);
|
||||
|
||||
auto mInst = dynamic_cast<MinecraftInstance*>(inst);
|
||||
m_world_quickplay_supported = mInst && mInst->traits().contains("feature:is_quick_play_singleplayer");
|
||||
if (m_world_quickplay_supported) {
|
||||
auto worlds = mInst->worldList();
|
||||
worlds->update();
|
||||
for (const auto& world : worlds->allWorlds()) {
|
||||
ui->worldsCb->addItem(world.folderName());
|
||||
}
|
||||
} else {
|
||||
ui->worldsCb->hide();
|
||||
ui->worldJoinButton->hide();
|
||||
ui->serverJoinAddressButton->setChecked(true);
|
||||
ui->serverJoinAddress->setEnabled(true);
|
||||
ui->serverJoinAddressButton->setStyleSheet("QRadioButton::indicator { width: 0px; height: 0px; }");
|
||||
}
|
||||
|
||||
loadSettings();
|
||||
|
||||
updateThresholds();
|
||||
}
|
||||
|
||||
InstanceSettingsPage::~InstanceSettingsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::globalSettingsButtonClicked(bool)
|
||||
{
|
||||
switch (ui->settingsTabs->currentIndex()) {
|
||||
case 0:
|
||||
APPLICATION->ShowGlobalSettings(this, "java-settings");
|
||||
return;
|
||||
case 2:
|
||||
APPLICATION->ShowGlobalSettings(this, "custom-commands");
|
||||
return;
|
||||
case 3:
|
||||
APPLICATION->ShowGlobalSettings(this, "environment-variables");
|
||||
return;
|
||||
default:
|
||||
APPLICATION->ShowGlobalSettings(this, "minecraft-settings");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool InstanceSettingsPage::apply()
|
||||
{
|
||||
applySettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::applySettings()
|
||||
{
|
||||
SettingsObject::Lock lock(m_settings);
|
||||
|
||||
// Miscellaneous
|
||||
bool miscellaneous = ui->miscellaneousSettingsBox->isChecked();
|
||||
m_settings->set("OverrideMiscellaneous", miscellaneous);
|
||||
if (miscellaneous) {
|
||||
m_settings->set("CloseAfterLaunch", ui->closeAfterLaunchCheck->isChecked());
|
||||
m_settings->set("QuitAfterGameStop", ui->quitAfterGameStopCheck->isChecked());
|
||||
} else {
|
||||
m_settings->reset("CloseAfterLaunch");
|
||||
m_settings->reset("QuitAfterGameStop");
|
||||
}
|
||||
|
||||
// Console
|
||||
bool console = ui->consoleSettingsBox->isChecked();
|
||||
m_settings->set("OverrideConsole", console);
|
||||
if (console) {
|
||||
m_settings->set("ShowConsole", ui->showConsoleCheck->isChecked());
|
||||
m_settings->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
|
||||
m_settings->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked());
|
||||
} else {
|
||||
m_settings->reset("ShowConsole");
|
||||
m_settings->reset("AutoCloseConsole");
|
||||
m_settings->reset("ShowConsoleOnError");
|
||||
}
|
||||
|
||||
// Window Size
|
||||
bool window = ui->windowSizeGroupBox->isChecked();
|
||||
m_settings->set("OverrideWindow", window);
|
||||
if (window) {
|
||||
m_settings->set("LaunchMaximized", ui->maximizedCheckBox->isChecked());
|
||||
m_settings->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
|
||||
m_settings->set("MinecraftWinHeight", ui->windowHeightSpinBox->value());
|
||||
} else {
|
||||
m_settings->reset("LaunchMaximized");
|
||||
m_settings->reset("MinecraftWinWidth");
|
||||
m_settings->reset("MinecraftWinHeight");
|
||||
}
|
||||
|
||||
// Memory
|
||||
bool memory = ui->memoryGroupBox->isChecked();
|
||||
m_settings->set("OverrideMemory", memory);
|
||||
if (memory) {
|
||||
int min = ui->minMemSpinBox->value();
|
||||
int max = ui->maxMemSpinBox->value();
|
||||
if (min < max) {
|
||||
m_settings->set("MinMemAlloc", min);
|
||||
m_settings->set("MaxMemAlloc", max);
|
||||
} else {
|
||||
m_settings->set("MinMemAlloc", max);
|
||||
m_settings->set("MaxMemAlloc", min);
|
||||
}
|
||||
m_settings->set("PermGen", ui->permGenSpinBox->value());
|
||||
} else {
|
||||
m_settings->reset("MinMemAlloc");
|
||||
m_settings->reset("MaxMemAlloc");
|
||||
m_settings->reset("PermGen");
|
||||
}
|
||||
|
||||
// Java Install Settings
|
||||
bool javaInstall = ui->javaSettingsGroupBox->isChecked();
|
||||
m_settings->set("OverrideJavaLocation", javaInstall);
|
||||
if (javaInstall) {
|
||||
m_settings->set("JavaPath", ui->javaPathTextBox->text());
|
||||
m_settings->set("IgnoreJavaCompatibility", ui->skipCompatibilityCheckbox->isChecked());
|
||||
} else {
|
||||
m_settings->reset("JavaPath");
|
||||
m_settings->reset("IgnoreJavaCompatibility");
|
||||
}
|
||||
|
||||
// Java arguments
|
||||
bool javaArgs = ui->javaArgumentsGroupBox->isChecked();
|
||||
m_settings->set("OverrideJavaArgs", javaArgs);
|
||||
if (javaArgs) {
|
||||
m_settings->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " "));
|
||||
} else {
|
||||
m_settings->reset("JvmArgs");
|
||||
}
|
||||
|
||||
// Custom Commands
|
||||
bool custcmd = ui->customCommands->checked();
|
||||
m_settings->set("OverrideCommands", custcmd);
|
||||
if (custcmd) {
|
||||
m_settings->set("PreLaunchCommand", ui->customCommands->prelaunchCommand());
|
||||
m_settings->set("WrapperCommand", ui->customCommands->wrapperCommand());
|
||||
m_settings->set("PostExitCommand", ui->customCommands->postexitCommand());
|
||||
} else {
|
||||
m_settings->reset("PreLaunchCommand");
|
||||
m_settings->reset("WrapperCommand");
|
||||
m_settings->reset("PostExitCommand");
|
||||
}
|
||||
|
||||
// Environment Variables
|
||||
auto env = ui->environmentVariables->override();
|
||||
m_settings->set("OverrideEnv", env);
|
||||
if (env)
|
||||
m_settings->set("Env", ui->environmentVariables->value());
|
||||
else
|
||||
m_settings->reset("Env");
|
||||
|
||||
// Workarounds
|
||||
bool workarounds = ui->nativeWorkaroundsGroupBox->isChecked();
|
||||
m_settings->set("OverrideNativeWorkarounds", workarounds);
|
||||
if (workarounds) {
|
||||
m_settings->set("UseNativeGLFW", ui->useNativeGLFWCheck->isChecked());
|
||||
m_settings->set("CustomGLFWPath", ui->lineEditGLFWPath->text());
|
||||
m_settings->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked());
|
||||
m_settings->set("CustomOpenALPath", ui->lineEditOpenALPath->text());
|
||||
} else {
|
||||
m_settings->reset("UseNativeGLFW");
|
||||
m_settings->reset("CustomGLFWPath");
|
||||
m_settings->reset("UseNativeOpenAL");
|
||||
m_settings->reset("CustomOpenALPath");
|
||||
}
|
||||
|
||||
// Performance
|
||||
bool performance = ui->perfomanceGroupBox->isChecked();
|
||||
m_settings->set("OverridePerformance", performance);
|
||||
if (performance) {
|
||||
m_settings->set("EnableFeralGamemode", ui->enableFeralGamemodeCheck->isChecked());
|
||||
m_settings->set("EnableMangoHud", ui->enableMangoHud->isChecked());
|
||||
m_settings->set("UseDiscreteGpu", ui->useDiscreteGpuCheck->isChecked());
|
||||
m_settings->set("UseZink", ui->useZink->isChecked());
|
||||
|
||||
} else {
|
||||
m_settings->reset("EnableFeralGamemode");
|
||||
m_settings->reset("EnableMangoHud");
|
||||
m_settings->reset("UseDiscreteGpu");
|
||||
m_settings->reset("UseZink");
|
||||
}
|
||||
|
||||
// Game time
|
||||
bool gameTime = ui->gameTimeGroupBox->isChecked();
|
||||
m_settings->set("OverrideGameTime", gameTime);
|
||||
if (gameTime) {
|
||||
m_settings->set("ShowGameTime", ui->showGameTime->isChecked());
|
||||
m_settings->set("RecordGameTime", ui->recordGameTime->isChecked());
|
||||
} else {
|
||||
m_settings->reset("ShowGameTime");
|
||||
m_settings->reset("RecordGameTime");
|
||||
}
|
||||
|
||||
// Join server on launch
|
||||
bool joinServerOnLaunch = ui->serverJoinGroupBox->isChecked();
|
||||
m_settings->set("JoinServerOnLaunch", joinServerOnLaunch);
|
||||
if (joinServerOnLaunch) {
|
||||
if (ui->serverJoinAddressButton->isChecked() || !m_world_quickplay_supported) {
|
||||
m_settings->set("JoinServerOnLaunchAddress", ui->serverJoinAddress->text());
|
||||
m_settings->reset("JoinWorldOnLaunch");
|
||||
} else {
|
||||
m_settings->set("JoinWorldOnLaunch", ui->worldsCb->currentText());
|
||||
m_settings->reset("JoinServerOnLaunchAddress");
|
||||
}
|
||||
} else {
|
||||
m_settings->reset("JoinServerOnLaunchAddress");
|
||||
m_settings->reset("JoinWorldOnLaunch");
|
||||
}
|
||||
|
||||
// Use an account for this instance
|
||||
bool useAccountForInstance = ui->instanceAccountGroupBox->isChecked();
|
||||
m_settings->set("UseAccountForInstance", useAccountForInstance);
|
||||
if (!useAccountForInstance) {
|
||||
m_settings->reset("InstanceAccountId");
|
||||
}
|
||||
|
||||
bool overrideLegacySettings = ui->legacySettingsGroupBox->isChecked();
|
||||
m_settings->set("OverrideLegacySettings", overrideLegacySettings);
|
||||
if (overrideLegacySettings) {
|
||||
m_settings->set("OnlineFixes", ui->onlineFixes->isChecked());
|
||||
} else {
|
||||
m_settings->reset("OnlineFixes");
|
||||
}
|
||||
|
||||
// FIXME: This should probably be called by a signal instead
|
||||
m_instance->updateRuntimeContext();
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::loadSettings()
|
||||
{
|
||||
// Miscellaneous
|
||||
ui->miscellaneousSettingsBox->setChecked(m_settings->get("OverrideMiscellaneous").toBool());
|
||||
ui->closeAfterLaunchCheck->setChecked(m_settings->get("CloseAfterLaunch").toBool());
|
||||
ui->quitAfterGameStopCheck->setChecked(m_settings->get("QuitAfterGameStop").toBool());
|
||||
|
||||
// Console
|
||||
ui->consoleSettingsBox->setChecked(m_settings->get("OverrideConsole").toBool());
|
||||
ui->showConsoleCheck->setChecked(m_settings->get("ShowConsole").toBool());
|
||||
ui->autoCloseConsoleCheck->setChecked(m_settings->get("AutoCloseConsole").toBool());
|
||||
ui->showConsoleErrorCheck->setChecked(m_settings->get("ShowConsoleOnError").toBool());
|
||||
|
||||
// Window Size
|
||||
ui->windowSizeGroupBox->setChecked(m_settings->get("OverrideWindow").toBool());
|
||||
ui->maximizedCheckBox->setChecked(m_settings->get("LaunchMaximized").toBool());
|
||||
ui->maximizedWarning->setVisible(m_settings->get("LaunchMaximized").toBool() && !m_instance->isLegacy());
|
||||
ui->windowWidthSpinBox->setValue(m_settings->get("MinecraftWinWidth").toInt());
|
||||
ui->windowHeightSpinBox->setValue(m_settings->get("MinecraftWinHeight").toInt());
|
||||
|
||||
// Memory
|
||||
ui->memoryGroupBox->setChecked(m_settings->get("OverrideMemory").toBool());
|
||||
int min = m_settings->get("MinMemAlloc").toInt();
|
||||
int max = m_settings->get("MaxMemAlloc").toInt();
|
||||
if (min < max) {
|
||||
ui->minMemSpinBox->setValue(min);
|
||||
ui->maxMemSpinBox->setValue(max);
|
||||
} else {
|
||||
ui->minMemSpinBox->setValue(max);
|
||||
ui->maxMemSpinBox->setValue(min);
|
||||
}
|
||||
ui->permGenSpinBox->setValue(m_settings->get("PermGen").toInt());
|
||||
bool permGenVisible = m_settings->get("PermGenVisible").toBool();
|
||||
ui->permGenSpinBox->setVisible(permGenVisible);
|
||||
ui->labelPermGen->setVisible(permGenVisible);
|
||||
ui->labelPermgenNote->setVisible(permGenVisible);
|
||||
|
||||
// Java Settings
|
||||
bool overrideLocation = m_settings->get("OverrideJavaLocation").toBool();
|
||||
bool overrideArgs = m_settings->get("OverrideJavaArgs").toBool();
|
||||
|
||||
connect(m_settings->getSetting("OverrideJavaLocation").get(), &Setting::SettingChanged, ui->javaSettingsGroupBox,
|
||||
[this] { ui->javaSettingsGroupBox->setChecked(m_settings->get("OverrideJavaLocation").toBool()); });
|
||||
ui->javaSettingsGroupBox->setChecked(overrideLocation);
|
||||
ui->javaPathTextBox->setText(m_settings->get("JavaPath").toString());
|
||||
connect(m_settings->getSetting("JavaPath").get(), &Setting::SettingChanged, ui->javaSettingsGroupBox,
|
||||
[this] { ui->javaPathTextBox->setText(m_settings->get("JavaPath").toString()); });
|
||||
|
||||
ui->skipCompatibilityCheckbox->setChecked(m_settings->get("IgnoreJavaCompatibility").toBool());
|
||||
|
||||
ui->javaArgumentsGroupBox->setChecked(overrideArgs);
|
||||
ui->jvmArgsTextBox->setPlainText(m_settings->get("JvmArgs").toString());
|
||||
|
||||
// Custom commands
|
||||
ui->customCommands->initialize(true, m_settings->get("OverrideCommands").toBool(), m_settings->get("PreLaunchCommand").toString(),
|
||||
m_settings->get("WrapperCommand").toString(), m_settings->get("PostExitCommand").toString());
|
||||
|
||||
// Environment variables
|
||||
ui->environmentVariables->initialize(true, m_settings->get("OverrideEnv").toBool(), m_settings->get("Env").toMap());
|
||||
|
||||
// Workarounds
|
||||
ui->nativeWorkaroundsGroupBox->setChecked(m_settings->get("OverrideNativeWorkarounds").toBool());
|
||||
ui->useNativeGLFWCheck->setChecked(m_settings->get("UseNativeGLFW").toBool());
|
||||
ui->lineEditGLFWPath->setText(m_settings->get("CustomGLFWPath").toString());
|
||||
#ifdef Q_OS_LINUX
|
||||
ui->lineEditGLFWPath->setPlaceholderText(APPLICATION->m_detectedGLFWPath);
|
||||
#else
|
||||
ui->lineEditGLFWPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.GLFW_LIBRARY_NAME));
|
||||
#endif
|
||||
ui->useNativeOpenALCheck->setChecked(m_settings->get("UseNativeOpenAL").toBool());
|
||||
ui->lineEditOpenALPath->setText(m_settings->get("CustomOpenALPath").toString());
|
||||
#ifdef Q_OS_LINUX
|
||||
ui->lineEditOpenALPath->setPlaceholderText(APPLICATION->m_detectedOpenALPath);
|
||||
#else
|
||||
ui->lineEditOpenALPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.OPENAL_LIBRARY_NAME));
|
||||
#endif
|
||||
|
||||
// Performance
|
||||
ui->perfomanceGroupBox->setChecked(m_settings->get("OverridePerformance").toBool());
|
||||
ui->enableFeralGamemodeCheck->setChecked(m_settings->get("EnableFeralGamemode").toBool());
|
||||
ui->enableMangoHud->setChecked(m_settings->get("EnableMangoHud").toBool());
|
||||
ui->useDiscreteGpuCheck->setChecked(m_settings->get("UseDiscreteGpu").toBool());
|
||||
ui->useZink->setChecked(m_settings->get("UseZink").toBool());
|
||||
|
||||
#if !defined(Q_OS_LINUX)
|
||||
ui->settingsTabs->setTabVisible(ui->settingsTabs->indexOf(ui->performancePage), false);
|
||||
#endif
|
||||
|
||||
if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) {
|
||||
ui->enableFeralGamemodeCheck->setDisabled(true);
|
||||
ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system."));
|
||||
}
|
||||
|
||||
if (!(APPLICATION->capabilities() & Application::SupportsMangoHud)) {
|
||||
ui->enableMangoHud->setDisabled(true);
|
||||
ui->enableMangoHud->setToolTip(tr("MangoHud could not be found on your system."));
|
||||
}
|
||||
|
||||
// Miscellanous
|
||||
ui->gameTimeGroupBox->setChecked(m_settings->get("OverrideGameTime").toBool());
|
||||
ui->showGameTime->setChecked(m_settings->get("ShowGameTime").toBool());
|
||||
ui->recordGameTime->setChecked(m_settings->get("RecordGameTime").toBool());
|
||||
|
||||
ui->serverJoinGroupBox->setChecked(m_settings->get("JoinServerOnLaunch").toBool());
|
||||
|
||||
if (auto server = m_settings->get("JoinServerOnLaunchAddress").toString(); !server.isEmpty()) {
|
||||
ui->serverJoinAddress->setText(server);
|
||||
ui->serverJoinAddressButton->setChecked(true);
|
||||
ui->worldJoinButton->setChecked(false);
|
||||
ui->serverJoinAddress->setEnabled(true);
|
||||
ui->worldsCb->setEnabled(false);
|
||||
} else if (auto world = m_settings->get("JoinWorldOnLaunch").toString(); !world.isEmpty() && m_world_quickplay_supported) {
|
||||
ui->worldsCb->setCurrentText(world);
|
||||
ui->serverJoinAddressButton->setChecked(false);
|
||||
ui->worldJoinButton->setChecked(true);
|
||||
ui->serverJoinAddress->setEnabled(false);
|
||||
ui->worldsCb->setEnabled(true);
|
||||
} else {
|
||||
ui->serverJoinAddressButton->setChecked(true);
|
||||
ui->worldJoinButton->setChecked(false);
|
||||
ui->serverJoinAddress->setEnabled(true);
|
||||
ui->worldsCb->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->instanceAccountGroupBox->setChecked(m_settings->get("UseAccountForInstance").toBool());
|
||||
updateAccountsMenu();
|
||||
|
||||
ui->legacySettingsGroupBox->setChecked(m_settings->get("OverrideLegacySettings").toBool());
|
||||
ui->onlineFixes->setChecked(m_settings->get("OnlineFixes").toBool());
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::on_javaDownloadBtn_clicked()
|
||||
{
|
||||
auto jdialog = new Java::InstallDialog({}, m_instance, this);
|
||||
jdialog->exec();
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::on_javaDetectBtn_clicked()
|
||||
{
|
||||
if (JavaUtils::getJavaCheckPath().isEmpty()) {
|
||||
JavaCommon::javaCheckNotFound(this);
|
||||
return;
|
||||
}
|
||||
|
||||
JavaInstallPtr java;
|
||||
|
||||
VersionSelectDialog vselect(APPLICATION->javalist().get(), tr("Select a Java version"), this, true);
|
||||
vselect.setResizeOn(2);
|
||||
vselect.exec();
|
||||
|
||||
if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) {
|
||||
java = std::dynamic_pointer_cast<JavaInstall>(vselect.selectedVersion());
|
||||
ui->javaPathTextBox->setText(java->path);
|
||||
bool visible = java->id.requiresPermGen() && m_settings->get("OverrideMemory").toBool();
|
||||
ui->permGenSpinBox->setVisible(visible);
|
||||
ui->labelPermGen->setVisible(visible);
|
||||
ui->labelPermgenNote->setVisible(visible);
|
||||
m_settings->set("PermGenVisible", visible);
|
||||
|
||||
if (!java->is_64bit && m_settings->get("MaxMemAlloc").toInt() > 2048) {
|
||||
CustomMessageBox::selectable(this, tr("Confirm Selection"),
|
||||
tr("You selected a 32-bit version of Java.\n"
|
||||
"This installation does not support more than 2048MiB of RAM.\n"
|
||||
"Please make sure that the maximum memory value is lower."),
|
||||
QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Ok)
|
||||
->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::on_javaBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
|
||||
|
||||
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
|
||||
if (raw_path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QString cooked_path = FS::NormalizePath(raw_path);
|
||||
|
||||
QFileInfo javaInfo(cooked_path);
|
||||
if (!javaInfo.exists() || !javaInfo.isExecutable()) {
|
||||
return;
|
||||
}
|
||||
ui->javaPathTextBox->setText(cooked_path);
|
||||
|
||||
// custom Java could be anything... enable perm gen option
|
||||
ui->permGenSpinBox->setVisible(true);
|
||||
ui->labelPermGen->setVisible(true);
|
||||
ui->labelPermgenNote->setVisible(true);
|
||||
m_settings->set("PermGenVisible", true);
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::on_javaTestBtn_clicked()
|
||||
{
|
||||
if (checker) {
|
||||
return;
|
||||
}
|
||||
checker.reset(new JavaCommon::TestCheck(this, ui->javaPathTextBox->text(), ui->jvmArgsTextBox->toPlainText().replace("\n", " "),
|
||||
ui->minMemSpinBox->value(), ui->maxMemSpinBox->value(), ui->permGenSpinBox->value()));
|
||||
connect(checker.get(), SIGNAL(finished()), SLOT(checkerFinished()));
|
||||
checker->run();
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::onUseNativeGLFWChanged(bool checked)
|
||||
{
|
||||
ui->lineEditGLFWPath->setEnabled(checked);
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::onUseNativeOpenALChanged(bool checked)
|
||||
{
|
||||
ui->lineEditOpenALPath->setEnabled(checked);
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::updateAccountsMenu()
|
||||
{
|
||||
ui->instanceAccountSelector->clear();
|
||||
auto accounts = APPLICATION->accounts();
|
||||
int accountIndex = accounts->findAccountByProfileId(m_settings->get("InstanceAccountId").toString());
|
||||
|
||||
for (int i = 0; i < accounts->count(); i++) {
|
||||
MinecraftAccountPtr account = accounts->at(i);
|
||||
ui->instanceAccountSelector->addItem(getFaceForAccount(account), account->profileName(), i);
|
||||
if (i == accountIndex)
|
||||
ui->instanceAccountSelector->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
QIcon InstanceSettingsPage::getFaceForAccount(MinecraftAccountPtr account)
|
||||
{
|
||||
if (auto face = account->getFace(); !face.isNull()) {
|
||||
return face;
|
||||
}
|
||||
|
||||
return APPLICATION->getThemedIcon("noaccount");
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::changeInstanceAccount(int index)
|
||||
{
|
||||
auto accounts = APPLICATION->accounts();
|
||||
if (index != -1 && accounts->at(index) && ui->instanceAccountGroupBox->isChecked()) {
|
||||
auto account = accounts->at(index);
|
||||
m_settings->set("InstanceAccountId", account->profileId());
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::on_maxMemSpinBox_valueChanged([[maybe_unused]] int i)
|
||||
{
|
||||
updateThresholds();
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::checkerFinished()
|
||||
{
|
||||
checker.reset();
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::retranslate()
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
ui->customCommands->retranslate(); // TODO: why is this seperate from the others?
|
||||
ui->environmentVariables->retranslate();
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::updateThresholds()
|
||||
{
|
||||
auto sysMiB = Sys::getSystemRam() / Sys::mebibyte;
|
||||
unsigned int maxMem = ui->maxMemSpinBox->value();
|
||||
unsigned int minMem = ui->minMemSpinBox->value();
|
||||
|
||||
QString iconName;
|
||||
|
||||
if (maxMem >= sysMiB) {
|
||||
iconName = "status-bad";
|
||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity."));
|
||||
} else if (maxMem > (sysMiB * 0.9)) {
|
||||
iconName = "status-yellow";
|
||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity."));
|
||||
} else if (maxMem < minMem) {
|
||||
iconName = "status-yellow";
|
||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value"));
|
||||
} else {
|
||||
iconName = "status-good";
|
||||
ui->labelMaxMemIcon->setToolTip("");
|
||||
}
|
||||
|
||||
{
|
||||
auto height = ui->labelMaxMemIcon->fontInfo().pixelSize();
|
||||
QIcon icon = APPLICATION->getThemedIcon(iconName);
|
||||
QPixmap pix = icon.pixmap(height, height);
|
||||
ui->labelMaxMemIcon->setPixmap(pix);
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::on_serverJoinAddressButton_toggled(bool checked)
|
||||
{
|
||||
ui->serverJoinAddress->setEnabled(checked);
|
||||
}
|
||||
|
||||
void InstanceSettingsPage::on_worldJoinButton_toggled(bool checked)
|
||||
{
|
||||
ui->worldsCb->setEnabled(checked);
|
||||
}
|
@ -35,63 +35,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Application.h>
|
||||
#include <BaseInstance.h>
|
||||
#include <ui/pages/BasePage.h>
|
||||
#include <ui/widgets/MinecraftSettingsWidget.h>
|
||||
#include <QWidget>
|
||||
|
||||
#include <QObjectPtr.h>
|
||||
#include <QMenu>
|
||||
#include "Application.h"
|
||||
#include "BaseInstance.h"
|
||||
#include "JavaCommon.h"
|
||||
#include "java/JavaChecker.h"
|
||||
#include "ui/pages/BasePage.h"
|
||||
|
||||
class JavaChecker;
|
||||
namespace Ui {
|
||||
class InstanceSettingsPage;
|
||||
}
|
||||
|
||||
class InstanceSettingsPage : public QWidget, public BasePage {
|
||||
class InstanceSettingsPage : public MinecraftSettingsWidget, public BasePage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InstanceSettingsPage(BaseInstance* inst, QWidget* parent = 0);
|
||||
virtual ~InstanceSettingsPage();
|
||||
virtual QString displayName() const override { return tr("Settings"); }
|
||||
virtual QIcon icon() const override { return APPLICATION->getThemedIcon("instance-settings"); }
|
||||
virtual QString id() const override { return "settings"; }
|
||||
virtual bool apply() override;
|
||||
virtual QString helpPage() const override { return "Instance-settings"; }
|
||||
void retranslate() override;
|
||||
|
||||
void updateThresholds();
|
||||
|
||||
private slots:
|
||||
void on_javaDetectBtn_clicked();
|
||||
void on_javaTestBtn_clicked();
|
||||
void on_javaBrowseBtn_clicked();
|
||||
void on_javaDownloadBtn_clicked();
|
||||
void on_maxMemSpinBox_valueChanged(int i);
|
||||
void on_serverJoinAddressButton_toggled(bool checked);
|
||||
void on_worldJoinButton_toggled(bool checked);
|
||||
|
||||
void onUseNativeGLFWChanged(bool checked);
|
||||
void onUseNativeOpenALChanged(bool checked);
|
||||
|
||||
void applySettings();
|
||||
void loadSettings();
|
||||
|
||||
void checkerFinished();
|
||||
|
||||
void globalSettingsButtonClicked(bool checked);
|
||||
|
||||
void updateAccountsMenu();
|
||||
QIcon getFaceForAccount(MinecraftAccountPtr account);
|
||||
void changeInstanceAccount(int index);
|
||||
|
||||
private:
|
||||
Ui::InstanceSettingsPage* ui;
|
||||
BaseInstance* m_instance;
|
||||
SettingsObjectPtr m_settings;
|
||||
unique_qobject_ptr<JavaCommon::TestCheck> checker;
|
||||
bool m_world_quickplay_supported;
|
||||
explicit InstanceSettingsPage(InstancePtr instance, QWidget* parent = nullptr) : MinecraftSettingsWidget(std::move(instance), parent)
|
||||
{
|
||||
connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::saveSettings);
|
||||
connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings);
|
||||
}
|
||||
~InstanceSettingsPage() override {}
|
||||
QString displayName() const override { return tr("Settings"); }
|
||||
QIcon icon() const override { return APPLICATION->getThemedIcon("instance-settings"); }
|
||||
QString id() const override { return "settings"; }
|
||||
bool apply() override
|
||||
{
|
||||
saveSettings();
|
||||
return true;
|
||||
}
|
||||
QString helpPage() const override { return "Instance-settings"; }
|
||||
};
|
||||
|
320
launcher/ui/widgets/MinecraftSettingsWidget.cpp
Normal file
320
launcher/ui/widgets/MinecraftSettingsWidget.cpp
Normal file
@ -0,0 +1,320 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
* Copyright (C) 2024 TheKodeToad <TheKodeToad@proton.me>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
*
|
||||
* Copyright 2013-2021 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "MinecraftSettingsWidget.h"
|
||||
#include <Application.h>
|
||||
|
||||
#include "settings/Setting.h"
|
||||
#include "ui_MinecraftSettingsWidget.h"
|
||||
|
||||
MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* parent)
|
||||
: QWidget(parent), m_instance(std::move(instance)), m_ui(new Ui::MinecraftSettingsWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
if (m_instance == nullptr) {
|
||||
// Java
|
||||
m_ui->settingsTabs->removeTab(1);
|
||||
// Launch
|
||||
m_ui->settingsTabs->removeTab(2);
|
||||
m_ui->openGlobalJavaSettingsButton->setVisible(false);
|
||||
} else {
|
||||
m_ui->showGameTime->setText(tr("Show time &playing this instance"));
|
||||
m_ui->recordGameTime->setText(tr("&Record time playing this instance"));
|
||||
m_ui->showGlobalGameTime->hide();
|
||||
m_ui->showGameTimeWithoutDays->hide();
|
||||
|
||||
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>"));
|
||||
}
|
||||
|
||||
m_ui->maximizedWarning->hide();
|
||||
|
||||
connect(m_ui->maximizedCheckBox, &QCheckBox::toggled, this,
|
||||
[this](const bool value) { m_ui->maximizedWarning->setVisible(value && (m_instance == nullptr || !m_instance->isLegacy())); });
|
||||
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
MinecraftSettingsWidget::~MinecraftSettingsWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void MinecraftSettingsWidget::loadSettings()
|
||||
{
|
||||
const SettingsObjectPtr settings = getSettings();
|
||||
|
||||
// Miscellaneous
|
||||
m_ui->miscellaneousSettingsBox->setCheckable(m_instance != nullptr);
|
||||
m_ui->miscellaneousSettingsBox->setChecked(settings->get("OverrideMiscellaneous").toBool());
|
||||
m_ui->closeAfterLaunchCheck->setChecked(settings->get("CloseAfterLaunch").toBool());
|
||||
m_ui->quitAfterGameStopCheck->setChecked(settings->get("QuitAfterGameStop").toBool());
|
||||
|
||||
// Console
|
||||
m_ui->consoleSettingsBox->setCheckable(m_instance != nullptr);
|
||||
m_ui->consoleSettingsBox->setChecked(m_instance == nullptr || settings->get("OverrideConsole").toBool());
|
||||
m_ui->showConsoleCheck->setChecked(settings->get("ShowConsole").toBool());
|
||||
m_ui->autoCloseConsoleCheck->setChecked(settings->get("AutoCloseConsole").toBool());
|
||||
m_ui->showConsoleErrorCheck->setChecked(settings->get("ShowConsoleOnError").toBool());
|
||||
|
||||
// Window Size
|
||||
m_ui->windowSizeGroupBox->setCheckable(m_instance != nullptr);
|
||||
m_ui->windowSizeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideWindow").toBool());
|
||||
m_ui->windowSizeGroupBox->setChecked(settings->get("OverrideWindow").toBool());
|
||||
m_ui->maximizedCheckBox->setChecked(settings->get("LaunchMaximized").toBool());
|
||||
m_ui->windowWidthSpinBox->setValue(settings->get("MinecraftWinWidth").toInt());
|
||||
m_ui->windowHeightSpinBox->setValue(settings->get("MinecraftWinHeight").toInt());
|
||||
|
||||
// Custom commands
|
||||
m_ui->customCommands->initialize(m_instance != nullptr, m_instance == nullptr || settings->get("OverrideCommands").toBool(),
|
||||
settings->get("PreLaunchCommand").toString(), settings->get("WrapperCommand").toString(),
|
||||
settings->get("PostExitCommand").toString());
|
||||
|
||||
// Environment variables
|
||||
m_ui->environmentVariables->initialize(m_instance != nullptr, m_instance == nullptr || settings->get("OverrideEnv").toBool(),
|
||||
settings->get("Env").toMap());
|
||||
|
||||
// Workarounds
|
||||
m_ui->nativeWorkaroundsGroupBox->setCheckable(m_instance != nullptr);
|
||||
m_ui->nativeWorkaroundsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideNativeWorkarounds").toBool());
|
||||
m_ui->useNativeGLFWCheck->setChecked(settings->get("UseNativeGLFW").toBool());
|
||||
m_ui->lineEditGLFWPath->setText(settings->get("CustomGLFWPath").toString());
|
||||
#ifdef Q_OS_LINUX
|
||||
m_ui->lineEditGLFWPath->setPlaceholderText(APPLICATION->m_detectedGLFWPath);
|
||||
#else
|
||||
m_ui->lineEditGLFWPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.GLFW_LIBRARY_NAME));
|
||||
#endif
|
||||
m_ui->useNativeOpenALCheck->setChecked(settings->get("UseNativeOpenAL").toBool());
|
||||
m_ui->lineEditOpenALPath->setText(settings->get("CustomOpenALPath").toString());
|
||||
#ifdef Q_OS_LINUX
|
||||
m_ui->lineEditOpenALPath->setPlaceholderText(APPLICATION->m_detectedOpenALPath);
|
||||
#else
|
||||
m_ui->lineEditOpenALPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.OPENAL_LIBRARY_NAME));
|
||||
#endif
|
||||
|
||||
// Performance
|
||||
m_ui->perfomanceGroupBox->setCheckable(m_instance != nullptr);
|
||||
m_ui->perfomanceGroupBox->setChecked(m_instance == nullptr || settings->get("OverridePerformance").toBool());
|
||||
m_ui->enableFeralGamemodeCheck->setChecked(settings->get("EnableFeralGamemode").toBool());
|
||||
m_ui->enableMangoHud->setChecked(settings->get("EnableMangoHud").toBool());
|
||||
m_ui->useDiscreteGpuCheck->setChecked(settings->get("UseDiscreteGpu").toBool());
|
||||
m_ui->useZink->setChecked(settings->get("UseZink").toBool());
|
||||
|
||||
#if !defined(Q_OS_LINUX)
|
||||
m_ui->settingsTabs->setTabVisible(ui->settingsTabs->indexOf(ui->performancePage), false);
|
||||
#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."));
|
||||
}
|
||||
|
||||
if (!(APPLICATION->capabilities() & Application::SupportsMangoHud)) {
|
||||
m_ui->enableMangoHud->setDisabled(true);
|
||||
m_ui->enableMangoHud->setToolTip(tr("MangoHud could not be found on your system."));
|
||||
}
|
||||
|
||||
// Miscellanous
|
||||
m_ui->gameTimeGroupBox->setCheckable(m_instance != nullptr);
|
||||
m_ui->gameTimeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideGameTime").toBool());
|
||||
m_ui->showGameTime->setChecked(settings->get("ShowGameTime").toBool());
|
||||
m_ui->recordGameTime->setChecked(settings->get("RecordGameTime").toBool());
|
||||
m_ui->showGlobalGameTime->setChecked(m_instance != nullptr && settings->get("ShowGlobalGameTime").toBool());
|
||||
m_ui->showGameTimeWithoutDays->setChecked(m_instance != nullptr && settings->get("ShowGameTimeWithoutDays").toBool());
|
||||
|
||||
m_ui->legacySettingsGroupBox->setCheckable(m_instance != nullptr);
|
||||
m_ui->legacySettingsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideLegacySettings").toBool());
|
||||
m_ui->onlineFixes->setChecked(settings->get("OnlineFixes").toBool());
|
||||
}
|
||||
|
||||
void MinecraftSettingsWidget::saveSettings()
|
||||
{
|
||||
SettingsObjectPtr settings = getSettings();
|
||||
SettingsObject::Lock lock(settings);
|
||||
|
||||
// Miscellaneous
|
||||
bool miscellaneous = m_instance == nullptr || m_ui->miscellaneousSettingsBox->isChecked();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverrideMiscellaneous", miscellaneous);
|
||||
|
||||
if (miscellaneous) {
|
||||
settings->set("CloseAfterLaunch", m_ui->closeAfterLaunchCheck->isChecked());
|
||||
settings->set("QuitAfterGameStop", m_ui->quitAfterGameStopCheck->isChecked());
|
||||
} else {
|
||||
settings->reset("CloseAfterLaunch");
|
||||
settings->reset("QuitAfterGameStop");
|
||||
}
|
||||
|
||||
// Console
|
||||
bool console = m_instance == nullptr || m_ui->consoleSettingsBox->isChecked();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverrideConsole", console);
|
||||
|
||||
if (console) {
|
||||
settings->set("ShowConsole", m_ui->showConsoleCheck->isChecked());
|
||||
settings->set("AutoCloseConsole", m_ui->autoCloseConsoleCheck->isChecked());
|
||||
settings->set("ShowConsoleOnError", m_ui->showConsoleErrorCheck->isChecked());
|
||||
} else {
|
||||
settings->reset("ShowConsole");
|
||||
settings->reset("AutoCloseConsole");
|
||||
settings->reset("ShowConsoleOnError");
|
||||
}
|
||||
|
||||
// Window Size
|
||||
bool window = m_instance == nullptr || m_ui->windowSizeGroupBox->isChecked();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverrideWindow", window);
|
||||
|
||||
if (window) {
|
||||
settings->set("LaunchMaximized", m_ui->maximizedCheckBox->isChecked());
|
||||
settings->set("MinecraftWinWidth", m_ui->windowWidthSpinBox->value());
|
||||
settings->set("MinecraftWinHeight", m_ui->windowHeightSpinBox->value());
|
||||
} else {
|
||||
settings->reset("LaunchMaximized");
|
||||
settings->reset("MinecraftWinWidth");
|
||||
settings->reset("MinecraftWinHeight");
|
||||
}
|
||||
|
||||
// Custom Commands
|
||||
bool custcmd = m_instance == nullptr || m_ui->customCommands->checked();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverrideCommands", custcmd);
|
||||
|
||||
if (custcmd) {
|
||||
settings->set("PreLaunchCommand", m_ui->customCommands->prelaunchCommand());
|
||||
settings->set("WrapperCommand", m_ui->customCommands->wrapperCommand());
|
||||
settings->set("PostExitCommand", m_ui->customCommands->postexitCommand());
|
||||
} else {
|
||||
settings->reset("PreLaunchCommand");
|
||||
settings->reset("WrapperCommand");
|
||||
settings->reset("PostExitCommand");
|
||||
}
|
||||
|
||||
// Environment Variables
|
||||
auto env = m_instance == nullptr || m_ui->environmentVariables->override();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverrideEnv", env);
|
||||
|
||||
if (env)
|
||||
settings->set("Env", m_ui->environmentVariables->value());
|
||||
else
|
||||
settings->reset("Env");
|
||||
|
||||
// Workarounds
|
||||
bool workarounds = m_instance == nullptr || m_ui->nativeWorkaroundsGroupBox->isChecked();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverrideNativeWorkarounds", workarounds);
|
||||
|
||||
if (workarounds) {
|
||||
settings->set("UseNativeGLFW", m_ui->useNativeGLFWCheck->isChecked());
|
||||
settings->set("CustomGLFWPath", m_ui->lineEditGLFWPath->text());
|
||||
settings->set("UseNativeOpenAL", m_ui->useNativeOpenALCheck->isChecked());
|
||||
settings->set("CustomOpenALPath", m_ui->lineEditOpenALPath->text());
|
||||
} else {
|
||||
settings->reset("UseNativeGLFW");
|
||||
settings->reset("CustomGLFWPath");
|
||||
settings->reset("UseNativeOpenAL");
|
||||
settings->reset("CustomOpenALPath");
|
||||
}
|
||||
|
||||
// Performance
|
||||
bool performance = m_instance == nullptr || m_ui->perfomanceGroupBox->isChecked();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverridePerformance", performance);
|
||||
|
||||
if (performance) {
|
||||
settings->set("EnableFeralGamemode", m_ui->enableFeralGamemodeCheck->isChecked());
|
||||
settings->set("EnableMangoHud", m_ui->enableMangoHud->isChecked());
|
||||
settings->set("UseDiscreteGpu", m_ui->useDiscreteGpuCheck->isChecked());
|
||||
settings->set("UseZink", m_ui->useZink->isChecked());
|
||||
} else {
|
||||
settings->reset("EnableFeralGamemode");
|
||||
settings->reset("EnableMangoHud");
|
||||
settings->reset("UseDiscreteGpu");
|
||||
settings->reset("UseZink");
|
||||
}
|
||||
|
||||
// Game time
|
||||
bool gameTime = m_instance == nullptr || m_ui->gameTimeGroupBox->isChecked();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverrideGameTime", gameTime);
|
||||
|
||||
if (gameTime) {
|
||||
settings->set("ShowGameTime", m_ui->showGameTime->isChecked());
|
||||
settings->set("RecordGameTime", m_ui->recordGameTime->isChecked());
|
||||
} else {
|
||||
settings->reset("ShowGameTime");
|
||||
settings->reset("RecordGameTime");
|
||||
}
|
||||
|
||||
if (m_instance == nullptr) {
|
||||
settings->set("ShowGlobalGameTime", m_ui->showGlobalGameTime->isChecked());
|
||||
settings->set("ShowGameTimeWithoutDays", m_ui->showGameTimeWithoutDays->isChecked());
|
||||
}
|
||||
|
||||
bool overrideLegacySettings = m_instance == nullptr || m_ui->legacySettingsGroupBox->isChecked();
|
||||
|
||||
if (m_instance != nullptr)
|
||||
settings->set("OverrideLegacySettings", overrideLegacySettings);
|
||||
|
||||
if (overrideLegacySettings) {
|
||||
settings->set("OnlineFixes", m_ui->onlineFixes->isChecked());
|
||||
} else {
|
||||
settings->reset("OnlineFixes");
|
||||
}
|
||||
|
||||
if (m_instance != nullptr)
|
||||
m_instance->updateRuntimeContext();
|
||||
}
|
||||
|
||||
SettingsObjectPtr MinecraftSettingsWidget::getSettings() const
|
||||
{
|
||||
if (m_instance != nullptr)
|
||||
return m_instance->settings();
|
||||
|
||||
return APPLICATION->settings();
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (C) 2024 TheKodeToad <TheKodeToad@proton.me>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -35,29 +36,24 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <memory>
|
||||
#include <minecraft/MinecraftInstance.h>
|
||||
#include <QWidget>
|
||||
|
||||
#include <Application.h>
|
||||
#include "ui/pages/BasePage.h"
|
||||
#include "ui/widgets/CustomCommands.h"
|
||||
|
||||
class CustomCommandsPage : public QWidget, public BasePage {
|
||||
Q_OBJECT
|
||||
namespace Ui {
|
||||
class MinecraftSettingsWidget;
|
||||
}
|
||||
|
||||
class MinecraftSettingsWidget : public QWidget {
|
||||
public:
|
||||
explicit CustomCommandsPage(QWidget* parent = 0);
|
||||
~CustomCommandsPage();
|
||||
MinecraftSettingsWidget(InstancePtr instance, QWidget* parent = nullptr);
|
||||
~MinecraftSettingsWidget() override;
|
||||
|
||||
QString displayName() const override { return tr("Custom Commands"); }
|
||||
QIcon icon() const override { return APPLICATION->getThemedIcon("custom-commands"); }
|
||||
QString id() const override { return "custom-commands"; }
|
||||
QString helpPage() const override { return "Custom-commands"; }
|
||||
bool apply() override;
|
||||
void retranslate() override;
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
void applySettings();
|
||||
void loadSettings();
|
||||
CustomCommands* commands;
|
||||
SettingsObjectPtr getSettings() const;
|
||||
|
||||
InstancePtr m_instance;
|
||||
Ui::MinecraftSettingsWidget* m_ui;
|
||||
};
|
876
launcher/ui/widgets/MinecraftSettingsWidget.ui
Normal file
876
launcher/ui/widgets/MinecraftSettingsWidget.ui
Normal file
@ -0,0 +1,876 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MinecraftSettingsWidget</class>
|
||||
<widget class="QWidget" name="MinecraftSettingsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>648</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCommandLinkButton" name="openGlobalJavaSettingsButton">
|
||||
<property name="text">
|
||||
<string>Open &Global Settings</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>The settings here are overrides for global settings.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="settingsTabs">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="generalPage">
|
||||
<attribute name="title">
|
||||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-131</y>
|
||||
<width>610</width>
|
||||
<height>607</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="windowSizeGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Game &Window</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="maximizedCheckBox">
|
||||
<property name="text">
|
||||
<string>Start Minecraft maximized</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="maximizedWarning">
|
||||
<property name="toolTip">
|
||||
<string>The base game only supports resolution. In order to simulate the maximized behaviour the current implementation approximates the maximum display size.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600; color:#f5c211;">Warning</span><span style=" color:#f5c211;">: The maximized option may not be fully supported on all Minecraft versions.</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayoutWindowSize">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelWindowHeight">
|
||||
<property name="text">
|
||||
<string>Window height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelWindowWidth">
|
||||
<property name="text">
|
||||
<string>Window width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="windowWidthSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65536</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>854</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="windowHeightSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65536</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>480</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gameTimeGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Game &Time</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showGameTime">
|
||||
<property name="text">
|
||||
<string>Show time spent &playing instances</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="recordGameTime">
|
||||
<property name="text">
|
||||
<string>&Record time spent playing instances</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showGlobalGameTime">
|
||||
<property name="text">
|
||||
<string>Show &total of time played across instances</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showGameTimeWithoutDays">
|
||||
<property name="text">
|
||||
<string>Always show durations in &hours</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="consoleSettingsBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&Console</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showConsoleCheck">
|
||||
<property name="text">
|
||||
<string>Show console while the game is running</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoCloseConsoleCheck">
|
||||
<property name="text">
|
||||
<string>Automatically close console when the game quits</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showConsoleErrorCheck">
|
||||
<property name="text">
|
||||
<string>Show console when the game crashes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="miscellaneousSettingsBox">
|
||||
<property name="title">
|
||||
<string>&Miscellaneous</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="closeAfterLaunchCheck">
|
||||
<property name="text">
|
||||
<string>Close the launcher after game window opens</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="quitAfterGameStopCheck">
|
||||
<property name="text">
|
||||
<string>Quit the launcher after game window closes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="javaPage">
|
||||
<attribute name="title">
|
||||
<string>Java</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_4">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>610</width>
|
||||
<height>454</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="javaSettingsGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Java Insta&llation</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="skipCompatibilityCheckbox">
|
||||
<property name="toolTip">
|
||||
<string>If enabled, the launcher will not check if an instance is compatible with the selected Java version.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Skip Java compatibility checks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="javaPathTextBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="javaBrowseBtn">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="javaDownloadBtn">
|
||||
<property name="text">
|
||||
<string>Download Java</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="javaDetectBtn">
|
||||
<property name="text">
|
||||
<string>Auto-detect...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="javaTestBtn">
|
||||
<property name="text">
|
||||
<string>Test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="memoryGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Memor&y</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5" columnstretch="1,0,0,0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelPermGen">
|
||||
<property name="text">
|
||||
<string>PermGen:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelMinMem">
|
||||
<property name="text">
|
||||
<string>Minimum memory allocation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelMaxMem">
|
||||
<property name="text">
|
||||
<string>Maximum memory allocation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QLabel" name="labelPermgenNote">
|
||||
<property name="text">
|
||||
<string>Note: Permgen is set automatically by Java 8 and later</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QSpinBox" name="minMemSpinBox">
|
||||
<property name="toolTip">
|
||||
<string>The amount of memory Minecraft is started with.</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true"> MiB</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1048576</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>128</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>256</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="maxMemSpinBox">
|
||||
<property name="toolTip">
|
||||
<string>The maximum amount of memory Minecraft is allowed to use.</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true"> MiB</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1048576</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>128</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1024</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="permGenSpinBox">
|
||||
<property name="toolTip">
|
||||
<string>The amount of memory available to store loaded Java classes.</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true"> MiB</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>64</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="labelMaxMemIcon">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>maxMemSpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="javaArgumentsGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Java Argumen&ts</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPlainTextEdit" name="jvmArgsTextBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tweaksPage">
|
||||
<attribute name="title">
|
||||
<string>Tweaks</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_2">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>610</width>
|
||||
<height>439</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="legacySettingsGroupBox">
|
||||
<property name="title">
|
||||
<string>&Legacy Tweaks</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="onlineFixes">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Emulates usages of old online services which are no longer operating.</p><p>Current fixes include: skin and online mode support.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable online fixes (experimental)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="nativeWorkaroundsGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&Native Libraries</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="useNativeOpenALCheck">
|
||||
<property name="text">
|
||||
<string>Use system installation of OpenAL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelGLFWPath">
|
||||
<property name="text">
|
||||
<string>&GLFW library path</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditGLFWPath</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="useNativeGLFWCheck">
|
||||
<property name="text">
|
||||
<string>Use system installation of GLFW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditGLFWPath">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelOpenALPath">
|
||||
<property name="text">
|
||||
<string>&OpenAL library path</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditOpenALPath</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEditOpenALPath">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="perfomanceGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&Performance</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableFeralGamemodeCheck">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enable Feral Interactive's GameMode, to potentially improve gaming performance.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Feral GameMode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableMangoHud">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enable MangoHud's advanced performance overlay.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable MangoHud</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useDiscreteGpuCheck">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Use the discrete GPU instead of the primary GPU.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use discrete GPU</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useZink">
|
||||
<property name="toolTip">
|
||||
<string>Use Zink, a Mesa OpenGL driver that implements OpenGL on top of Vulkan. Performance may vary depending on the situation. Note: If no suitable Vulkan driver is found, software rendering will be used.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use Zink</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="launchPage">
|
||||
<attribute name="title">
|
||||
<string>Launch</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_3">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>624</width>
|
||||
<height>291</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="instanceAccountGroupBox">
|
||||
<property name="title">
|
||||
<string>Override default &account</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="instanceAccountLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="instanceAccountNameLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Account:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="instanceAccountSelector"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="serverJoinGroupBox">
|
||||
<property name="title">
|
||||
<string>Set a &target to join on launch</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="serverJoinAddressButton">
|
||||
<property name="text">
|
||||
<string>Server address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="serverJoinAddress"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="worldJoinButton">
|
||||
<property name="text">
|
||||
<string>Singleplayer world</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="worldsCb"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="customCommandsPage">
|
||||
<attribute name="title">
|
||||
<string>Custom Commands</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="CustomCommands" name="customCommands" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="environmentVariablesPage">
|
||||
<attribute name="title">
|
||||
<string>Environment Variables</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
<item>
|
||||
<widget class="EnvironmentVariables" name="environmentVariables" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CustomCommands</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/widgets/CustomCommands.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>EnvironmentVariables</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/widgets/EnvironmentVariables.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>maximizedCheckBox</tabstop>
|
||||
<tabstop>windowWidthSpinBox</tabstop>
|
||||
<tabstop>windowHeightSpinBox</tabstop>
|
||||
<tabstop>showConsoleCheck</tabstop>
|
||||
<tabstop>autoCloseConsoleCheck</tabstop>
|
||||
<tabstop>showConsoleErrorCheck</tabstop>
|
||||
<tabstop>useNativeGLFWCheck</tabstop>
|
||||
<tabstop>useNativeOpenALCheck</tabstop>
|
||||
<tabstop>closeAfterLaunchCheck</tabstop>
|
||||
<tabstop>quitAfterGameStopCheck</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user