From afb0db24a801d935e9945c948ea8d4b831b59d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 11 Jul 2017 22:43:35 +0200 Subject: NOISSUE set max of java heap spinboxes to detected physical memory --- application/pages/InstanceSettingsPage.cpp | 3 +++ application/pages/global/JavaPage.cpp | 3 +++ application/setupwizard/JavaWizardPage.cpp | 2 +- libraries/systeminfo/include/sys.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/InstanceSettingsPage.cpp index 82438583..22dbd81f 100644 --- a/application/pages/InstanceSettingsPage.cpp +++ b/application/pages/InstanceSettingsPage.cpp @@ -11,12 +11,15 @@ #include #include +#include InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent) : QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst) { m_settings = inst->settings(); ui->setupUi(this); + auto sysMB = Sys::getSystemRam() / Sys::megabyte; + ui->maxMemSpinBox->setMaximum(sysMB); loadSettings(); } diff --git a/application/pages/global/JavaPage.cpp b/application/pages/global/JavaPage.cpp index 543cc11f..f43fd641 100644 --- a/application/pages/global/JavaPage.cpp +++ b/application/pages/global/JavaPage.cpp @@ -30,6 +30,7 @@ #include "settings/SettingsObject.h" #include #include "MultiMC.h" +#include JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage) { @@ -40,6 +41,8 @@ JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage) resizer->addWidgetsFromLayout(ui->javaSettingsGroupBox->layout(), 0); resizer->addWidgetsFromLayout(ui->customCommandsGroupBox->layout(), 0); + auto sysMB = Sys::getSystemRam() / Sys::megabyte; + ui->maxMemSpinBox->setMaximum(sysMB); loadSettings(); } diff --git a/application/setupwizard/JavaWizardPage.cpp b/application/setupwizard/JavaWizardPage.cpp index 46b6ee3f..50f61681 100644 --- a/application/setupwizard/JavaWizardPage.cpp +++ b/application/setupwizard/JavaWizardPage.cpp @@ -22,7 +22,7 @@ JavaWizardPage::JavaWizardPage(QWidget *parent) :BaseWizardPage(parent) { - m_availableMemory = Sys::getSystemRam() / (1024ull * 1024ull); + m_availableMemory = Sys::getSystemRam() / Sys::megabyte; goodIcon = MMC->getThemedIcon("status-good"); yellowIcon = MMC->getThemedIcon("status-yellow"); diff --git a/libraries/systeminfo/include/sys.h b/libraries/systeminfo/include/sys.h index 36f7d9cd..e40d9a92 100644 --- a/libraries/systeminfo/include/sys.h +++ b/libraries/systeminfo/include/sys.h @@ -3,6 +3,7 @@ namespace Sys { +const uint64_t megabyte = 1024ull * 1024ull; struct KernelInfo { QString kernelName; -- cgit v1.2.3