diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-11-11 15:22:16 +0100 |
---|---|---|
committer | Sefa Eyeoglu <contact@scrumplex.net> | 2022-11-11 15:22:16 +0100 |
commit | cabd887866929103f635a2640589ce95570f8573 (patch) | |
tree | b866c47b755db9c508256ee3b0abee017a14d882 /launcher/ui/pages/global | |
parent | 863a168cb5cb7332ae9782c3967d563f7f98316d (diff) | |
download | PrismLauncher-cabd887866929103f635a2640589ce95570f8573.tar.gz PrismLauncher-cabd887866929103f635a2640589ce95570f8573.tar.bz2 PrismLauncher-cabd887866929103f635a2640589ce95570f8573.zip |
feat: use icons to show memory allocation state
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/ui/pages/global')
-rw-r--r-- | launcher/ui/pages/global/JavaPage.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/launcher/ui/pages/global/JavaPage.cpp b/launcher/ui/pages/global/JavaPage.cpp index 00c06cff..81dd4cc1 100644 --- a/launcher/ui/pages/global/JavaPage.cpp +++ b/launcher/ui/pages/global/JavaPage.cpp @@ -196,14 +196,23 @@ void JavaPage::updateThresholds() auto sysMiB = Sys::getSystemRam() / Sys::mebibyte; unsigned int maxMem = ui->maxMemSpinBox->value(); + QString iconName; + if (maxMem >= sysMiB) { - ui->labelMaxMemIcon->setText(u8"✘"); + iconName = "status-bad"; ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity.")); } else if (maxMem > (sysMiB * 0.9)) { - ui->labelMaxMemIcon->setText(u8"⚠"); + iconName = "status-yellow"; ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity.")); } else { - ui->labelMaxMemIcon->setText(u8"✔"); + 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); + } } |