aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/widgets
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/ui/widgets
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/ui/widgets')
-rw-r--r--launcher/ui/widgets/CustomCommands.cpp13
-rw-r--r--launcher/ui/widgets/CustomCommands.h18
-rw-r--r--launcher/ui/widgets/DropLabel.cpp17
-rw-r--r--launcher/ui/widgets/DropLabel.h19
-rw-r--r--launcher/ui/widgets/ErrorFrame.cpp46
-rw-r--r--launcher/ui/widgets/ErrorFrame.h22
-rw-r--r--launcher/ui/widgets/FocusLineEdit.cpp9
-rw-r--r--launcher/ui/widgets/FocusLineEdit.h17
-rw-r--r--launcher/ui/widgets/IconLabel.cpp16
-rw-r--r--launcher/ui/widgets/IconLabel.h13
-rw-r--r--launcher/ui/widgets/JavaSettingsWidget.cpp145
-rw-r--r--launcher/ui/widgets/JavaSettingsWidget.h75
-rw-r--r--launcher/ui/widgets/LabeledToolButton.cpp46
-rw-r--r--launcher/ui/widgets/LabeledToolButton.h16
-rw-r--r--launcher/ui/widgets/LineSeparator.cpp14
-rw-r--r--launcher/ui/widgets/LineSeparator.h14
-rw-r--r--launcher/ui/widgets/LogView.cpp49
-rw-r--r--launcher/ui/widgets/LogView.h33
-rw-r--r--launcher/ui/widgets/ModFilterWidget.cpp110
-rw-r--r--launcher/ui/widgets/ModFilterWidget.h33
-rw-r--r--launcher/ui/widgets/ModListView.cpp46
-rw-r--r--launcher/ui/widgets/ModListView.h11
-rw-r--r--launcher/ui/widgets/PageContainer.cpp101
-rw-r--r--launcher/ui/widgets/PageContainer.h54
-rw-r--r--launcher/ui/widgets/PageContainer_p.h77
-rw-r--r--launcher/ui/widgets/ProjectItem.cpp5
-rw-r--r--launcher/ui/widgets/ProjectItem.h7
-rw-r--r--launcher/ui/widgets/SubTaskProgressBar.cpp6
-rw-r--r--launcher/ui/widgets/SubTaskProgressBar.h10
-rw-r--r--launcher/ui/widgets/ThemeCustomizationWidget.cpp18
-rw-r--r--launcher/ui/widgets/VariableSizedImageObject.cpp2
-rw-r--r--launcher/ui/widgets/VersionListView.cpp48
-rw-r--r--launcher/ui/widgets/VersionListView.h31
-rw-r--r--launcher/ui/widgets/VersionSelectWidget.cpp52
-rw-r--r--launcher/ui/widgets/VersionSelectWidget.h47
-rw-r--r--launcher/ui/widgets/WideBar.cpp10
36 files changed, 518 insertions, 732 deletions
diff --git a/launcher/ui/widgets/CustomCommands.cpp b/launcher/ui/widgets/CustomCommands.cpp
index 5ab90395..98a1b7e8 100644
--- a/launcher/ui/widgets/CustomCommands.cpp
+++ b/launcher/ui/widgets/CustomCommands.cpp
@@ -41,9 +41,7 @@ CustomCommands::~CustomCommands()
delete ui;
}
-CustomCommands::CustomCommands(QWidget* parent):
- QWidget(parent),
- ui(new Ui::CustomCommands)
+CustomCommands::CustomCommands(QWidget* parent) : QWidget(parent), ui(new Ui::CustomCommands)
{
ui->setupUi(this);
}
@@ -51,8 +49,7 @@ CustomCommands::CustomCommands(QWidget* parent):
void CustomCommands::initialize(bool checkable, bool checked, const QString& prelaunch, const QString& wrapper, const QString& postexit)
{
ui->customCommandsGroupBox->setCheckable(checkable);
- if(checkable)
- {
+ if (checkable) {
ui->customCommandsGroupBox->setChecked(checked);
}
ui->preLaunchCmdTextBox->setText(prelaunch);
@@ -60,14 +57,14 @@ void CustomCommands::initialize(bool checkable, bool checked, const QString& pre
ui->postExitCmdTextBox->setText(postexit);
}
-
-void CustomCommands::retranslate() {
+void CustomCommands::retranslate()
+{
ui->retranslateUi(this);
}
bool CustomCommands::checked() const
{
- if(!ui->customCommandsGroupBox->isCheckable())
+ if (!ui->customCommandsGroupBox->isCheckable())
return true;
return ui->customCommandsGroupBox->isChecked();
}
diff --git a/launcher/ui/widgets/CustomCommands.h b/launcher/ui/widgets/CustomCommands.h
index ed10ba95..96a3fa62 100644
--- a/launcher/ui/widgets/CustomCommands.h
+++ b/launcher/ui/widgets/CustomCommands.h
@@ -37,19 +37,17 @@
#include <QWidget>
-namespace Ui
-{
+namespace Ui {
class CustomCommands;
}
-class CustomCommands : public QWidget
-{
+class CustomCommands : public QWidget {
Q_OBJECT
-public:
- explicit CustomCommands(QWidget *parent = 0);
+ public:
+ explicit CustomCommands(QWidget* parent = 0);
virtual ~CustomCommands();
- void initialize(bool checkable, bool checked, const QString & prelaunch, const QString & wrapper, const QString & postexit);
+ void initialize(bool checkable, bool checked, const QString& prelaunch, const QString& wrapper, const QString& postexit);
void retranslate();
bool checked() const;
@@ -57,8 +55,6 @@ public:
QString wrapperCommand() const;
QString postexitCommand() const;
-private:
- Ui::CustomCommands *ui;
+ private:
+ Ui::CustomCommands* ui;
};
-
-
diff --git a/launcher/ui/widgets/DropLabel.cpp b/launcher/ui/widgets/DropLabel.cpp
index a900e57c..b1473b35 100644
--- a/launcher/ui/widgets/DropLabel.cpp
+++ b/launcher/ui/widgets/DropLabel.cpp
@@ -1,34 +1,33 @@
#include "DropLabel.h"
-#include <QMimeData>
#include <QDropEvent>
+#include <QMimeData>
-DropLabel::DropLabel(QWidget *parent) : QLabel(parent)
+DropLabel::DropLabel(QWidget* parent) : QLabel(parent)
{
setAcceptDrops(true);
}
-void DropLabel::dragEnterEvent(QDragEnterEvent *event)
+void DropLabel::dragEnterEvent(QDragEnterEvent* event)
{
event->acceptProposedAction();
}
-void DropLabel::dragMoveEvent(QDragMoveEvent *event)
+void DropLabel::dragMoveEvent(QDragMoveEvent* event)
{
event->acceptProposedAction();
}
-void DropLabel::dragLeaveEvent(QDragLeaveEvent *event)
+void DropLabel::dragLeaveEvent(QDragLeaveEvent* event)
{
event->accept();
}
-void DropLabel::dropEvent(QDropEvent *event)
+void DropLabel::dropEvent(QDropEvent* event)
{
- const QMimeData *mimeData = event->mimeData();
+ const QMimeData* mimeData = event->mimeData();
- if (!mimeData)
- {
+ if (!mimeData) {
return;
}
diff --git a/launcher/ui/widgets/DropLabel.h b/launcher/ui/widgets/DropLabel.h
index c5ca0bcc..0027f48b 100644
--- a/launcher/ui/widgets/DropLabel.h
+++ b/launcher/ui/widgets/DropLabel.h
@@ -2,19 +2,18 @@
#include <QLabel>
-class DropLabel : public QLabel
-{
+class DropLabel : public QLabel {
Q_OBJECT
-public:
- explicit DropLabel(QWidget *parent = nullptr);
+ public:
+ explicit DropLabel(QWidget* parent = nullptr);
-signals:
+ signals:
void droppedURLs(QList<QUrl> urls);
-protected:
- void dropEvent(QDropEvent *event) override;
- void dragEnterEvent(QDragEnterEvent *event) override;
- void dragMoveEvent(QDragMoveEvent *event) override;
- void dragLeaveEvent(QDragLeaveEvent *event) override;
+ protected:
+ void dropEvent(QDropEvent* event) override;
+ void dragEnterEvent(QDragEnterEvent* event) override;
+ void dragMoveEvent(QDragMoveEvent* event) override;
+ void dragLeaveEvent(QDragLeaveEvent* event) override;
};
diff --git a/launcher/ui/widgets/ErrorFrame.cpp b/launcher/ui/widgets/ErrorFrame.cpp
index b3e41036..213c26b7 100644
--- a/launcher/ui/widgets/ErrorFrame.cpp
+++ b/launcher/ui/widgets/ErrorFrame.cpp
@@ -27,9 +27,7 @@ void ErrorFrame::clear()
setDescription(QString());
}
-ErrorFrame::ErrorFrame(QWidget *parent) :
- QFrame(parent),
- ui(new Ui::ErrorFrame)
+ErrorFrame::ErrorFrame(QWidget* parent) : QFrame(parent), ui(new Ui::ErrorFrame)
{
ui->setupUi(this);
ui->label_Description->setHidden(true);
@@ -44,24 +42,18 @@ ErrorFrame::~ErrorFrame()
void ErrorFrame::updateHiddenState()
{
- if(ui->label_Description->isHidden() && ui->label_Title->isHidden())
- {
+ if (ui->label_Description->isHidden() && ui->label_Title->isHidden()) {
setHidden(true);
- }
- else
- {
+ } else {
setHidden(false);
}
}
void ErrorFrame::setTitle(QString text)
{
- if(text.isEmpty())
- {
+ if (text.isEmpty()) {
ui->label_Title->setHidden(true);
- }
- else
- {
+ } else {
ui->label_Title->setText(text);
ui->label_Title->setHidden(false);
}
@@ -70,14 +62,11 @@ void ErrorFrame::setTitle(QString text)
void ErrorFrame::setDescription(QString text)
{
- if(text.isEmpty())
- {
+ if (text.isEmpty()) {
ui->label_Description->setHidden(true);
updateHiddenState();
return;
- }
- else
- {
+ } else {
ui->label_Description->setHidden(false);
updateHiddenState();
}
@@ -87,9 +76,8 @@ void ErrorFrame::setDescription(QString text)
QChar rem('\n');
QString finaltext;
finaltext.reserve(intermediatetext.size());
- foreach(const QChar& c, intermediatetext)
- {
- if(c == rem && prev){
+ foreach (const QChar& c, intermediatetext) {
+ if (c == rem && prev) {
continue;
}
prev = c == rem;
@@ -97,33 +85,27 @@ void ErrorFrame::setDescription(QString text)
}
QString labeltext;
labeltext.reserve(300);
- if(finaltext.length() > 290)
- {
+ if (finaltext.length() > 290) {
ui->label_Description->setOpenExternalLinks(false);
ui->label_Description->setTextFormat(Qt::TextFormat::RichText);
desc = text;
// This allows injecting HTML here.
labeltext.append("<html><body>" + finaltext.left(287) + "<a href=\"#mod_desc\">...</a></body></html>");
QObject::connect(ui->label_Description, &QLabel::linkActivated, this, &ErrorFrame::ellipsisHandler);
- }
- else
- {
+ } else {
ui->label_Description->setTextFormat(Qt::TextFormat::PlainText);
labeltext.append(finaltext);
}
ui->label_Description->setText(labeltext);
}
-void ErrorFrame::ellipsisHandler(const QString &link)
+void ErrorFrame::ellipsisHandler(const QString& link)
{
- if(!currentBox)
- {
+ if (!currentBox) {
currentBox = CustomMessageBox::selectable(this, QString(), desc);
connect(currentBox, &QMessageBox::finished, this, &ErrorFrame::boxClosed);
currentBox->show();
- }
- else
- {
+ } else {
currentBox->setText(desc);
}
}
diff --git a/launcher/ui/widgets/ErrorFrame.h b/launcher/ui/widgets/ErrorFrame.h
index d5069a14..1aea6a1d 100644
--- a/launcher/ui/widgets/ErrorFrame.h
+++ b/launcher/ui/widgets/ErrorFrame.h
@@ -17,17 +17,15 @@
#include <QFrame>
-namespace Ui
-{
+namespace Ui {
class ErrorFrame;
}
-class ErrorFrame : public QFrame
-{
+class ErrorFrame : public QFrame {
Q_OBJECT
-public:
- explicit ErrorFrame(QWidget *parent = 0);
+ public:
+ explicit ErrorFrame(QWidget* parent = 0);
~ErrorFrame();
void setTitle(QString text);
@@ -35,15 +33,15 @@ public:
void clear();
-public slots:
- void ellipsisHandler(const QString& link );
+ public slots:
+ void ellipsisHandler(const QString& link);
void boxClosed(int result);
-private:
+ private:
void updateHiddenState();
-private:
- Ui::ErrorFrame *ui;
+ private:
+ Ui::ErrorFrame* ui;
QString desc;
- class QMessageBox * currentBox = nullptr;
+ class QMessageBox* currentBox = nullptr;
};
diff --git a/launcher/ui/widgets/FocusLineEdit.cpp b/launcher/ui/widgets/FocusLineEdit.cpp
index b272100c..6570227b 100644
--- a/launcher/ui/widgets/FocusLineEdit.cpp
+++ b/launcher/ui/widgets/FocusLineEdit.cpp
@@ -1,23 +1,22 @@
#include "FocusLineEdit.h"
#include <QDebug>
-FocusLineEdit::FocusLineEdit(QWidget *parent) : QLineEdit(parent)
+FocusLineEdit::FocusLineEdit(QWidget* parent) : QLineEdit(parent)
{
_selectOnMousePress = false;
}
-void FocusLineEdit::focusInEvent(QFocusEvent *e)
+void FocusLineEdit::focusInEvent(QFocusEvent* e)
{
QLineEdit::focusInEvent(e);
selectAll();
_selectOnMousePress = true;
}
-void FocusLineEdit::mousePressEvent(QMouseEvent *me)
+void FocusLineEdit::mousePressEvent(QMouseEvent* me)
{
QLineEdit::mousePressEvent(me);
- if (_selectOnMousePress)
- {
+ if (_selectOnMousePress) {
selectAll();
_selectOnMousePress = false;
}
diff --git a/launcher/ui/widgets/FocusLineEdit.h b/launcher/ui/widgets/FocusLineEdit.h
index 71b4f140..f5ea6602 100644
--- a/launcher/ui/widgets/FocusLineEdit.h
+++ b/launcher/ui/widgets/FocusLineEdit.h
@@ -1,17 +1,14 @@
#include <QLineEdit>
-class FocusLineEdit : public QLineEdit
-{
+class FocusLineEdit : public QLineEdit {
Q_OBJECT
-public:
- FocusLineEdit(QWidget *parent);
- virtual ~FocusLineEdit()
- {
- }
+ public:
+ FocusLineEdit(QWidget* parent);
+ virtual ~FocusLineEdit() {}
-protected:
- void focusInEvent(QFocusEvent *e);
- void mousePressEvent(QMouseEvent *me);
+ protected:
+ void focusInEvent(QFocusEvent* e);
+ void mousePressEvent(QMouseEvent* me);
bool _selectOnMousePress;
};
diff --git a/launcher/ui/widgets/IconLabel.cpp b/launcher/ui/widgets/IconLabel.cpp
index bf1c2358..28776686 100644
--- a/launcher/ui/widgets/IconLabel.cpp
+++ b/launcher/ui/widgets/IconLabel.cpp
@@ -1,13 +1,12 @@
#include "IconLabel.h"
-#include <QStyle>
-#include <QStyleOption>
#include <QLayout>
#include <QPainter>
#include <QRect>
+#include <QStyle>
+#include <QStyleOption>
-IconLabel::IconLabel(QWidget *parent, QIcon icon, QSize size)
- : QWidget(parent), m_size(size), m_icon(icon)
+IconLabel::IconLabel(QWidget* parent, QIcon icon, QSize size) : QWidget(parent), m_size(size), m_icon(icon)
{
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
}
@@ -23,19 +22,16 @@ void IconLabel::setIcon(QIcon icon)
update();
}
-void IconLabel::paintEvent(QPaintEvent *)
+void IconLabel::paintEvent(QPaintEvent*)
{
QPainter p(this);
QRect rect = contentsRect();
int width = rect.width();
int height = rect.height();
- if(width < height)
- {
+ if (width < height) {
rect.setHeight(width);
rect.translate(0, (height - width) / 2);
- }
- else if (width > height)
- {
+ } else if (width > height) {
rect.setWidth(height);
rect.translate((width - height) / 2, 0);
}
diff --git a/launcher/ui/widgets/IconLabel.h b/launcher/ui/widgets/IconLabel.h
index 6d212c4c..41d97f69 100644
--- a/launcher/ui/widgets/IconLabel.h
+++ b/launcher/ui/widgets/IconLabel.h
@@ -1,26 +1,25 @@
#pragma once
-#include <QWidget>
#include <QIcon>
+#include <QWidget>
class QStyleOption;
/**
* This is a trivial widget that paints a QIcon of the specified size.
*/
-class IconLabel : public QWidget
-{
+class IconLabel : public QWidget {
Q_OBJECT
-public:
+ public:
/// Create a line separator. orientation is the orientation of the line.
- explicit IconLabel(QWidget *parent, QIcon icon, QSize size);
+ explicit IconLabel(QWidget* parent, QIcon icon, QSize size);
virtual QSize sizeHint() const;
- virtual void paintEvent(QPaintEvent *);
+ virtual void paintEvent(QPaintEvent*);
void setIcon(QIcon icon);
-private:
+ private:
QSize m_size;
QIcon m_icon;
};
diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp
index d77e0fa0..42279a66 100644
--- a/launcher/ui/widgets/JavaSettingsWidget.cpp
+++ b/launcher/ui/widgets/JavaSettingsWidget.cpp
@@ -1,20 +1,20 @@
#include "JavaSettingsWidget.h"
-#include <QVBoxLayout>
+#include <QFileDialog>
#include <QGroupBox>
-#include <QSpinBox>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
+#include <QSpinBox>
#include <QToolButton>
-#include <QFileDialog>
+#include <QVBoxLayout>
#include <sys.h>
+#include "FileSystem.h"
#include "JavaCommon.h"
#include "java/JavaInstall.h"
#include "java/JavaUtils.h"
-#include "FileSystem.h"
#include "ui/dialogs/CustomMessageBox.h"
#include "ui/widgets/VersionSelectWidget.h"
@@ -150,40 +150,30 @@ void JavaSettingsWidget::refresh()
JavaSettingsWidget::ValidationStatus JavaSettingsWidget::validate()
{
- switch(javaStatus)
- {
+ switch (javaStatus) {
default:
case JavaStatus::NotSet:
case JavaStatus::DoesNotExist:
case JavaStatus::DoesNotStart:
- case JavaStatus::ReturnedInvalidData:
- {
- int button = CustomMessageBox::selectable(
- this,
- tr("No Java version selected"),
- tr("You didn't select a Java version or selected something that doesn't work.\n"
- "%1 will not be able to start Minecraft.\n"
- "Do you wish to proceed without any Java?"
- "\n\n"
- "You can change the Java version in the settings later.\n"
- ).arg(BuildConfig.LAUNCHER_DISPLAYNAME),
- QMessageBox::Warning,
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::NoButton
- )->exec();
- if(button == QMessageBox::No)
- {
+ case JavaStatus::ReturnedInvalidData: {
+ int button = CustomMessageBox::selectable(this, tr("No Java version selected"),
+ tr("You didn't select a Java version or selected something that doesn't work.\n"
+ "%1 will not be able to start Minecraft.\n"
+ "Do you wish to proceed without any Java?"
+ "\n\n"
+ "You can change the Java version in the settings later.\n")
+ .arg(BuildConfig.LAUNCHER_DISPLAYNAME),
+ QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton)
+ ->exec();
+ if (button == QMessageBox::No) {
return ValidationStatus::Bad;
}
return ValidationStatus::JavaBad;
- }
- break;
- case JavaStatus::Pending:
- {
+ } break;
+ case JavaStatus::Pending: {
return ValidationStatus::Bad;
}
- case JavaStatus::Good:
- {
+ case JavaStatus::Good: {
return ValidationStatus::AllOK;
}
}
@@ -220,34 +210,26 @@ void JavaSettingsWidget::memoryValueChanged(int)
unsigned int min = m_minMemSpinBox->value();
unsigned int max = m_maxMemSpinBox->value();
unsigned int permgen = m_permGenSpinBox->value();
- QObject *obj = sender();
- if (obj == m_minMemSpinBox && min != observedMinMemory)
- {
+ QObject* obj = sender();
+ if (obj == m_minMemSpinBox && min != observedMinMemory) {
observedMinMemory = min;
actuallyChanged = true;
- if (min > max)
- {
+ if (min > max) {
observedMaxMemory = min;
m_maxMemSpinBox->setValue(min);
}
- }
- else if (obj == m_maxMemSpinBox && max != observedMaxMemory)
- {
+ } else if (obj == m_maxMemSpinBox && max != observedMaxMemory) {
observedMaxMemory = max;
actuallyChanged = true;
- if (min > max)
- {
+ if (min > max) {
observedMinMemory = max;
m_minMemSpinBox->setValue(max);
}
- }
- else if (obj == m_permGenSpinBox && permgen != observedPermGenMemory)
- {
+ } else if (obj == m_permGenSpinBox && permgen != observedPermGenMemory) {
observedPermGenMemory = permgen;
actuallyChanged = true;
}
- if(actuallyChanged)
- {
+ if (actuallyChanged) {
checkJavaPathOnEdit(m_javaPathTextBox->text());
updateThresholds();
}
@@ -256,8 +238,7 @@ void JavaSettingsWidget::memoryValueChanged(int)
void JavaSettingsWidget::javaVersionSelected(BaseVersion::Ptr version)
{
auto java = std::dynamic_pointer_cast<JavaInstall>(version);
- if(!java)
- {
+ if (!java) {
return;
}
auto visible = java->id.requiresPermGen();
@@ -276,8 +257,7 @@ void JavaSettingsWidget::on_javaBrowseBtn_clicked()
filter = "Java (java)";
#endif
QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"), QString(), filter);
- if(raw_path.isEmpty())
- {
+ if (raw_path.isEmpty()) {
return;
}
QString cooked_path = FS::NormalizePath(raw_path);
@@ -289,8 +269,7 @@ void JavaSettingsWidget::on_javaStatusBtn_clicked()
{
QString text;
bool failed = false;
- switch(javaStatus)
- {
+ switch (javaStatus) {
case JavaStatus::NotSet:
checkJavaPath(m_javaPathTextBox->text());
return;
@@ -298,24 +277,20 @@ void JavaSettingsWidget::on_javaStatusBtn_clicked()
text += QObject::tr("The specified file either doesn't exist or is not a proper executable.");
failed = true;
break;
- case JavaStatus::DoesNotStart:
- {
+ case JavaStatus::DoesNotStart: {
text += QObject::tr("The specified Java binary didn't start properly.<br />");
auto htmlError = m_result.errorLog;
- if(!htmlError.isEmpty())
- {
+ if (!htmlError.isEmpty()) {
htmlError.replace('\n', "<br />");
text += QString("<font color=\"red\">%1</font>").arg(htmlError);
}
failed = true;
break;
}
- case JavaStatus::ReturnedInvalidData:
- {
+ case JavaStatus::ReturnedInvalidData: {
text += QObject::tr("The specified Java binary returned unexpected results:<br />");
auto htmlOut = m_result.outLog;
- if(!htmlOut.isEmpty())
- {
+ if (!htmlOut.isEmpty()) {
htmlOut.replace('\n', "<br />");
text += QString("<font color=\"red\">%1</font>").arg(htmlOut);
}
@@ -323,26 +298,24 @@ void JavaSettingsWidget::on_javaStatusBtn_clicked()
break;
}
case JavaStatus::Good:
- text += QObject::tr("Java test succeeded!<br />Platform reported: %1<br />Java version "
- "reported: %2<br />").arg(m_result.realPlatform, m_result.javaVersion.toString());
+ text += QObject::tr(
+ "Java test succeeded!<br />Platform reported: %1<br />Java version "
+ "reported: %2<br />")
+ .arg(m_result.realPlatform, m_result.javaVersion.toString());
break;
case JavaStatus::Pending:
// TODO: abort here?
return;
}
- CustomMessageBox::selectable(
- this,
- failed ? QObject::tr("Java test failure") : QObject::tr("Java test success"),
- text,
- failed ? QMessageBox::Critical : QMessageBox::Information
- )->show();
+ CustomMessageBox::selectable(this, failed ? QObject::tr("Java test failure") : QObject::tr("Java test success"), text,
+ failed ? QMessageBox::Critical : QMessageBox::Information)
+ ->show();
}
void JavaSettingsWidget::setJavaStatus(JavaSettingsWidget::JavaStatus status)
{
javaStatus = status;
- switch(javaStatus)
- {
+ switch (javaStatus) {
case JavaStatus::Good:
m_javaStatusBtn->setIcon(goodIcon);
break;
@@ -365,29 +338,23 @@ void JavaSettingsWidget::checkJavaPathOnEdit(const QString& path)
{
auto realPath = FS::ResolveExecutable(path);
QFileInfo pathInfo(realPath);
- if (pathInfo.baseName().toLower().contains("java"))
- {
+ if (pathInfo.baseName().toLower().contains("java")) {
checkJavaPath(path);
- }
- else
- {
- if(!m_checker)
- {
+ } else {
+ if (!m_checker) {
setJavaStatus(JavaStatus::NotSet);
}
}
}
-void JavaSettingsWidget::checkJavaPath(const QString &path)
+void JavaSettingsWidget::checkJavaPath(const QString& path)
{
- if(m_checker)
- {
+ if (m_checker) {
queuedCheck = path;
return;
}
auto realPath = FS::ResolveExecutable(path);
- if(realPath.isNull())
- {
+ if (realPath.isNull()) {
setJavaStatus(JavaStatus::DoesNotExist);
return;
}
@@ -396,8 +363,7 @@ void JavaSettingsWidget::checkJavaPath(const QString &path)
m_checker->m_path = path;
m_checker->m_minMem = m_minMemSpinBox->value();
m_checker->m_maxMem = m_maxMemSpinBox->value();
- if(m_permGenSpinBox->isVisible())
- {
+ if (m_permGenSpinBox->isVisible()) {
m_checker->m_permGen = m_permGenSpinBox->value();
}
connect(m_checker.get(), &JavaChecker::checkFinished, this, &JavaSettingsWidget::checkFinished);
@@ -407,27 +373,22 @@ void JavaSettingsWidget::checkJavaPath(const QString &path)
void JavaSettingsWidget::checkFinished(JavaCheckResult result)
{
m_result = result;
- switch(result.validity)
- {
- case JavaCheckResult::Validity::Valid:
- {
+ switch (result.validity) {
+ case JavaCheckResult::Validity::Valid: {
setJavaStatus(JavaStatus::Good);
break;
}
- case JavaCheckResult::Validity::ReturnedI