NOISSUE even more java polishing

* Memory minimums lowered to 128M in all Java settings UIs
* Changing the memory sizes on the wizard page does not automatically trigger checks if the executable doesn't have 'java' in the name
* Java detection on linux now scans some common JRE locations, not just /usr/bin/java
This commit is contained in:
Petr Mrázek 2017-01-07 18:11:41 +01:00
parent c4ec6bc0f5
commit 8421ef622d
5 changed files with 45 additions and 11 deletions

View File

@ -154,10 +154,12 @@ QList<QString> JavaUtils::FindJavaPaths()
KEY_WOW64_32KEY, "SOFTWARE\\JavaSoft\\Java Development Kit"); KEY_WOW64_32KEY, "SOFTWARE\\JavaSoft\\Java Development Kit");
java_candidates.append(JRE64s); java_candidates.append(JRE64s);
java_candidates.append(MakeJavaPtr("C:/Program Files/Java/jre8/bin/javaw.exe"));
java_candidates.append(MakeJavaPtr("C:/Program Files/Java/jre7/bin/javaw.exe")); java_candidates.append(MakeJavaPtr("C:/Program Files/Java/jre7/bin/javaw.exe"));
java_candidates.append(MakeJavaPtr("C:/Program Files/Java/jre6/bin/javaw.exe")); java_candidates.append(MakeJavaPtr("C:/Program Files/Java/jre6/bin/javaw.exe"));
java_candidates.append(JDK64s); java_candidates.append(JDK64s);
java_candidates.append(JRE32s); java_candidates.append(JRE32s);
java_candidates.append(MakeJavaPtr("C:/Program Files (x86)/Java/jre8/bin/javaw.exe"));
java_candidates.append(MakeJavaPtr("C:/Program Files (x86)/Java/jre7/bin/javaw.exe")); java_candidates.append(MakeJavaPtr("C:/Program Files (x86)/Java/jre7/bin/javaw.exe"));
java_candidates.append(MakeJavaPtr("C:/Program Files (x86)/Java/jre6/bin/javaw.exe")); java_candidates.append(MakeJavaPtr("C:/Program Files (x86)/Java/jre6/bin/javaw.exe"));
java_candidates.append(JDK32s); java_candidates.append(JDK32s);
@ -205,9 +207,36 @@ QList<QString> JavaUtils::FindJavaPaths()
QList<QString> javas; QList<QString> javas;
javas.append(this->GetDefaultJava()->path); javas.append(this->GetDefaultJava()->path);
javas.append("/opt/java/bin/java"); auto scanJavaDir = [&](const QString & dirPath)
javas.append("/usr/bin/java"); {
QDir dir(dirPath);
if(!dir.exists())
return;
auto entries = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
for(auto & entry: entries)
{
QString prefix;
if(entry.isAbsolute())
{
prefix = entry.absoluteFilePath();
}
else
{
prefix = entry.filePath();
}
javas.append(FS::PathCombine(prefix, "jre/bin/java"));
javas.append(FS::PathCombine(prefix, "bin/java"));
}
};
// oracle RPMs
scanJavaDir("/usr/java");
// general locations used by distro packaging
scanJavaDir("/usr/lib/jvm");
scanJavaDir("/usr/lib32/jvm");
// javas stored in MultiMC's folder
scanJavaDir("java");
return javas; return javas;
} }
#else #else

View File

@ -109,7 +109,7 @@
<string notr="true"> MB</string> <string notr="true"> MB</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>512</number> <number>128</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>65536</number> <number>65536</number>
@ -131,7 +131,7 @@
<string notr="true"> MB</string> <string notr="true"> MB</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>256</number> <number>128</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>65536</number> <number>65536</number>

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>545</width> <width>545</width>
<height>559</height> <height>760</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -54,7 +54,7 @@
<string notr="true"> MB</string> <string notr="true"> MB</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>512</number> <number>128</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>65536</number> <number>65536</number>
@ -90,7 +90,7 @@
<string notr="true"> MB</string> <string notr="true"> MB</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>256</number> <number>128</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>65536</number> <number>65536</number>

View File

@ -85,7 +85,7 @@ void JavaWizardPage::setupUi()
m_minMemSpinBox = new QSpinBox(m_memoryGroupBox); m_minMemSpinBox = new QSpinBox(m_memoryGroupBox);
m_minMemSpinBox->setObjectName(QStringLiteral("minMemSpinBox")); m_minMemSpinBox->setObjectName(QStringLiteral("minMemSpinBox"));
m_minMemSpinBox->setSuffix(QStringLiteral(" MB")); m_minMemSpinBox->setSuffix(QStringLiteral(" MB"));
m_minMemSpinBox->setMinimum(256); m_minMemSpinBox->setMinimum(128);
m_minMemSpinBox->setMaximum(m_availableMemory); m_minMemSpinBox->setMaximum(m_availableMemory);
m_minMemSpinBox->setSingleStep(128); m_minMemSpinBox->setSingleStep(128);
m_labelMinMem->setBuddy(m_minMemSpinBox); m_labelMinMem->setBuddy(m_minMemSpinBox);
@ -98,7 +98,7 @@ void JavaWizardPage::setupUi()
m_maxMemSpinBox = new QSpinBox(m_memoryGroupBox); m_maxMemSpinBox = new QSpinBox(m_memoryGroupBox);
m_maxMemSpinBox->setObjectName(QStringLiteral("maxMemSpinBox")); m_maxMemSpinBox->setObjectName(QStringLiteral("maxMemSpinBox"));
m_maxMemSpinBox->setSuffix(QStringLiteral(" MB")); m_maxMemSpinBox->setSuffix(QStringLiteral(" MB"));
m_maxMemSpinBox->setMinimum(512); m_maxMemSpinBox->setMinimum(128);
m_maxMemSpinBox->setMaximum(m_availableMemory); m_maxMemSpinBox->setMaximum(m_availableMemory);
m_maxMemSpinBox->setSingleStep(128); m_maxMemSpinBox->setSingleStep(128);
m_labelMaxMem->setBuddy(m_maxMemSpinBox); m_labelMaxMem->setBuddy(m_maxMemSpinBox);
@ -254,7 +254,7 @@ void JavaWizardPage::memoryValueChanged(int)
} }
if(actuallyChanged) if(actuallyChanged)
{ {
checkJavaPath(m_javaPathTextBox->text()); checkJavaPathOnEdit(m_javaPathTextBox->text());
} }
} }
@ -363,7 +363,11 @@ void JavaWizardPage::setJavaStatus(JavaWizardPage::JavaStatus status)
void JavaWizardPage::javaPathEdited(const QString& path) void JavaWizardPage::javaPathEdited(const QString& path)
{ {
// only autocheck checkJavaPathOnEdit(path);
}
void JavaWizardPage::checkJavaPathOnEdit(const QString& path)
{
auto realPath = FS::ResolveExecutable(path); auto realPath = FS::ResolveExecutable(path);
QFileInfo pathInfo(realPath); QFileInfo pathInfo(realPath);
if (pathInfo.baseName().toLower().contains("java")) if (pathInfo.baseName().toLower().contains("java"))

View File

@ -52,6 +52,7 @@ protected slots:
void checkFinished(JavaCheckResult result); void checkFinished(JavaCheckResult result);
protected: /* methods */ protected: /* methods */
void checkJavaPathOnEdit(const QString &path);
void checkJavaPath(const QString &path); void checkJavaPath(const QString &path);
void setJavaStatus(JavaStatus status); void setJavaStatus(JavaStatus status);
void setupUi(); void setupUi();