Skip to content

Commit

Permalink
GH-1552 Hide PermGen when using an autodetected java version greater …
Browse files Browse the repository at this point in the history
…than 8
  • Loading branch information
Janrupf authored and peterix committed Nov 12, 2018
1 parent 4cc7329 commit 1648b34
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion application/pages/instance/InstanceSettingsPage.cpp
Expand Up @@ -176,6 +176,11 @@ void InstanceSettingsPage::loadSettings()
ui->maxMemSpinBox->setValue(min);
}
ui->permGenSpinBox->setValue(m_settings->get("PermGen").toInt());
bool permGenVisible = m_settings->get("PermGenVisible").toBool();
ui->permGenSpinBox->setVisible(permGenVisible);
ui->labelPermGen->setVisible(permGenVisible);
ui->labelPermgenNote->setVisible(permGenVisible);


// Java Settings
bool overrideJava = m_settings->get("OverrideJava").toBool();
Expand Down Expand Up @@ -210,6 +215,11 @@ void InstanceSettingsPage::on_javaDetectBtn_clicked()
{
java = std::dynamic_pointer_cast<JavaInstall>(vselect.selectedVersion());
ui->javaPathTextBox->setText(java->path);
bool visible = java->id.requiresPermGen() && m_settings->get("OverrideMemory").toBool();
ui->permGenSpinBox->setVisible(visible);
ui->labelPermGen->setVisible(visible);
ui->labelPermgenNote->setVisible(visible);
m_settings->set("PermGenVisible", visible);
}
}

Expand All @@ -224,12 +234,18 @@ void InstanceSettingsPage::on_javaBrowseBtn_clicked()
}
QString cooked_path = FS::NormalizePath(raw_path);

QFileInfo javaInfo(cooked_path);;
QFileInfo javaInfo(cooked_path);
if(!javaInfo.exists() || !javaInfo.isExecutable())
{
return;
}
ui->javaPathTextBox->setText(cooked_path);

// custom Java could be anything... enable perm gen option
ui->permGenSpinBox->setVisible(true);
ui->labelPermGen->setVisible(true);
ui->labelPermgenNote->setVisible(true);
m_settings->set("PermGenVisible", true);
}

void InstanceSettingsPage::on_javaTestBtn_clicked()
Expand Down

0 comments on commit 1648b34

Please sign in to comment.