From c4ec6bc0f552fe7af693d52826c82f1e7db908de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 7 Jan 2017 06:52:09 +0100 Subject: 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 --- application/JavaCommon.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'application/JavaCommon.cpp') diff --git a/application/JavaCommon.cpp b/application/JavaCommon.cpp index a8561f6d..bb7246f7 100644 --- a/application/JavaCommon.cpp +++ b/application/JavaCommon.cpp @@ -22,40 +22,37 @@ bool JavaCommon::checkJVMArgs(QString jvmargs, QWidget *parent) return true; } -void JavaCommon::TestCheck::javaWasOk(JavaCheckResult result) +void JavaCommon::javaWasOk(QWidget *parent, JavaCheckResult result) { QString text; - text += tr("Java test succeeded!
Platform reported: %1
Java version " - "reported: %2
").arg(result.realPlatform, result.javaVersion.toString()); + text += QObject::tr("Java test succeeded!
Platform reported: %1
Java version " + "reported: %2
").arg(result.realPlatform, result.javaVersion.toString()); if (result.errorLog.size()) { auto htmlError = result.errorLog; htmlError.replace('\n', "
"); - text += tr("
Warnings:
%1").arg(htmlError); + text += QObject::tr("
Warnings:
%1").arg(htmlError); } - CustomMessageBox::selectable(m_parent, tr("Java test success"), text, - QMessageBox::Information)->show(); + CustomMessageBox::selectable(parent, QObject::tr("Java test success"), text, QMessageBox::Information)->show(); } -void JavaCommon::TestCheck::javaArgsWereBad(JavaCheckResult result) +void JavaCommon::javaArgsWereBad(QWidget *parent, JavaCheckResult result) { auto htmlError = result.errorLog; QString text; htmlError.replace('\n', "
"); - text += tr("The specified java binary didn't work with the arguments you provided:
"); + text += QObject::tr("The specified java binary didn't work with the arguments you provided:
"); text += QString("%1").arg(htmlError); - CustomMessageBox::selectable(m_parent, tr("Java test failure"), text, QMessageBox::Warning) - ->show(); + CustomMessageBox::selectable(parent, QObject::tr("Java test failure"), text, QMessageBox::Warning)->show(); } -void JavaCommon::TestCheck::javaBinaryWasBad(JavaCheckResult result) +void JavaCommon::javaBinaryWasBad(QWidget *parent, JavaCheckResult result) { QString text; - text += tr( + text += QObject::tr( "The specified java binary didn't work.
You should use the auto-detect feature, " "or set the path to the java executable.
"); - CustomMessageBox::selectable(m_parent, tr("Java test failure"), text, QMessageBox::Warning) - ->show(); + CustomMessageBox::selectable(parent, QObject::tr("Java test failure"), text, QMessageBox::Warning)->show(); } void JavaCommon::TestCheck::run() @@ -74,9 +71,9 @@ void JavaCommon::TestCheck::run() void JavaCommon::TestCheck::checkFinished(JavaCheckResult result) { - if (!result.valid) + if (result.validity != JavaCheckResult::Validity::Valid) { - javaBinaryWasBad(result); + javaBinaryWasBad(m_parent, result); emit finished(); return; } @@ -96,12 +93,12 @@ void JavaCommon::TestCheck::checkFinished(JavaCheckResult result) void JavaCommon::TestCheck::checkFinishedWithArgs(JavaCheckResult result) { - if (result.valid) + if (result.validity == JavaCheckResult::Validity::Valid) { - javaWasOk(result); + javaWasOk(m_parent, result); emit finished(); return; } - javaArgsWereBad(result); + javaArgsWereBad(m_parent, result); emit finished(); } -- cgit v1.2.3