aboutsummaryrefslogtreecommitdiff
path: root/launcher/JavaCommon.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-14 18:16:53 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-14 18:16:53 +0200
commit91ba4cf75ee30c64779edb5b7644e5a830de5026 (patch)
treeaa8c2433bfc3a54577aceeb706c4c2cd0986c95d /launcher/JavaCommon.cpp
parent779f70057b021e285afd60cc650a14cd5feacffd (diff)
downloadPrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.tar.gz
PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.tar.bz2
PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.zip
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/JavaCommon.cpp')
-rw-r--r--launcher/JavaCommon.cpp55
1 files changed, 23 insertions, 32 deletions
diff --git a/launcher/JavaCommon.cpp b/launcher/JavaCommon.cpp
index 30a7dbac..73bc96a4 100644
--- a/launcher/JavaCommon.cpp
+++ b/launcher/JavaCommon.cpp
@@ -39,43 +39,39 @@
#include <QRegularExpression>
-bool JavaCommon::checkJVMArgs(QString jvmargs, QWidget *parent)
+bool JavaCommon::checkJVMArgs(QString jvmargs, QWidget* parent)
{
- if (jvmargs.contains("-XX:PermSize=") || jvmargs.contains(QRegularExpression("-Xm[sx]"))
- || jvmargs.contains("-XX-MaxHeapSize") || jvmargs.contains("-XX:InitialHeapSize"))
- {
+ if (jvmargs.contains("-XX:PermSize=") || jvmargs.contains(QRegularExpression("-Xm[sx]")) || jvmargs.contains("-XX-MaxHeapSize") ||
+ jvmargs.contains("-XX:InitialHeapSize")) {
auto warnStr = QObject::tr(
- "You tried to manually set a JVM memory option (using \"-XX:PermSize\", \"-XX-MaxHeapSize\", \"-XX:InitialHeapSize\", \"-Xmx\" or \"-Xms\").\n"
+ "You tried to manually set a JVM memory option (using \"-XX:PermSize\", \"-XX-MaxHeapSize\", \"-XX:InitialHeapSize\", \"-Xmx\" "
+ "or \"-Xms\").\n"
"There are dedicated boxes for these in the settings (Java tab, in the Memory group at the top).\n"
"This message will be displayed until you remove them from the JVM arguments.");
- CustomMessageBox::selectable(
- parent, QObject::tr("JVM arguments warning"),
- warnStr,
- QMessageBox::Warning)->exec();
+ CustomMessageBox::selectable(parent, QObject::tr("JVM arguments warning"), warnStr, QMessageBox::Warning)->exec();
return false;
}
// block lunacy with passing required version to the JVM
if (jvmargs.contains(QRegularExpression("-version:.*"))) {
auto warnStr = QObject::tr(
- "You tried to pass required Java version argument to the JVM (using \"-version:xxx\"). This is not safe and will not be allowed.\n"
+ "You tried to pass required Java version argument to the JVM (using \"-version:xxx\"). This is not safe and will not be "
+ "allowed.\n"
"This message will be displayed until you remove this from the JVM arguments.");
- CustomMessageBox::selectable(
- parent, QObject::tr("JVM arguments warning"),
- warnStr,
- QMessageBox::Warning)->exec();
+ CustomMessageBox::selectable(parent, QObject::tr("JVM arguments warning"), warnStr, QMessageBox::Warning)->exec();
return false;
}
return true;
}
-void JavaCommon::javaWasOk(QWidget *parent, const JavaCheckResult &result)
+void JavaCommon::javaWasOk(QWidget* parent, const JavaCheckResult& result)
{
QString text;
- text += QObject::tr("Java test succeeded!<br />Platform reported: %1<br />Java version "
- "reported: %2<br />Java vendor "
- "reported: %3<br />").arg(result.realPlatform, result.javaVersion.toString(), result.javaVendor);
- if (result.errorLog.size())
- {
+ text += QObject::tr(
+ "Java test succeeded!<br />Platform reported: %1<br />Java version "
+ "reported: %2<br />Java vendor "
+ "reported: %3<br />")
+ .arg(result.realPlatform, result.javaVersion.toString(), result.javaVendor);
+ if (result.errorLog.size()) {
auto htmlError = result.errorLog;
htmlError.replace('\n', "<br />");
text += QObject::tr("<br />Warnings:<br /><font color=\"orange\">%1</font>").arg(htmlError);
@@ -83,7 +79,7 @@ void JavaCommon::javaWasOk(QWidget *parent, const JavaCheckResult &result)
CustomMessageBox::selectable(parent, QObject::tr("Java test success"), text, QMessageBox::Information)->show();
}
-void JavaCommon::javaArgsWereBad(QWidget *parent, const JavaCheckResult &result)
+void JavaCommon::javaArgsWereBad(QWidget* parent, const JavaCheckResult& result)
{
auto htmlError = result.errorLog;
QString text;
@@ -93,7 +89,7 @@ void JavaCommon::javaArgsWereBad(QWidget *parent, const JavaCheckResult &result)
CustomMessageBox::selectable(parent, QObject::tr("Java test failure"), text, QMessageBox::Warning)->show();
}
-void JavaCommon::javaBinaryWasBad(QWidget *parent, const JavaCheckResult &result)
+void JavaCommon::javaBinaryWasBad(QWidget* parent, const JavaCheckResult& result)
{
QString text;
text += QObject::tr(
@@ -102,7 +98,7 @@ void JavaCommon::javaBinaryWasBad(QWidget *parent, const JavaCheckResult &result
CustomMessageBox::selectable(parent, QObject::tr("Java test failure"), text, QMessageBox::Warning)->show();
}
-void JavaCommon::javaCheckNotFound(QWidget *parent)
+void JavaCommon::javaCheckNotFound(QWidget* parent)
{
QString text;
text += QObject::tr("Java checker library could not be found. Please check your installation.");
@@ -111,8 +107,7 @@ void JavaCommon::javaCheckNotFound(QWidget *parent)
void JavaCommon::TestCheck::run()
{
- if (!JavaCommon::checkJVMArgs(m_args, m_parent))
- {
+ if (!JavaCommon::checkJVMArgs(m_args, m_parent)) {
emit finished();
return;
}
@@ -129,8 +124,7 @@ void JavaCommon::TestCheck::run()
void JavaCommon::TestCheck::checkFinished(JavaCheckResult result)
{
- if (result.validity != JavaCheckResult::Validity::Valid)
- {
+ if (result.validity != JavaCheckResult::Validity::Valid) {
javaBinaryWasBad(m_parent, result);
emit finished();
return;
@@ -141,8 +135,7 @@ void JavaCommon::TestCheck::checkFinished(JavaCheckResult result)
checker->m_args = m_args;
checker->m_minMem = m_minMem;
checker->m_maxMem = m_maxMem;
- if (result.javaVersion.requiresPermGen())
- {
+ if (result.javaVersion.requiresPermGen()) {
checker->m_permGen = m_permGen;
}
checker->performCheck();
@@ -150,8 +143,7 @@ void JavaCommon::TestCheck::checkFinished(JavaCheckResult result)
void JavaCommon::TestCheck::checkFinishedWithArgs(JavaCheckResult result)
{
- if (result.validity == JavaCheckResult::Validity::Valid)
- {
+ if (result.validity == JavaCheckResult::Validity::Valid) {
javaWasOk(m_parent, result);
emit finished();
return;
@@ -159,4 +151,3 @@ void JavaCommon::TestCheck::checkFinishedWithArgs(JavaCheckResult result)
javaArgsWereBad(m_parent, result);
emit finished();
}
-