chore: reformat

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-08-02 18:35:35 +02:00
parent ce2ca13815
commit 1d468ac35a
594 changed files with 16040 additions and 16536 deletions

View File

@ -36,20 +36,18 @@
#include "ExternalToolsPage.h"
#include "ui_ExternalToolsPage.h"
#include <QMessageBox>
#include <QFileDialog>
#include <QMessageBox>
#include <QStandardPaths>
#include <QTabBar>
#include <FileSystem.h>
#include <tools/MCEditTool.h>
#include "Application.h"
#include "settings/SettingsObject.h"
#include "tools/BaseProfiler.h"
#include <FileSystem.h>
#include "Application.h"
#include <tools/MCEditTool.h>
ExternalToolsPage::ExternalToolsPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::ExternalToolsPage)
ExternalToolsPage::ExternalToolsPage(QWidget* parent) : QWidget(parent), ui(new Ui::ExternalToolsPage)
{
ui->setupUi(this);
ui->tabWidget->tabBar()->hide();
@ -87,12 +85,9 @@ void ExternalToolsPage::applySettings()
// Editors
QString jsonEditor = ui->jsonEditorTextBox->text();
if (!jsonEditor.isEmpty() &&
(!QFileInfo(jsonEditor).exists() || !QFileInfo(jsonEditor).isExecutable()))
{
if (!jsonEditor.isEmpty() && (!QFileInfo(jsonEditor).exists() || !QFileInfo(jsonEditor).isExecutable())) {
QString found = QStandardPaths::findExecutable(jsonEditor);
if (!found.isEmpty())
{
if (!found.isEmpty()) {
jsonEditor = found;
}
}
@ -103,21 +98,16 @@ void ExternalToolsPage::on_jprofilerPathBtn_clicked()
{
QString raw_dir = ui->jprofilerPathEdit->text();
QString error;
do
{
do {
raw_dir = QFileDialog::getExistingDirectory(this, tr("JProfiler Folder"), raw_dir);
if (raw_dir.isEmpty())
{
if (raw_dir.isEmpty()) {
break;
}
QString cooked_dir = FS::NormalizePath(raw_dir);
if (!APPLICATION->profilers()["jprofiler"]->check(cooked_dir, &error))
{
if (!APPLICATION->profilers()["jprofiler"]->check(cooked_dir, &error)) {
QMessageBox::critical(this, tr("Error"), tr("Error while checking JProfiler install:\n%1").arg(error));
continue;
}
else
{
} else {
ui->jprofilerPathEdit->setText(cooked_dir);
break;
}
@ -126,12 +116,9 @@ void ExternalToolsPage::on_jprofilerPathBtn_clicked()
void ExternalToolsPage::on_jprofilerCheckBtn_clicked()
{
QString error;
if (!APPLICATION->profilers()["jprofiler"]->check(ui->jprofilerPathEdit->text(), &error))
{
if (!APPLICATION->profilers()["jprofiler"]->check(ui->jprofilerPathEdit->text(), &error)) {
QMessageBox::critical(this, tr("Error"), tr("Error while checking JProfiler install:\n%1").arg(error));
}
else
{
} else {
QMessageBox::information(this, tr("OK"), tr("JProfiler setup seems to be OK"));
}
}
@ -140,21 +127,16 @@ void ExternalToolsPage::on_jvisualvmPathBtn_clicked()
{
QString raw_dir = ui->jvisualvmPathEdit->text();
QString error;
do
{
do {
raw_dir = QFileDialog::getOpenFileName(this, tr("JVisualVM Executable"), raw_dir);
if (raw_dir.isEmpty())
{
if (raw_dir.isEmpty()) {
break;
}
QString cooked_dir = FS::NormalizePath(raw_dir);
if (!APPLICATION->profilers()["jvisualvm"]->check(cooked_dir, &error))
{
if (!APPLICATION->profilers()["jvisualvm"]->check(cooked_dir, &error)) {
QMessageBox::critical(this, tr("Error"), tr("Error while checking JVisualVM install:\n%1").arg(error));
continue;
}
else
{
} else {
ui->jvisualvmPathEdit->setText(cooked_dir);
break;
}
@ -163,12 +145,9 @@ void ExternalToolsPage::on_jvisualvmPathBtn_clicked()
void ExternalToolsPage::on_jvisualvmCheckBtn_clicked()
{
QString error;
if (!APPLICATION->profilers()["jvisualvm"]->check(ui->jvisualvmPathEdit->text(), &error))
{
if (!APPLICATION->profilers()["jvisualvm"]->check(ui->jvisualvmPathEdit->text(), &error)) {
QMessageBox::critical(this, tr("Error"), tr("Error while checking JVisualVM install:\n%1").arg(error));
}
else
{
} else {
QMessageBox::information(this, tr("OK"), tr("JVisualVM setup seems to be OK"));
}
}
@ -177,25 +156,20 @@ void ExternalToolsPage::on_mceditPathBtn_clicked()
{
QString raw_dir = ui->mceditPathEdit->text();
QString error;
do
{
do {
#ifdef Q_OS_OSX
raw_dir = QFileDialog::getOpenFileName(this, tr("MCEdit Application"), raw_dir);
#else
raw_dir = QFileDialog::getExistingDirectory(this, tr("MCEdit Folder"), raw_dir);
#endif
if (raw_dir.isEmpty())
{
if (raw_dir.isEmpty()) {
break;
}
QString cooked_dir = FS::NormalizePath(raw_dir);
if (!APPLICATION->mcedit()->check(cooked_dir, error))
{
if (!APPLICATION->mcedit()->check(cooked_dir, error)) {
QMessageBox::critical(this, tr("Error"), tr("Error while checking MCEdit install:\n%1").arg(error));
continue;
}
else
{
} else {
ui->mceditPathEdit->setText(cooked_dir);
break;
}
@ -204,43 +178,34 @@ void ExternalToolsPage::on_mceditPathBtn_clicked()
void ExternalToolsPage::on_mceditCheckBtn_clicked()
{
QString error;
if (!APPLICATION->mcedit()->check(ui->mceditPathEdit->text(), error))
{
if (!APPLICATION->mcedit()->check(ui->mceditPathEdit->text(), error)) {
QMessageBox::critical(this, tr("Error"), tr("Error while checking MCEdit install:\n%1").arg(error));
}
else
{
} else {
QMessageBox::information(this, tr("OK"), tr("MCEdit setup seems to be OK"));
}
}
void ExternalToolsPage::on_jsonEditorBrowseBtn_clicked()
{
QString raw_file = QFileDialog::getOpenFileName(
this, tr("JSON Editor"),
ui->jsonEditorTextBox->text().isEmpty()
QString raw_file = QFileDialog::getOpenFileName(this, tr("JSON Editor"),
ui->jsonEditorTextBox->text().isEmpty()
#if defined(Q_OS_LINUX)
? QString("/usr/bin")
? QString("/usr/bin")
#else
? QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first()
? QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first()
#endif
: ui->jsonEditorTextBox->text());
: ui->jsonEditorTextBox->text());
if (raw_file.isEmpty())
{
if (raw_file.isEmpty()) {
return;
}
QString cooked_file = FS::NormalizePath(raw_file);
// it has to exist and be an executable
if (QFileInfo(cooked_file).exists() && QFileInfo(cooked_file).isExecutable())
{
if (QFileInfo(cooked_file).exists() && QFileInfo(cooked_file).isExecutable()) {
ui->jsonEditorTextBox->setText(cooked_file);
}
else
{
QMessageBox::warning(this, tr("Invalid"),
tr("The file chosen does not seem to be an executable"));
} else {
QMessageBox::warning(this, tr("Invalid"), tr("The file chosen does not seem to be an executable"));
}
}