diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 0f7d85b6b..054d27f8a 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -665,6 +665,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
m_settings->registerSetting("AutomaticJavaSwitch", defaultEnableAutoJava);
m_settings->registerSetting("AutomaticJavaDownload", defaultEnableAutoJava);
m_settings->registerSetting("UserAskedAboutAutomaticJavaDownload", false);
+ m_settings->registerSetting("AdvancedJavaMemoryControl", false);
// Legacy settings
m_settings->registerSetting("OnlineFixes", false);
diff --git a/launcher/JavaCommon.cpp b/launcher/JavaCommon.cpp
index 188edb943..fc78f5f26 100644
--- a/launcher/JavaCommon.cpp
+++ b/launcher/JavaCommon.cpp
@@ -93,7 +93,7 @@ void JavaCommon::javaBinaryWasBad(QWidget* parent, const JavaChecker::Result& re
{
QString text;
text += QObject::tr(
- "The specified Java binary didn't work.
You should use the auto-detect feature, "
+ "The specified Java binary didn't work.
You should press 'Detect', "
"or set the path to the Java executable.
");
CustomMessageBox::selectable(parent, QObject::tr("Java test failure"), text, QMessageBox::Warning)->show();
}
diff --git a/launcher/ui/pages/global/JavaPage.ui b/launcher/ui/pages/global/JavaPage.ui
index a4b2ac203..25c641cb5 100644
--- a/launcher/ui/pages/global/JavaPage.ui
+++ b/launcher/ui/pages/global/JavaPage.ui
@@ -32,7 +32,7 @@
-
- 0
+ 1
@@ -50,7 +50,7 @@
0
0
535
- 610
+ 606
@@ -73,19 +73,9 @@
Downloaded Java Versions
-
+
-
-
-
-
- 0
- 0
-
-
-
-
- -
-
+
-
@@ -101,14 +91,14 @@
-
-
+
- Qt::Vertical
+ Qt::Horizontal
- 20
- 40
+ 40
+ 20
@@ -122,22 +112,19 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
diff --git a/launcher/ui/widgets/AppearanceWidget.ui b/launcher/ui/widgets/AppearanceWidget.ui
index 61e1167f9..d646cb9e0 100644
--- a/launcher/ui/widgets/AppearanceWidget.ui
+++ b/launcher/ui/widgets/AppearanceWidget.ui
@@ -239,6 +239,9 @@
-
+
+ false
+
Transparent
@@ -247,7 +250,7 @@
-
- true
+ false
Opaque
diff --git a/launcher/ui/widgets/EnvironmentVariables.ui b/launcher/ui/widgets/EnvironmentVariables.ui
index ded5b2ded..828626d12 100644
--- a/launcher/ui/widgets/EnvironmentVariables.ui
+++ b/launcher/ui/widgets/EnvironmentVariables.ui
@@ -35,6 +35,44 @@
true
+
-
+
+
-
+
+
+ &Add
+
+
+
+ -
+
+
+ &Remove
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ &Clear
+
+
+
+
+
-
@@ -67,44 +105,6 @@
- -
-
-
-
-
-
- &Add
-
-
-
- -
-
-
- &Remove
-
-
-
- -
-
-
- &Clear
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp
index a255168e9..200d81db8 100644
--- a/launcher/ui/widgets/JavaSettingsWidget.cpp
+++ b/launcher/ui/widgets/JavaSettingsWidget.cpp
@@ -53,6 +53,11 @@
#include "ui_JavaSettingsWidget.h"
+static QString formatGiBLabel(int value)
+{
+ return QObject::tr("%1 GiB").arg(value / 1024.0, 0, 'f', 1);
+}
+
JavaSettingsWidget::JavaSettingsWidget(InstancePtr instance, QWidget* parent)
: QWidget(parent), m_instance(std::move(instance)), m_ui(new Ui::JavaSettingsWidget)
{
@@ -101,11 +106,50 @@ JavaSettingsWidget::JavaSettingsWidget(InstancePtr instance, QWidget* parent)
connect(m_ui->javaDetectBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaAutodetect);
connect(m_ui->javaBrowseBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaBrowse);
- connect(m_ui->maxMemSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &JavaSettingsWidget::updateThresholds);
- connect(m_ui->minMemSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &JavaSettingsWidget::updateThresholds);
+ connect(m_ui->minMemSpinBox, QOverload::of(&QSpinBox::valueChanged), m_ui->minMemSlider, [this](int value) {
+ m_ui->minMemSlider->blockSignals(true);
+ m_ui->minMemSlider->setValue(value);
+ m_ui->minMemSlider->blockSignals(false);
+ });
+ connect(m_ui->maxMemSpinBox, QOverload::of(&QSpinBox::valueChanged), m_ui->maxMemSlider, [this](int value) {
+ m_ui->maxMemSlider->blockSignals(true);
+ m_ui->maxMemSlider->setValue(value);
+ m_ui->maxMemSlider->blockSignals(false);
+ });
+
+ connect(m_ui->minMemSlider, &QAbstractSlider::valueChanged, m_ui->minMemSpinBox, QOverload::of(&QSpinBox::setValue));
+ connect(m_ui->maxMemSlider, &QAbstractSlider::valueChanged, m_ui->maxMemSpinBox, QOverload::of(&QSpinBox::setValue));
+
+ connect(m_ui->minMemSpinBox, &QAbstractSpinBox::editingFinished, this, &JavaSettingsWidget::finishAdjustingMinMemory);
+ connect(m_ui->maxMemSpinBox, &QAbstractSpinBox::editingFinished, this, &JavaSettingsWidget::finishAdjustingMaxMemory);
+ connect(m_ui->minMemSlider, &QAbstractSlider::valueChanged, this, &JavaSettingsWidget::finishAdjustingMinMemory);
+ connect(m_ui->maxMemSlider, &QAbstractSlider::valueChanged, this, &JavaSettingsWidget::finishAdjustingMaxMemory);
+
+ connect(m_ui->maxMemSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &JavaSettingsWidget::onMemoryChange);
+ connect(m_ui->minMemSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &JavaSettingsWidget::onMemoryChange);
+
+ int maxSystemMemory = (Sys::getSystemRam() / Sys::mebibyte) - 1;
+ m_ui->minMemSlider->setMaximum(maxSystemMemory - 1);
+ m_ui->maxMemSlider->setMaximum(maxSystemMemory - 1);
+ m_ui->minMemMaxValueHint->setText(formatGiBLabel(maxSystemMemory - 1));
+ m_ui->maxMemMaxValueHint->setText(formatGiBLabel(maxSystemMemory - 1));
+
+ SettingsObjectPtr settings = APPLICATION->settings();
+
+ enableAdvancedMemoryControl(settings->get("AdvancedJavaMemoryControl").toBool());
+
+ connect(m_ui->memorySimpleButton, &QPushButton::clicked, this, [this, settings] () {
+ enableAdvancedMemoryControl(false);
+ settings->set("AdvancedJavaMemoryControl", false);
+ });
+
+ connect(m_ui->memoryAdvancedButton, &QPushButton::clicked, this, [this, settings] () {
+ enableAdvancedMemoryControl(true);
+ settings->set("AdvancedJavaMemoryControl", true);
+ });
loadSettings();
- updateThresholds();
+ onMemoryChange();
}
JavaSettingsWidget::~JavaSettingsWidget()
@@ -283,32 +327,43 @@ void JavaSettingsWidget::onJavaAutodetect()
}
}
}
-void JavaSettingsWidget::updateThresholds()
+
+void JavaSettingsWidget::onMemoryChange()
{
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."));
+ m_ui->labelMaxMemNotice->setText(QString("%1").arg(tr("Your maximum memory allocation exceeds your system memory capacity.")));
+ m_ui->labelMaxMemNotice->show();
} 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"));
+ // TODO: where is this colour from
+ m_ui->labelMaxMemNotice->setText(QString("%1")
+ .arg(tr("Your maximum memory allocation is close to your system memory capacity.")));
+ m_ui->labelMaxMemNotice->show();
} else {
- iconName = "status-good";
- m_ui->labelMaxMemIcon->setToolTip("");
+ m_ui->labelMaxMemNotice->hide();
}
- {
- auto height = m_ui->labelMaxMemIcon->fontInfo().pixelSize();
- QIcon icon = APPLICATION->getThemedIcon(iconName);
- QPixmap pix = icon.pixmap(height, height);
- m_ui->labelMaxMemIcon->setPixmap(pix);
- }
+ m_ui->minMemGBLabel->setText(formatGiBLabel(m_ui->minMemSlider->value()));
+ m_ui->maxMemGBLabel->setText(formatGiBLabel(m_ui->maxMemSlider->value()));
+}
+
+void JavaSettingsWidget::finishAdjustingMinMemory()
+{
+ if (m_ui->minMemSpinBox->value() > m_ui->maxMemSpinBox->value())
+ m_ui->maxMemSpinBox->setValue(m_ui->minMemSpinBox->value());
+}
+
+void JavaSettingsWidget::finishAdjustingMaxMemory()
+{
+ if (m_ui->maxMemSpinBox->value() < m_ui->minMemSpinBox->value())
+ m_ui->minMemSpinBox->setValue(m_ui->maxMemSpinBox->value());
+}
+
+void JavaSettingsWidget::enableAdvancedMemoryControl(bool enabled) {
+ m_ui->memorySimpleButton->setChecked(!enabled);
+ m_ui->memoryAdvancedButton->setChecked(enabled);
+ m_ui->memorySimple->setVisible(!enabled);
+ m_ui->memoryAdvanced->setVisible(enabled);
}
diff --git a/launcher/ui/widgets/JavaSettingsWidget.h b/launcher/ui/widgets/JavaSettingsWidget.h
index 21a71fb8b..ed38d63f8 100644
--- a/launcher/ui/widgets/JavaSettingsWidget.h
+++ b/launcher/ui/widgets/JavaSettingsWidget.h
@@ -59,7 +59,10 @@ class JavaSettingsWidget : public QWidget {
void onJavaBrowse();
void onJavaAutodetect();
void onJavaTest();
- void updateThresholds();
+ void onMemoryChange();
+ void finishAdjustingMinMemory();
+ void finishAdjustingMaxMemory();
+ void enableAdvancedMemoryControl(bool enabled);
private:
InstancePtr m_instance;
diff --git a/launcher/ui/widgets/JavaSettingsWidget.ui b/launcher/ui/widgets/JavaSettingsWidget.ui
index 15ce88f0c..0e44980bf 100644
--- a/launcher/ui/widgets/JavaSettingsWidget.ui
+++ b/launcher/ui/widgets/JavaSettingsWidget.ui
@@ -7,13 +7,56 @@
0
0
500
- 600
+ 1123
Form
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
-
+
+
+ Test S&ettings
+
+
+
+ -
+
+
+ Open Java &Downloader
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 0
+ 0
+
+
+
+
+
+
-
@@ -29,6 +72,43 @@
false
+
-
+
+
-
+
+
+ -
+
+
+ &Detect
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ &Browse
+
+
+
+
+
+ -
+
+
+ If enabled, the launcher will not check if an instance is compatible with the selected Java version.
+
+
+ Skip Java compatibility checks
+
+
+
-
@@ -36,45 +116,6 @@
- -
-
-
-
-
-
- -
-
-
- Browse
-
-
-
-
-
- -
-
-
-
-
-
- Download Java
-
-
-
- -
-
-
- Auto-detect...
-
-
-
- -
-
-
- Test
-
-
-
-
-
-
@@ -95,13 +136,13 @@
- -
-
-
- If enabled, the launcher will not check if an instance is compatible with the selected Java version.
-
+
-
+
- Skip Java compatibility checks
+ Java &Executable
+
+
+ javaPathTextBox
@@ -122,104 +163,422 @@
false
-
- -
-
+
+
-
+
+
-
+
+
+ Simple
+
+
+ true
+
+
+ false
+
+
+
+ -
+
+
+ Advanced
+
+
+ true
+
+
+ false
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+
-
+
+
+ M&inimum Memory Usage
+
+
+ minMemSpinBox
+
+
+
+ -
+
+
+ 0 GiB
+
+
+
+ -
+
+
+ 8
+
+
+ 8192
+
+
+ 512
+
+
+ 512
+
+
+ true
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 1024
+
+
+
+ -
+
+
-
+
+
+ false
+
+
+ 0 GiB
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+ 8 GiB
+
+
+
+
+
+ -
+
+
+ M&aximum Memory Usage
+
+
+ maxMemSpinBox
+
+
+
+ -
+
+
+ 0 GiB
+
+
+
+ -
+
+
+ 8
+
+
+ 8192
+
+
+ 512
+
+
+ 512
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 1024
+
+
+
+ -
+
+
-
+
+
+ false
+
+
+ 0 GiB
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+ 8 GiB
+
+
+
+
+
+
+
+
+ -
+
+
+
-
+
+
+ Minimum Memory Allocation
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ -Xm&s=
+
+
+ minMemSpinBox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ The amount of memory Minecraft is started with.
+
+
+ M
+
+
+ 8
+
+
+ 1048576
+
+
+ 128
+
+
+ 256
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Maximum Memory Allocation
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ -Xm&x=
+
+
+ maxMemSpinBox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ The maximum amount of memory Minecraft is allowed to use.
+
+
+ M
+
+
+ 8
+
+
+ 1048576
+
+
+ 128
+
+
+ 1024
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ PermGen Size
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ -XX:&PermSize=
+
+
+ permGenSpinBox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ The amount of memory available to store loaded Java classes.
+
+
+ M
+
+
+ 4
+
+
+ 999999999
+
+
+ 8
+
+
+ 64
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ -
+
- 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
+ Maximum Memory Notice
@@ -251,17 +610,10 @@
javaPathTextBox
- javaBrowseBtn
- javaDownloadBtn
- javaDetectBtn
- javaTestBtn
skipCompatibilityCheckBox
skipWizardCheckBox
autodetectJavaCheckBox
autodownloadJavaCheckBox
- minMemSpinBox
- maxMemSpinBox
- permGenSpinBox
jvmArgsTextBox
diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui
index daa065ac8..34fa9af80 100644
--- a/launcher/ui/widgets/MinecraftSettingsWidget.ui
+++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui
@@ -51,9 +51,6 @@
0
-
- Qt::ScrollBarAlwaysOff
-
true
@@ -61,9 +58,9 @@
0
- -253
+ 0
610
- 550
+ 610
@@ -100,23 +97,73 @@
-
-
-
-
-
-
- Window height:
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 0
+ 6
+
+
+
+
+ -
+
+
+ &Window Size
+
+
+ windowWidthSpinBox
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ 1
+
+
+ 65536
+
+
+ 480
- -
-
+
-
+
- Window width:
+ ×
- -
+
-
+
+
+ 0
+ 0
+
+
+
+
+
1
@@ -131,19 +178,26 @@
- -
-
-
- 1
-
-
- 65536
-
-
- 480
+
-
+
+
+ pixels
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
@@ -298,7 +352,7 @@
0
0
624
- 297
+ 291
@@ -313,9 +367,6 @@
-
-
- Qt::ScrollBarAlwaysOff
-
true
@@ -323,9 +374,9 @@
0
- -101
+ 0
610
- 398
+ 501
@@ -369,7 +420,7 @@
false
-
-
+
-
Use system installation of OpenAL
@@ -386,6 +437,13 @@
+ -
+
+
+ false
+
+
+
-
@@ -393,14 +451,7 @@
- -
-
-
- false
-
-
-
- -
+
-
&OpenAL library path
@@ -410,8 +461,24 @@
- -
-
+
-
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 0
+ 6
+
+
+
+
+ -
+
false
@@ -513,7 +580,7 @@
0
0
624
- 297
+ 291
@@ -530,24 +597,27 @@
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Account:
-
-
-
- -
-
-
-
+
+
+
+ 0
+ 0
+
+
+
+ Account
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
@@ -567,7 +637,7 @@
-
- Server address:
+ Server address
@@ -647,10 +717,7 @@
openGlobalSettingsButton
settingsTabs
- scrollArea
maximizedCheckBox
- windowWidthSpinBox
- windowHeightSpinBox
showGameTime
recordGameTime
showGlobalGameTime
@@ -664,9 +731,7 @@
scrollArea_2
onlineFixes
useNativeGLFWCheck
- lineEditGLFWPath
useNativeOpenALCheck
- lineEditOpenALPath
perfomanceGroupBox
enableFeralGamemodeCheck
enableMangoHud
@@ -674,7 +739,6 @@
useZink
scrollArea_3
instanceAccountGroupBox
- instanceAccountSelector
serverJoinGroupBox
serverJoinAddressButton
serverJoinAddress