Added warning for x86 java

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-02-09 23:14:49 +02:00
parent 27d662e642
commit c0fb053ccc
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
5 changed files with 24 additions and 0 deletions

View File

@ -40,6 +40,7 @@ struct JavaInstall : public BaseVersion {
QString arch;
QString path;
bool recommended = false;
bool is_64bit = false;
};
using JavaInstallPtr = std::shared_ptr<JavaInstall>;

View File

@ -193,6 +193,7 @@ void JavaListLoadTask::javaCheckerFinished()
javaVersion->id = result.javaVersion;
javaVersion->arch = result.realPlatform;
javaVersion->path = result.path;
javaVersion->is_64bit = result.is_64bit;
candidates.append(javaVersion);
qDebug() << " " << javaVersion->id.toString() << javaVersion->arch << javaVersion->path;

View File

@ -145,6 +145,14 @@ void JavaPage::on_javaDetectBtn_clicked()
if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) {
java = std::dynamic_pointer_cast<JavaInstall>(vselect.selectedVersion());
ui->javaPathTextBox->setText(java->path);
if (!java->is_64bit && APPLICATION->settings()->get("MaxMemAlloc").toInt() > 2048) {
CustomMessageBox::selectable(this, tr("Confirm Selection"),
tr("You selected an x86 java version.\n"
"This means that will not support more than 2Gb(2048Mb) of ram.\n"
"Please make sure that the maximum memory value is lower."),
QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Ok)
->exec();
}
}
}

View File

@ -36,6 +36,7 @@
*/
#include "InstanceSettingsPage.h"
#include "ui/dialogs/CustomMessageBox.h"
#include "ui/java/JavaDownloader.h"
#include "ui_InstanceSettingsPage.h"
@ -412,6 +413,15 @@ void InstanceSettingsPage::on_javaDetectBtn_clicked()
ui->labelPermGen->setVisible(visible);
ui->labelPermgenNote->setVisible(visible);
m_settings->set("PermGenVisible", visible);
if (!java->is_64bit && m_settings->get("MaxMemAlloc").toInt() > 2048) {
CustomMessageBox::selectable(this, tr("Confirm Selection"),
tr("You selected an x86 java version.\n"
"This means that will not support more than 2Gb(2048Mb) of ram.\n"
"Please make sure that the maximum memory value is lower."),
QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Ok)
->exec();
}
}
}

View File

@ -433,6 +433,10 @@ void JavaSettingsWidget::updateThresholds()
} else if (observedMaxMemory < observedMinMemory) {
iconName = "status-yellow";
m_labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value"));
} else if (observedMaxMemory > 2048 && m_result.is_64bit) {
iconName = "status-bad";
m_labelMaxMemIcon->setToolTip(
tr("Your maximum memory allocation exceeds selected java posible memory(due to x86 applicatiion limitations)."));
} else {
iconName = "status-good";
m_labelMaxMemIcon->setToolTip("");