diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-01-07 06:52:09 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-01-07 06:52:09 +0100 |
commit | c4ec6bc0f552fe7af693d52826c82f1e7db908de (patch) | |
tree | 9495ce54fb743bbeba188198b3cf00ec978c4603 /api/logic/java/launch/CheckJava.cpp | |
parent | 705a658fefb3f5fe4fba9b621df70ae551272864 (diff) | |
download | MultiMC-c4ec6bc0f552fe7af693d52826c82f1e7db908de.tar MultiMC-c4ec6bc0f552fe7af693d52826c82f1e7db908de.tar.gz MultiMC-c4ec6bc0f552fe7af693d52826c82f1e7db908de.tar.lz MultiMC-c4ec6bc0f552fe7af693d52826c82f1e7db908de.tar.xz MultiMC-c4ec6bc0f552fe7af693d52826c82f1e7db908de.zip |
NOISSUE polish the java setup wizard page
* Added a button to check why Java failed
* It will now avoid automatically scanning binaries that do not have 'java' in their filename
* Fixed some crashes related to running too many Java checks (it only does one at a time now)
* It can now distinguish between more Java failure states (not there at all, crashing, returning nonsense)
* Changed '...' button to Browse button to match the wizard page subtitle
* Changing minimum and maximum memory will no longer trigger a java check twice
Diffstat (limited to 'api/logic/java/launch/CheckJava.cpp')
-rw-r--r-- | api/logic/java/launch/CheckJava.cpp | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/api/logic/java/launch/CheckJava.cpp b/api/logic/java/launch/CheckJava.cpp index 717fad49..0dc10822 100644 --- a/api/logic/java/launch/CheckJava.cpp +++ b/api/logic/java/launch/CheckJava.cpp @@ -78,23 +78,37 @@ void CheckJava::executeTask() void CheckJava::checkJavaFinished(JavaCheckResult result) { - if (!result.valid) + switch (result.validity) { - // Error message displayed if java can't start - emit logLine(tr("Could not start java:"), MessageLevel::Error); - emit logLines(result.errorLog.split('\n'), MessageLevel::Error); - emit logLine("\nCheck your MultiMC Java settings.", MessageLevel::MultiMC); - printSystemInfo(false, false); - emitFailed(tr("Could not start java!")); - } - else - { - auto instance = m_parent->instance(); - printJavaInfo(result.javaVersion.toString(), result.mojangPlatform); - instance->settings()->set("JavaVersion", result.javaVersion.toString()); - instance->settings()->set("JavaArchitecture", result.mojangPlatform); - instance->settings()->set("JavaTimestamp", m_javaUnixTime); - emitSucceeded(); + case JavaCheckResult::Validity::Errored: + { + // Error message displayed if java can't start + emit logLine(tr("Could not start java:"), MessageLevel::Error); + emit logLines(result.errorLog.split('\n'), MessageLevel::Error); + emit logLine("\nCheck your MultiMC Java settings.", MessageLevel::MultiMC); + printSystemInfo(false, false); + emitFailed(tr("Could not start java!")); + return; + } + case JavaCheckResult::Validity::ReturnedInvalidData: + { + emit logLine(tr("Java checker returned some invalid data MultiMC doesn't understand:"), MessageLevel::Error); + emit logLines(result.outLog.split('\n'), MessageLevel::Warning); + emit logLine("\nMinecraft might not start properly.", MessageLevel::MultiMC); + printSystemInfo(false, false); + emitSucceeded(); + return; + } + case JavaCheckResult::Validity::Valid: + { + auto instance = m_parent->instance(); + printJavaInfo(result.javaVersion.toString(), result.mojangPlatform); + instance->settings()->set("JavaVersion", result.javaVersion.toString()); + instance->settings()->set("JavaArchitecture", result.mojangPlatform); + instance->settings()->set("JavaTimestamp", m_javaUnixTime); + emitSucceeded(); + return; + } } } |