summaryrefslogtreecommitdiffstats
path: root/application/pages/InstanceSettingsPage.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-09-27 12:45:07 +0200
committerPetr Mrázek <peterix@gmail.com>2017-09-27 12:45:07 +0200
commit9a2d203c0d95e51ea02e3e62fef6289973777e84 (patch)
tree739ef893f0b803ca29652ba1afe3b2a7132e6497 /application/pages/InstanceSettingsPage.cpp
parent79d208795c4f1fab88caa7e1684cfbb3c37fc185 (diff)
downloadMultiMC-9a2d203c0d95e51ea02e3e62fef6289973777e84.tar
MultiMC-9a2d203c0d95e51ea02e3e62fef6289973777e84.tar.gz
MultiMC-9a2d203c0d95e51ea02e3e62fef6289973777e84.tar.lz
MultiMC-9a2d203c0d95e51ea02e3e62fef6289973777e84.tar.xz
MultiMC-9a2d203c0d95e51ea02e3e62fef6289973777e84.zip
GH-1993 swap min/max memory settings when they are the wrong way around
Diffstat (limited to 'application/pages/InstanceSettingsPage.cpp')
-rw-r--r--application/pages/InstanceSettingsPage.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/InstanceSettingsPage.cpp
index 22dbd81f..90c2e92e 100644
--- a/application/pages/InstanceSettingsPage.cpp
+++ b/application/pages/InstanceSettingsPage.cpp
@@ -80,8 +80,18 @@ void InstanceSettingsPage::applySettings()
m_settings->set("OverrideMemory", memory);
if (memory)
{
- m_settings->set("MinMemAlloc", ui->minMemSpinBox->value());
- m_settings->set("MaxMemAlloc", ui->maxMemSpinBox->value());
+ 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
@@ -152,8 +162,18 @@ void InstanceSettingsPage::loadSettings()
// Memory
ui->memoryGroupBox->setChecked(m_settings->get("OverrideMemory").toBool());
- ui->minMemSpinBox->setValue(m_settings->get("MinMemAlloc").toInt());
- ui->maxMemSpinBox->setValue(m_settings->get("MaxMemAlloc").toInt());
+ 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());
// Java Settings