feat: use icons to show memory allocation state
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
863a168cb5
commit
cabd887866
@ -196,14 +196,23 @@ void JavaPage::updateThresholds()
|
|||||||
auto sysMiB = Sys::getSystemRam() / Sys::mebibyte;
|
auto sysMiB = Sys::getSystemRam() / Sys::mebibyte;
|
||||||
unsigned int maxMem = ui->maxMemSpinBox->value();
|
unsigned int maxMem = ui->maxMemSpinBox->value();
|
||||||
|
|
||||||
|
QString iconName;
|
||||||
|
|
||||||
if (maxMem >= sysMiB) {
|
if (maxMem >= sysMiB) {
|
||||||
ui->labelMaxMemIcon->setText(u8"✘");
|
iconName = "status-bad";
|
||||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity."));
|
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity."));
|
||||||
} else if (maxMem > (sysMiB * 0.9)) {
|
} 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."));
|
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity."));
|
||||||
} else {
|
} else {
|
||||||
ui->labelMaxMemIcon->setText(u8"✔");
|
iconName = "status-good";
|
||||||
ui->labelMaxMemIcon->setToolTip("");
|
ui->labelMaxMemIcon->setToolTip("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto height = ui->labelMaxMemIcon->fontInfo().pixelSize();
|
||||||
|
QIcon icon = APPLICATION->getThemedIcon(iconName);
|
||||||
|
QPixmap pix = icon.pixmap(height, height);
|
||||||
|
ui->labelMaxMemIcon->setPixmap(pix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,14 +458,23 @@ void InstanceSettingsPage::updateThresholds()
|
|||||||
auto sysMiB = Sys::getSystemRam() / Sys::mebibyte;
|
auto sysMiB = Sys::getSystemRam() / Sys::mebibyte;
|
||||||
unsigned int maxMem = ui->maxMemSpinBox->value();
|
unsigned int maxMem = ui->maxMemSpinBox->value();
|
||||||
|
|
||||||
|
QString iconName;
|
||||||
|
|
||||||
if (maxMem >= sysMiB) {
|
if (maxMem >= sysMiB) {
|
||||||
ui->labelMaxMemIcon->setText(u8"✘");
|
iconName = "status-bad";
|
||||||
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity."));
|
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity."));
|
||||||
} else if (maxMem > (sysMiB * 0.9)) {
|
} 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."));
|
ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity."));
|
||||||
} else {
|
} else {
|
||||||
ui->labelMaxMemIcon->setText(u8"✔");
|
iconName = "status-good";
|
||||||
ui->labelMaxMemIcon->setToolTip("");
|
ui->labelMaxMemIcon->setToolTip("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto height = ui->labelMaxMemIcon->fontInfo().pixelSize();
|
||||||
|
QIcon icon = APPLICATION->getThemedIcon(iconName);
|
||||||
|
QPixmap pix = icon.pixmap(height, height);
|
||||||
|
ui->labelMaxMemIcon->setPixmap(pix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user