From 1b4b36df33fe32b3fbc731b2f74bcbdbf0226146 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 26 Jan 2025 22:25:26 +0000 Subject: [PATCH] Unify Java page Signed-off-by: TheKodeToad --- launcher/CMakeLists.txt | 3 + launcher/ui/pages/global/JavaPage.cpp | 173 +-------- launcher/ui/pages/global/JavaPage.h | 15 +- launcher/ui/pages/global/JavaPage.ui | 309 +--------------- launcher/ui/widgets/JavaSettingsWidget.cpp | 309 ++++++++++++++++ launcher/ui/widgets/JavaSettingsWidget.h | 67 ++++ launcher/ui/widgets/JavaSettingsWidget.ui | 254 +++++++++++++ launcher/ui/widgets/JavaWizardWidget.cpp | 2 +- .../ui/widgets/MinecraftSettingsWidget.cpp | 333 +++++++++--------- launcher/ui/widgets/MinecraftSettingsWidget.h | 4 +- .../ui/widgets/MinecraftSettingsWidget.ui | 30 +- 11 files changed, 865 insertions(+), 634 deletions(-) create mode 100644 launcher/ui/widgets/JavaSettingsWidget.cpp create mode 100644 launcher/ui/widgets/JavaSettingsWidget.h create mode 100644 launcher/ui/widgets/JavaSettingsWidget.ui diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 28d184501..297178c88 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1124,6 +1124,8 @@ SET(LAUNCHER_SOURCES ui/widgets/ThemeCustomizationWidget.cpp ui/widgets/MinecraftSettingsWidget.h ui/widgets/MinecraftSettingsWidget.cpp + ui/widgets/JavaSettingsWidget.h + ui/widgets/JavaSettingsWidget.cpp # GUI - instance group view ui/instanceview/InstanceProxyModel.cpp @@ -1197,6 +1199,7 @@ qt_wrap_ui(LAUNCHER_UI ui/widgets/SubTaskProgressBar.ui ui/widgets/ThemeCustomizationWidget.ui ui/widgets/MinecraftSettingsWidget.ui + ui/widgets/JavaSettingsWidget.ui ui/dialogs/CopyInstanceDialog.ui ui/dialogs/ProfileSetupDialog.ui ui/dialogs/ProgressDialog.ui diff --git a/launcher/ui/pages/global/JavaPage.cpp b/launcher/ui/pages/global/JavaPage.cpp index 0ae296815..9f681c6f1 100644 --- a/launcher/ui/pages/global/JavaPage.cpp +++ b/launcher/ui/pages/global/JavaPage.cpp @@ -62,6 +62,9 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage) { ui->setupUi(this); + + m_javaSettings = new JavaSettingsWidget(nullptr, this); + ui->generalScrollArea->setWidget(m_javaSettings); if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { ui->managedJavaList->initialize(new JavaInstallList(this, true)); @@ -69,18 +72,8 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage) ui->managedJavaList->selectCurrent(); ui->managedJavaList->setEmptyString(tr("No managed Java versions are installed")); ui->managedJavaList->setEmptyErrorString(tr("Couldn't load the managed Java list!")); - connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] { - ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked()); - if (!ui->autodetectJavaCheckBox->isChecked()) - ui->autodownloadCheckBox->setChecked(false); - }); - } else { - ui->autodownloadCheckBox->setHidden(true); + } else ui->tabWidget->tabBar()->hide(); - } - - loadSettings(); - updateThresholds(); } JavaPage::~JavaPage() @@ -88,117 +81,18 @@ JavaPage::~JavaPage() delete ui; } +void JavaPage::retranslate() +{ + ui->retranslateUi(this); +} + bool JavaPage::apply() { - applySettings(); + m_javaSettings->saveSettings(); + JavaCommon::checkJVMArgs(APPLICATION->settings()->get("JvmArgs").toString(), this); return true; } -void JavaPage::applySettings() -{ - auto s = APPLICATION->settings(); - - // Memory - int min = ui->minMemSpinBox->value(); - int max = ui->maxMemSpinBox->value(); - if (min < max) { - s->set("MinMemAlloc", min); - s->set("MaxMemAlloc", max); - } else { - s->set("MinMemAlloc", max); - s->set("MaxMemAlloc", min); - } - s->set("PermGen", ui->permGenSpinBox->value()); - - // Java Settings - s->set("JavaPath", ui->javaPathTextBox->text()); - s->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " ")); - s->set("IgnoreJavaCompatibility", ui->skipCompatibilityCheckbox->isChecked()); - s->set("IgnoreJavaWizard", ui->skipJavaWizardCheckbox->isChecked()); - s->set("AutomaticJavaSwitch", ui->autodetectJavaCheckBox->isChecked()); - s->set("AutomaticJavaDownload", ui->autodownloadCheckBox->isChecked()); - JavaCommon::checkJVMArgs(s->get("JvmArgs").toString(), this->parentWidget()); -} -void JavaPage::loadSettings() -{ - auto s = APPLICATION->settings(); - // Memory - int min = s->get("MinMemAlloc").toInt(); - int max = s->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(s->get("PermGen").toInt()); - - // Java Settings - ui->javaPathTextBox->setText(s->get("JavaPath").toString()); - ui->jvmArgsTextBox->setPlainText(s->get("JvmArgs").toString()); - ui->skipCompatibilityCheckbox->setChecked(s->get("IgnoreJavaCompatibility").toBool()); - ui->skipJavaWizardCheckbox->setChecked(s->get("IgnoreJavaWizard").toBool()); - ui->autodetectJavaCheckBox->setChecked(s->get("AutomaticJavaSwitch").toBool()); - ui->autodownloadCheckBox->setChecked(s->get("AutomaticJavaSwitch").toBool() && s->get("AutomaticJavaDownload").toBool()); -} - -void JavaPage::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(vselect.selectedVersion()); - ui->javaPathTextBox->setText(java->path); - if (!java->is_64bit && APPLICATION->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 JavaPage::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); -} - -void JavaPage::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 JavaPage::on_downloadJavaButton_clicked() { auto jdialog = new Java::InstallDialog({}, nullptr, this); @@ -206,51 +100,6 @@ void JavaPage::on_downloadJavaButton_clicked() ui->managedJavaList->loadList(); } -void JavaPage::on_maxMemSpinBox_valueChanged([[maybe_unused]] int i) -{ - updateThresholds(); -} - -void JavaPage::checkerFinished() -{ - checker.reset(); -} - -void JavaPage::retranslate() -{ - ui->retranslateUi(this); -} - -void JavaPage::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 JavaPage::on_removeJavaButton_clicked() { auto version = ui->managedJavaList->selectedVersion(); diff --git a/launcher/ui/pages/global/JavaPage.h b/launcher/ui/pages/global/JavaPage.h index 0a1c4a6be..75fd69e6a 100644 --- a/launcher/ui/pages/global/JavaPage.h +++ b/launcher/ui/pages/global/JavaPage.h @@ -37,6 +37,7 @@ #include #include +#include #include #include #include "JavaCommon.h" @@ -59,26 +60,16 @@ class JavaPage : public QWidget, public BasePage { QIcon icon() const override { return APPLICATION->getThemedIcon("java"); } QString id() const override { return "java-settings"; } QString helpPage() const override { return "Java-settings"; } - bool apply() override; void retranslate() override; - void updateThresholds(); - - private: - void applySettings(); - void loadSettings(); + bool apply() override; private slots: - void on_javaDetectBtn_clicked(); - void on_javaTestBtn_clicked(); - void on_javaBrowseBtn_clicked(); void on_downloadJavaButton_clicked(); void on_removeJavaButton_clicked(); void on_refreshJavaButton_clicked(); - void on_maxMemSpinBox_valueChanged(int i); - void checkerFinished(); private: Ui::JavaPage* ui; - unique_qobject_ptr checker; + JavaSettingsWidget* m_javaSettings; }; diff --git a/launcher/ui/pages/global/JavaPage.ui b/launcher/ui/pages/global/JavaPage.ui index e6bbeb15a..9baa2f6f1 100644 --- a/launcher/ui/pages/global/JavaPage.ui +++ b/launcher/ui/pages/global/JavaPage.ui @@ -40,292 +40,22 @@ - - - Memory + + + true - - - - - Ma&ximum memory allocation: - - - maxMemSpinBox - - - - - - - &PermGen: - - - permGenSpinBox - - - - - - - &Minimum memory allocation: - - - minMemSpinBox - - - - - - - The amount of memory Minecraft is started with. - - - MiB - - - 8 - - - 1048576 - - - 128 - - - 256 - - - - - - - The maximum amount of memory Minecraft is allowed to use. - - - MiB - - - 8 - - - 1048576 - - - 128 - - - 1024 - - - - - - - The amount of memory available to store loaded Java classes. - - - MiB - - - 4 - - - 999999999 - - - 8 - - - 64 - - - - - - - - - - maxMemSpinBox - - - - + + + + 0 + 0 + 535 + 610 + + + - - - - Java Runtime - - - - - - - 0 - 0 - - - - If enabled, the launcher will not check if an instance is compatible with the selected Java version. - - - &Skip Java compatibility checks - - - - - - - - - - 0 - 0 - - - - &Auto-detect... - - - - - - - - 0 - 0 - - - - &Test - - - - - - - - - - 0 - 0 - - - - JVM arguments: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - If enabled, the launcher will not prompt you to choose a Java version if one isn't found. - - - Skip Java &Wizard - - - - - - - true - - - - 0 - 0 - - - - - 16777215 - 100 - - - - - - - - Automatically selects the Java version that is compatible with the current Minecraft instance, based on the major version required. - - - Autodetect Java version - - - - - - - - - - 0 - 0 - - - - &Java path: - - - javaPathTextBox - - - - - - - - - - - 0 - 0 - - - - Browse - - - - - - - - - false - - - Automatically downloads and selects the Java version recommended by Mojang. - - - Auto-download Mojang Java - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -417,19 +147,6 @@ 1 - - minMemSpinBox - maxMemSpinBox - permGenSpinBox - javaPathTextBox - javaBrowseBtn - javaDetectBtn - javaTestBtn - skipCompatibilityCheckbox - skipJavaWizardCheckbox - jvmArgsTextBox - tabWidget - diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp new file mode 100644 index 000000000..980876f35 --- /dev/null +++ b/launcher/ui/widgets/JavaSettingsWidget.cpp @@ -0,0 +1,309 @@ +// SPDX-License-Identifier: GPL-3.0-only +/* + * Prism Launcher - Minecraft Launcher + * Copyright (c) 2022 Jamie Mansfield + * Copyright (C) 2022 Sefa Eyeoglu + * Copyright (C) 2024 TheKodeToad + * + * 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 . + * + * 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 "JavaSettingsWidget.h" +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ui_JavaSettingsWidget.h" + +JavaSettingsWidget::JavaSettingsWidget(InstancePtr instance, QWidget* parent) + : QWidget(parent), m_instance(std::move(instance)), m_ui(new Ui::JavaSettingsWidget) +{ + m_ui->setupUi(this); + + if (m_instance == nullptr) { + m_ui->javaDownloadBtn->hide(); + if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { + connect(m_ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this](bool state) { + m_ui->autodownloadJavaCheckBox->setEnabled(state); + if (!state) + m_ui->autodownloadJavaCheckBox->setChecked(false); + }); + } else { + m_ui->autodownloadJavaCheckBox->hide(); + } + } else { + m_ui->javaDownloadBtn->setVisible(BuildConfig.JAVA_DOWNLOADER_ENABLED); + m_ui->skipWizardCheckBox->hide(); + m_ui->autodetectJavaCheckBox->hide(); + m_ui->autodownloadJavaCheckBox->hide(); + + m_ui->javaInstallationGroupBox->setCheckable(true); + m_ui->memoryGroupBox->setCheckable(true); + m_ui->javaArgumentsGroupBox->setCheckable(true); + + SettingsObjectPtr settings = m_instance->settings(); + + connect(settings->getSetting("OverrideJavaLocation").get(), &Setting::SettingChanged, m_ui->javaInstallationGroupBox, + [this, settings] { m_ui->javaInstallationGroupBox->setChecked(settings->get("OverrideJavaLocation").toBool()); }); + connect(settings->getSetting("JavaPath").get(), &Setting::SettingChanged, m_ui->javaInstallationGroupBox, + [this, settings] { m_ui->javaPathTextBox->setText(settings->get("JavaPath").toString()); }); + + connect(m_ui->javaDownloadBtn, &QPushButton::clicked, this, [this] { + auto javaDialog = new Java::InstallDialog({}, m_instance.get(), this); + javaDialog->exec(); + }); + } + + connect(m_ui->javaTestBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaTest); + connect(m_ui->javaDetectBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaAutodetect); + connect(m_ui->javaBrowseBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaBrowse); + + connect(m_ui->maxMemSpinBox, &QSpinBox::valueChanged, this, &JavaSettingsWidget::updateThresholds); + + loadSettings(); + updateThresholds(); +} + +JavaSettingsWidget::~JavaSettingsWidget() +{ + delete m_ui; +} + +void JavaSettingsWidget::loadSettings() +{ + SettingsObjectPtr settings; + + if (m_instance != nullptr) + settings = m_instance->settings(); + else + settings = APPLICATION->settings(); + + // Java Settings + m_ui->javaInstallationGroupBox->setChecked(settings->get("OverrideJavaLocation").toBool()); + m_ui->javaPathTextBox->setText(settings->get("JavaPath").toString()); + + m_ui->skipCompatibilityCheckBox->setChecked(settings->get("IgnoreJavaCompatibility").toBool()); + + m_ui->javaArgumentsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideJavaArgs").toBool()); + m_ui->jvmArgsTextBox->setPlainText(settings->get("JvmArgs").toString()); + + if (m_instance == nullptr) { + m_ui->skipWizardCheckBox->setChecked(settings->get("IgnoreJavaWizard").toBool()); + m_ui->autodetectJavaCheckBox->setChecked(settings->get("AutomaticJavaSwitch").toBool()); + m_ui->autodetectJavaCheckBox->stateChanged(m_ui->autodetectJavaCheckBox->isChecked()); + m_ui->autodownloadJavaCheckBox->setChecked(settings->get("AutomaticJavaDownload").toBool()); + } + + // Memory + m_ui->memoryGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideMemory").toBool()); + int min = settings->get("MinMemAlloc").toInt(); + int max = settings->get("MaxMemAlloc").toInt(); + if (min < max) { + m_ui->minMemSpinBox->setValue(min); + m_ui->maxMemSpinBox->setValue(max); + } else { + m_ui->minMemSpinBox->setValue(max); + m_ui->maxMemSpinBox->setValue(min); + } + m_ui->permGenSpinBox->setValue(settings->get("PermGen").toInt()); + + // Java arguments + m_ui->javaArgumentsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideJavaArgs").toBool()); + m_ui->jvmArgsTextBox->setPlainText(settings->get("JvmArgs").toString()); +} + +void JavaSettingsWidget::saveSettings() +{ + SettingsObjectPtr settings; + + if (m_instance != nullptr) + settings = m_instance->settings(); + else + settings = APPLICATION->settings(); + + SettingsObject::Lock lock(settings); + + // Java Install Settings + bool javaInstall = m_instance == nullptr || m_ui->javaInstallationGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideJavaLocation", javaInstall); + + if (javaInstall) { + settings->set("JavaPath", m_ui->javaPathTextBox->text()); + settings->set("IgnoreJavaCompatibility", m_ui->skipCompatibilityCheckBox->isChecked()); + } else { + settings->reset("JavaPath"); + settings->reset("IgnoreJavaCompatibility"); + } + + if (m_instance == nullptr) { + settings->set("IgnoreJavaWizard", m_ui->skipWizardCheckBox->isChecked()); + settings->set("AutomaticJavaSwitch", m_ui->autodetectJavaCheckBox->isChecked()); + settings->set("AutomaticJavaDownload", m_ui->autodownloadJavaCheckBox->isChecked()); + } + + // Memory + bool memory = m_instance == nullptr || m_ui->memoryGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideMemory", memory); + + if (memory) { + int min = m_ui->minMemSpinBox->value(); + int max = m_ui->maxMemSpinBox->value(); + if (min < max) { + settings->set("MinMemAlloc", min); + settings->set("MaxMemAlloc", max); + } else { + settings->set("MinMemAlloc", max); + settings->set("MaxMemAlloc", min); + } + settings->set("PermGen", m_ui->permGenSpinBox->value()); + } else { + settings->reset("MinMemAlloc"); + settings->reset("MaxMemAlloc"); + settings->reset("PermGen"); + } + + // Java arguments + bool javaArgs = m_instance == nullptr || m_ui->javaArgumentsGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideJavaArgs", javaArgs); + + if (javaArgs) { + settings->set("JvmArgs", m_ui->jvmArgsTextBox->toPlainText().replace("\n", " ")); + } else { + settings->reset("JvmArgs"); + } +} + +void JavaSettingsWidget::onJavaBrowse() +{ + QString rawPath = QFileDialog::getOpenFileName(this, tr("Find Java executable")); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (rawPath.isEmpty()) { + return; + } + + QString cookedPath = FS::NormalizePath(rawPath); + QFileInfo javaInfo(cookedPath); + if (!javaInfo.exists() || !javaInfo.isExecutable()) { + return; + } + m_ui->javaPathTextBox->setText(cookedPath); +} + +void JavaSettingsWidget::onJavaTest() +{ + if (m_checker != nullptr) + return; + + QString jvmArgs; + + if (m_instance == nullptr || m_ui->javaArgumentsGroupBox->isChecked()) + jvmArgs = m_ui->jvmArgsTextBox->toPlainText().replace("\n", " "); + else + jvmArgs = APPLICATION->settings()->get("JvmArgs").toString(); + + m_checker.reset(new JavaCommon::TestCheck(this, m_ui->javaPathTextBox->text(), jvmArgs, m_ui->minMemSpinBox->value(), + m_ui->maxMemSpinBox->value(), m_ui->permGenSpinBox->value())); + connect(m_checker.get(), &JavaCommon::TestCheck::finished, this, [this] { m_checker.reset(); }); + m_checker->run(); +} + +void JavaSettingsWidget::onJavaAutodetect() +{ + if (JavaUtils::getJavaCheckPath().isEmpty()) { + JavaCommon::javaCheckNotFound(this); + return; + } + + VersionSelectDialog versionDialog(APPLICATION->javalist().get(), tr("Select a Java version"), this, true); + versionDialog.setResizeOn(2); + versionDialog.exec(); + + if (versionDialog.result() == QDialog::Accepted && versionDialog.selectedVersion()) { + JavaInstallPtr java = std::dynamic_pointer_cast(versionDialog.selectedVersion()); + m_ui->javaPathTextBox->setText(java->path); + + if (!java->is_64bit && m_ui->maxMemSpinBox->value() > 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 JavaSettingsWidget::updateThresholds() +{ + auto sysMiB = Sys::getSystemRam() / Sys::mebibyte; + unsigned int maxMem = m_ui->maxMemSpinBox->value(); + unsigned int minMem = m_ui->minMemSpinBox->value(); + + QString iconName; + + if (maxMem >= sysMiB) { + iconName = "status-bad"; + m_ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity.")); + } else if (maxMem > (sysMiB * 0.9)) { + iconName = "status-yellow"; + m_ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity.")); + } else if (maxMem < minMem) { + iconName = "status-yellow"; + m_ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value")); + } else { + iconName = "status-good"; + m_ui->labelMaxMemIcon->setToolTip(""); + } + + { + auto height = m_ui->labelMaxMemIcon->fontInfo().pixelSize(); + QIcon icon = APPLICATION->getThemedIcon(iconName); + QPixmap pix = icon.pixmap(height, height); + m_ui->labelMaxMemIcon->setPixmap(pix); + } +} diff --git a/launcher/ui/widgets/JavaSettingsWidget.h b/launcher/ui/widgets/JavaSettingsWidget.h new file mode 100644 index 000000000..433a5f19f --- /dev/null +++ b/launcher/ui/widgets/JavaSettingsWidget.h @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-3.0-only +/* + * Prism Launcher - Minecraft Launcher + * Copyright (c) 2022 Jamie Mansfield + * Copyright (C) 2024 TheKodeToad + * + * 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 . + * + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace Ui { +class JavaSettingsWidget; +} + +class JavaSettingsWidget : public QWidget { + Q_OBJECT + + public: + explicit JavaSettingsWidget(InstancePtr instance, QWidget* parent = nullptr); + ~JavaSettingsWidget() override; + + void loadSettings(); + void saveSettings(); + + private slots: + void onJavaBrowse(); + void onJavaAutodetect(); + void onJavaTest(); + void updateThresholds(); + + private: + InstancePtr m_instance; + Ui::JavaSettingsWidget* m_ui; + unique_qobject_ptr m_checker; +}; diff --git a/launcher/ui/widgets/JavaSettingsWidget.ui b/launcher/ui/widgets/JavaSettingsWidget.ui new file mode 100644 index 000000000..a68059907 --- /dev/null +++ b/launcher/ui/widgets/JavaSettingsWidget.ui @@ -0,0 +1,254 @@ + + + JavaSettingsWidget + + + + 0 + 0 + 500 + 600 + + + + Form + + + + + + true + + + Java Insta&llation + + + false + + + false + + + + + + Auto-&detect Java version + + + + + + + + + + + + Browse + + + + + + + + + + + Download Java + + + + + + + Auto-detect... + + + + + + + Test + + + + + + + + + Automatically downloads and selects the Java build recommended by Mojang. + + + Auto-download &Mojang Java + + + + + + + If enabled, the launcher won't prompt you to choose a Java version if one is not found on startup. + + + Skip Java setup prompt on startup + + + + + + + If enabled, the launcher will not check if an instance is compatible with the selected Java version. + + + Skip Java compatibility checks + + + + + + + + + + true + + + Memor&y + + + false + + + false + + + + + + PermGen (Java 7 and earlier): + + + + + + + Minimum memory allocation: + + + + + + + The amount of memory available to store loaded Java classes. + + + MiB + + + 4 + + + 999999999 + + + 8 + + + 64 + + + + + + + Maximum memory allocation: + + + + + + + + + + Qt::AlignCenter + + + maxMemSpinBox + + + + + + + The maximum amount of memory Minecraft is allowed to use. + + + MiB + + + 8 + + + 1048576 + + + 128 + + + 1024 + + + + + + + The amount of memory Minecraft is started with. + + + MiB + + + 8 + + + 1048576 + + + 128 + + + 256 + + + + + + + + + + true + + + Java Argumen&ts + + + false + + + false + + + + + + + + + + + + + diff --git a/launcher/ui/widgets/JavaWizardWidget.cpp b/launcher/ui/widgets/JavaWizardWidget.cpp index edf49fab8..2d7f7840d 100644 --- a/launcher/ui/widgets/JavaWizardWidget.cpp +++ b/launcher/ui/widgets/JavaWizardWidget.cpp @@ -502,7 +502,7 @@ void JavaWizardWidget::retranslate() if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { m_autodownloadCheckBox->setText(tr("Auto-download Mojang Java")); } - m_autodetectJavaCheckBox->setText(tr("Autodetect Java version")); + m_autodetectJavaCheckBox->setText(tr("Auto-detect Java version")); m_autoJavaGroupBox->setTitle(tr("Autodetect Java")); } diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index cfe7a49c1..a49ab2dca 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -47,12 +47,20 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* m_ui->setupUi(this); if (m_instance == nullptr) { - // Java - m_ui->settingsTabs->removeTab(1); - // Launch - m_ui->settingsTabs->removeTab(2); + for (int i = 0; i < m_ui->settingsTabs->count(); ++i) { + const QString name = m_ui->settingsTabs->widget(i)->objectName(); + + if (name == "javaTab" || name == "launchTab") { + m_ui->settingsTabs->removeTab(i); + --i; + } + } + m_ui->openGlobalSettingsButton->setVisible(false); } else { + m_javaSettings = new JavaSettingsWidget(m_instance, this); + m_ui->javaScrollArea->setWidget(m_javaSettings); + m_ui->showGameTime->setText(tr("Show time &playing this instance")); m_ui->recordGameTime->setText(tr("&Record time playing this instance")); m_ui->showGlobalGameTime->hide(); @@ -63,6 +71,14 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* "not fully supported on this Minecraft version.")); connect(m_ui->openGlobalSettingsButton, &QCommandLinkButton::clicked, this, &MinecraftSettingsWidget::openGlobalSettings); + + m_ui->miscellaneousSettingsBox->setCheckable(true); + m_ui->consoleSettingsBox->setCheckable(true); + m_ui->windowSizeGroupBox->setCheckable(true); + m_ui->nativeWorkaroundsGroupBox->setCheckable(true); + m_ui->perfomanceGroupBox->setCheckable(true); + m_ui->gameTimeGroupBox->setCheckable(true); + m_ui->legacySettingsGroupBox->setCheckable(true); } m_ui->maximizedWarning->hide(); @@ -84,29 +100,34 @@ MinecraftSettingsWidget::~MinecraftSettingsWidget() void MinecraftSettingsWidget::loadSettings() { - const SettingsObjectPtr settings = getSettings(); + SettingsObjectPtr settings; + + if (m_instance != nullptr) + settings = m_instance->settings(); + else + settings = APPLICATION->settings(); // 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()); + if (m_javaSettings != nullptr) + m_javaSettings->loadSettings(); + // Custom commands m_ui->customCommands->initialize(m_instance != nullptr, m_instance == nullptr || settings->get("OverrideCommands").toBool(), settings->get("PreLaunchCommand").toString(), settings->get("WrapperCommand").toString(), @@ -117,7 +138,6 @@ void MinecraftSettingsWidget::loadSettings() 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()); @@ -135,7 +155,6 @@ void MinecraftSettingsWidget::loadSettings() #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()); @@ -153,164 +172,170 @@ void MinecraftSettingsWidget::loadSettings() } // 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->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(); + SettingsObjectPtr settings; 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()); + settings = m_instance->settings(); else - settings->reset("Env"); + settings = APPLICATION->settings(); - // Workarounds - bool workarounds = m_instance == nullptr || m_ui->nativeWorkaroundsGroupBox->isChecked(); + { + SettingsObject::Lock lock(settings); - if (m_instance != nullptr) - settings->set("OverrideNativeWorkarounds", workarounds); + // Miscellaneous + bool miscellaneous = m_instance == nullptr || m_ui->miscellaneousSettingsBox->isChecked(); - 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"); + 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"); + } } - // 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(); + if (m_javaSettings != nullptr) + m_javaSettings->saveSettings(); } void MinecraftSettingsWidget::openGlobalSettings() @@ -322,11 +347,3 @@ void MinecraftSettingsWidget::openGlobalSettings() else // TODO select tab APPLICATION->ShowGlobalSettings(this, "minecraft-settings"); } - -SettingsObjectPtr MinecraftSettingsWidget::getSettings() const -{ - if (m_instance != nullptr) - return m_instance->settings(); - - return APPLICATION->settings(); -} diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.h b/launcher/ui/widgets/MinecraftSettingsWidget.h index a76ff647a..a7491770a 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.h +++ b/launcher/ui/widgets/MinecraftSettingsWidget.h @@ -38,6 +38,7 @@ #include #include +#include "JavaSettingsWidget.h" namespace Ui { class MinecraftSettingsWidget; @@ -54,8 +55,7 @@ class MinecraftSettingsWidget : public QWidget { void openGlobalSettings(); private: - SettingsObjectPtr getSettings() const; - InstancePtr m_instance; Ui::MinecraftSettingsWidget* m_ui; + JavaSettingsWidget* m_javaSettings = nullptr; }; diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui index 78fae9639..0acd34815 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.ui +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -63,7 +63,7 @@ 0 0 610 - 607 + 550 @@ -282,6 +282,30 @@ + + + Java + + + + + + true + + + + + 0 + 0 + 624 + 297 + + + + + + + Tweaks @@ -301,7 +325,7 @@ 0 0 610 - 439 + 398 @@ -489,7 +513,7 @@ 0 0 624 - 291 + 297