aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/global
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/pages/global')
-rw-r--r--launcher/ui/pages/global/APIPage.cpp45
-rw-r--r--launcher/ui/pages/global/APIPage.h38
-rw-r--r--launcher/ui/pages/global/AccountListPage.cpp96
-rw-r--r--launcher/ui/pages/global/AccountListPage.h46
-rw-r--r--launcher/ui/pages/global/CustomCommandsPage.cpp22
-rw-r--r--launcher/ui/pages/global/CustomCommandsPage.h37
-rw-r--r--launcher/ui/pages/global/ExternalToolsPage.cpp105
-rw-r--r--launcher/ui/pages/global/ExternalToolsPage.h38
-rw-r--r--launcher/ui/pages/global/JavaPage.cpp48
-rw-r--r--launcher/ui/pages/global/JavaPage.h49
-rw-r--r--launcher/ui/pages/global/LanguagePage.cpp13
-rw-r--r--launcher/ui/pages/global/LanguagePage.h39
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp97
-rw-r--r--launcher/ui/pages/global/LauncherPage.h51
-rw-r--r--launcher/ui/pages/global/MinecraftPage.cpp8
-rw-r--r--launcher/ui/pages/global/MinecraftPage.h46
-rw-r--r--launcher/ui/pages/global/ProxyPage.cpp23
-rw-r--r--launcher/ui/pages/global/ProxyPage.h46
18 files changed, 302 insertions, 545 deletions
diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp
index 668aa007..82aa76a4 100644
--- a/launcher/ui/pages/global/APIPage.cpp
+++ b/launcher/ui/pages/global/APIPage.cpp
@@ -39,37 +39,30 @@
#include "APIPage.h"
#include "ui_APIPage.h"
-#include <QMessageBox>
#include <QFileDialog>
+#include <QMessageBox>
#include <QRegularExpression>
#include <QStandardPaths>
#include <QTabBar>
#include <QValidator>
#include <QVariant>
-#include "settings/SettingsObject.h"
-#include "tools/BaseProfiler.h"
#include "Application.h"
-#include "net/PasteUpload.h"
#include "BuildConfig.h"
+#include "net/PasteUpload.h"
+#include "settings/SettingsObject.h"
+#include "tools/BaseProfiler.h"
-APIPage::APIPage(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::APIPage)
+APIPage::APIPage(QWidget* parent) : QWidget(parent), ui(new Ui::APIPage)
{
// This is here so you can reorder the entries in the combobox without messing stuff up
- int comboBoxEntries[] = {
- PasteUpload::PasteType::Mclogs,
- PasteUpload::PasteType::NullPointer,
- PasteUpload::PasteType::PasteGG,
- PasteUpload::PasteType::Hastebin
- };
+ int comboBoxEntries[] = { PasteUpload::PasteType::Mclogs, PasteUpload::PasteType::NullPointer, PasteUpload::PasteType::PasteGG,
+ PasteUpload::PasteType::Hastebin };
static QRegularExpression validUrlRegExp("https?://.+");
- static QRegularExpression validMSAClientID(QRegularExpression::anchoredPattern(
- "[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"));
- static QRegularExpression validFlameKey(QRegularExpression::anchoredPattern(
- "\\$2[ayb]\\$.{56}"));
+ static QRegularExpression validMSAClientID(
+ QRegularExpression::anchoredPattern("[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"));
+ static QRegularExpression validFlameKey(QRegularExpression::anchoredPattern("\\$2[ayb]\\$.{56}"));
ui->setupUi(this);
@@ -77,7 +70,7 @@ APIPage::APIPage(QWidget *parent) :
ui->pasteTypeComboBox->addItem(PasteUpload::PasteTypes.at(pasteType).name, pasteType);
}
- void (QComboBox::*currentIndexChangedSignal)(int) (&QComboBox::currentIndexChanged);
+ void (QComboBox::*currentIndexChangedSignal)(int)(&QComboBox::currentIndexChanged);
connect(ui->pasteTypeComboBox, currentIndexChangedSignal, this, &APIPage::updateBaseURLPlaceholder);
// This function needs to be called even when the ComboBox's index is still in its default state.
updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex());
@@ -110,12 +103,9 @@ void APIPage::resetBaseURLNote()
void APIPage::updateBaseURLNote(int index)
{
- if (baseURLPasteType == index)
- {
+ if (baseURLPasteType == index) {
ui->baseURLNote->hide();
- }
- else if (!ui->baseURLEntry->text().isEmpty())
- {
+ } else if (!ui->baseURLEntry->text().isEmpty()) {
ui->baseURLNote->show();
}
}
@@ -136,8 +126,7 @@ void APIPage::loadSettings()
ui->baseURLEntry->setText(pastebinURL);
int pasteTypeIndex = ui->pasteTypeComboBox->findData(pasteType);
- if (pasteTypeIndex == -1)
- {
+ if (pasteTypeIndex == -1) {
pasteTypeIndex = ui->pasteTypeComboBox->findData(PasteUpload::PasteType::Mclogs);
ui->baseURLEntry->clear();
}
@@ -167,15 +156,13 @@ void APIPage::applySettings()
s->set("MSAClientIDOverride", msaClientID);
QUrl metaURL(ui->metaURL->text());
// Add required trailing slash
- if (!metaURL.isEmpty() && !metaURL.path().endsWith('/'))
- {
+ if (!metaURL.isEmpty() && !metaURL.path().endsWith('/')) {
QString path = metaURL.path();
path.append('/');
metaURL.setPath(path);
}
// Don't allow HTTP, since meta is basically RCE with all the jar files.
- if(!metaURL.isEmpty() && metaURL.scheme() == "http")
- {
+ if (!metaURL.isEmpty() && metaURL.scheme() == "http") {
metaURL.setScheme("https");
}
diff --git a/launcher/ui/pages/global/APIPage.h b/launcher/ui/pages/global/APIPage.h
index 17e62ae7..d4ed9290 100644
--- a/launcher/ui/pages/global/APIPage.h
+++ b/launcher/ui/pages/global/APIPage.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
* Copyright (c) 2022 Lenny McLennington <lenny@sneed.church>
@@ -39,41 +39,28 @@
#include <QWidget>
-#include "ui/pages/BasePage.h"
#include <Application.h>
+#include "ui/pages/BasePage.h"
namespace Ui {
class APIPage;
}
-class APIPage : public QWidget, public BasePage
-{
+class APIPage : public QWidget, public BasePage {
Q_OBJECT
-public:
- explicit APIPage(QWidget *parent = 0);
+ public:
+ explicit APIPage(QWidget* parent = 0);
~APIPage();
- QString displayName() const override
- {
- return tr("APIs");
- }
- QIcon icon() const override
- {
- return APPLICATION->getThemedIcon("worlds");
- }
- QString id() const override
- {
- return "apis";
- }
- QString helpPage() const override
- {
- return "APIs";
- }
+ QString displayName() const override { return tr("APIs"); }
+ QIcon icon() const override { return APPLICATION->getThemedIcon("worlds"); }
+ QString id() const override { return "apis"; }
+ QString helpPage() const override { return "APIs"; }
virtual bool apply() override;
void retranslate() override;
-private:
+ private:
int baseURLPasteType;
void resetBaseURLNote();
void updateBaseURLNote(int index);
@@ -81,7 +68,6 @@ private:
void loadSettings();
void applySettings();
-private:
- Ui::APIPage *ui;
+ private:
+ Ui::APIPage* ui;
};
-
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp
index fced5ff4..5c6fb092 100644
--- a/launcher/ui/pages/global/AccountListPage.cpp
+++ b/launcher/ui/pages/global/AccountListPage.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
@@ -44,29 +44,27 @@
#include "net/NetJob.h"
-#include "ui/dialogs/ProgressDialog.h"
-#include "ui/dialogs/OfflineLoginDialog.h"
+#include "ui/dialogs/CustomMessageBox.h"
#include "ui/dialogs/LoginDialog.h"
#include "ui/dialogs/MSALoginDialog.h"
-#include "ui/dialogs/CustomMessageBox.h"
+#include "ui/dialogs/OfflineLoginDialog.h"
+#include "ui/dialogs/ProgressDialog.h"
#include "ui/dialogs/SkinUploadDialog.h"
-#include "tasks/Task.h"
#include "minecraft/auth/AccountTask.h"
#include "minecraft/services/SkinDelete.h"
+#include "tasks/Task.h"
#include "Application.h"
#include "BuildConfig.h"
-AccountListPage::AccountListPage(QWidget *parent)
- : QMainWindow(parent), ui(new Ui::AccountListPage)
+AccountListPage::AccountListPage(QWidget* parent) : QMainWindow(parent), ui(new Ui::AccountListPage)
{
ui->setupUi(this);
- ui->listView->setEmptyString(tr(
- "Welcome!\n"
- "If you're new here, you can click the \"Add\" button to add your Mojang or Minecraft account."
- ));
+ ui->listView->setEmptyString(
+ tr("Welcome!\n"
+ "If you're new here, you can click the \"Add\" button to add your Mojang or Minecraft account."));
ui->listView->setEmptyMode(VersionListView::String);
ui->listView->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -82,11 +80,10 @@ AccountListPage::AccountListPage(QWidget *parent)
// Expand the account column
- QItemSelectionModel *selectionModel = ui->listView->selectionModel();
+ QItemSelectionModel* selectionModel = ui->listView->selectionModel();
- connect(selectionModel, &QItemSelectionModel::selectionChanged, [this](const QItemSelection &sel, const QItemSelection &dsel) {
- updateButtonStates();
- });
+ connect(selectionModel, &QItemSelectionModel::selectionChanged,
+ [this]([[maybe_unused]] const QItemSelection& sel, [[maybe_unused]] const QItemSelection& dsel) { updateButtonStates(); });
connect(ui->listView, &VersionListView::customContextMenuRequested, this, &AccountListPage::ShowContextMenu);
connect(m_accounts.get(), &AccountList::listChanged, this, &AccountListPage::listChanged);
@@ -121,21 +118,19 @@ void AccountListPage::ShowContextMenu(const QPoint& pos)
void AccountListPage::changeEvent(QEvent* event)
{
- if (event->type() == QEvent::LanguageChange)
- {
+ if (event->type() == QEvent::LanguageChange) {
ui->retranslateUi(this);
}
QMainWindow::changeEvent(event);
}
-QMenu * AccountListPage::createPopupMenu()
+QMenu* AccountListPage::createPopupMenu()
{
QMenu* filteredMenu = QMainWindow::createPopupMenu();
- filteredMenu->removeAction(ui->toolBar->toggleViewAction() );
+ filteredMenu->removeAction(ui->toolBar->toggleViewAction());
return filteredMenu;
}
-
void AccountListPage::listChanged()
{
updateButtonStates();
@@ -143,13 +138,10 @@ void AccountListPage::listChanged()
void AccountListPage::on_actionAddMojang_triggered()
{
- MinecraftAccountPtr account = LoginDialog::newAccount(
- this,
- tr("Please enter your Mojang account email and password to add your account.")
- );
+ MinecraftAccountPtr account =
+ LoginDialog::newAccount(this, tr("Please enter your Mojang account email and password to add your account."));
- if (account)
- {
+ if (account) {
m_accounts->addAccount(account);
if (m_accounts->count() == 1) {
m_accounts->setDefaultAccount(account);
@@ -159,13 +151,10 @@ void AccountListPage::on_actionAddMojang_triggered()
void AccountListPage::on_actionAddMicrosoft_triggered()
{
- MinecraftAccountPtr account = MSALoginDialog::newAccount(
- this,
- tr("Please enter your Mojang account email and password to add your account.")
- );
+ MinecraftAccountPtr account =
+ MSALoginDialog::newAccount(this, tr("Please enter your Mojang account email and password to add your account."));
- if (account)
- {
+ if (account) {
m_accounts->addAccount(account);
if (m_accounts->count() == 1) {
m_accounts->setDefaultAccount(account);
@@ -176,25 +165,17 @@ void AccountListPage::on_actionAddMicrosoft_triggered()
void AccountListPage::on_actionAddOffline_triggered()
{
if (!m_accounts->anyAccountIsValid()) {
- QMessageBox::warning(
- this,
- tr("Error"),
- tr(
- "You must add a Microsoft or Mojang account that owns Minecraft before you can add an offline account."
- "<br><br>"
- "If you have lost your account you can contact Microsoft for support."
- )
- );
+ QMessageBox::warning(this, tr("Error"),
+ tr("You must add a Microsoft or Mojang account that owns Minecraft before you can add an offline account."
+ "<br><br>"
+ "If you have lost your account you can contact Microsoft for support."));
return;
}
- MinecraftAccountPtr account = OfflineLoginDialog::newAccount(
- this,
- tr("Please enter your desired username to add your offline account.")
- );
+ MinecraftAccountPtr account =
+ OfflineLoginDialog::newAccount(this, tr("Please enter your desired username to add your offline account."));
- if (account)
- {
+ if (account) {
m_accounts->addAccount(account);
if (m_accounts->count() == 1) {
m_accounts->setDefaultAccount(account);
@@ -205,14 +186,14 @@ void AccountListPage::on_actionAddOffline_triggered()
void AccountListPage::on_actionRemove_triggered()
{
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
- if (selection.size() > 0)
- {
+ if (selection.size() > 0) {
QModelIndex selected = selection.first();
m_accounts->removeAccount(selected);
}
}
-void AccountListPage::on_actionRefresh_triggered() {
+void AccountListPage::on_actionRefresh_triggered()
+{
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
if (selection.size() > 0) {
QModelIndex selected = selection.first();
@@ -221,12 +202,10 @@ void AccountListPage::on_actionRefresh_triggered() {
}
}
-
void AccountListPage::on_actionSetDefault_triggered()
{
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
- if (selection.size() > 0)
- {
+ if (selection.size() > 0) {
QModelIndex selected = selection.first();
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
m_accounts->setDefaultAccount(account);
@@ -245,8 +224,7 @@ void AccountListPage::updateButtonStates()
bool hasSelection = !selection.empty();
bool accountIsReady = false;
bool accountIsOnline = false;
- if (hasSelection)
- {
+ if (hasSelection) {
QModelIndex selected = selection.first();
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
accountIsReady = !account->isActive();
@@ -258,11 +236,10 @@ void AccountListPage::updateButtonStates()
ui->actionDeleteSkin->setEnabled(accountIsReady && accountIsOnline);
ui->actionRefresh->setEnabled(accountIsReady && accountIsOnline);
- if(m_accounts->defaultAccount().get() == nullptr) {
+ if (m_accounts->defaultAccount().get() == nullptr) {
ui->actionNoDefault->setEnabled(false);
ui->actionNoDefault->setChecked(true);
- }
- else {
+ } else {
ui->actionNoDefault->setEnabled(true);
ui->actionNoDefault->setChecked(false);
}
@@ -271,8 +248,7 @@ void AccountListPage::updateButtonStates()
void AccountListPage::on_actionUploadSkin_triggered()
{
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
- if (selection.size() > 0)
- {
+ if (selection.size() > 0) {
QModelIndex selected = selection.first();
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
SkinUploadDialog dialog(account, this);
diff --git a/launcher/ui/pages/global/AccountListPage.h b/launcher/ui/pages/global/AccountListPage.h
index 9395e92b..add0f4aa 100644
--- a/launcher/ui/pages/global/AccountListPage.h
+++ b/launcher/ui/pages/global/AccountListPage.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
@@ -41,47 +41,35 @@
#include "ui/pages/BasePage.h"
-#include "minecraft/auth/AccountList.h"
#include "Application.h"
+#include "minecraft/auth/AccountList.h"
-namespace Ui
-{
+namespace Ui {
class AccountListPage;
}
class AuthenticateTask;
-class AccountListPage : public QMainWindow, public BasePage
-{
+class AccountListPage : public QMainWindow, public BasePage {
Q_OBJECT
-public:
- explicit AccountListPage(QWidget *parent = 0);
+ public:
+ explicit AccountListPage(QWidget* parent = 0);
~AccountListPage();
- QString displayName() const override
- {
- return tr("Accounts");
- }
+ QString displayName() const override { return tr("Accounts"); }
QIcon icon() const override
{
auto icon = APPLICATION->getThemedIcon("accounts");
- if(icon.isNull())
- {
+ if (icon.isNull()) {
icon = APPLICATION->getThemedIcon("noaccount");
}
return icon;
}
- QString id() const override
- {
- return "accounts";
- }
- QString helpPage() const override
- {
- return "Getting-Started#adding-an-account";
- }
+ QString id() const override { return "accounts"; }
+ QString helpPage() const override { return "Getting-Started#adding-an-account"; }
void retranslate() override;
-public slots:
+ public slots:
void on_actionAddMojang_triggered();
void on_actionAddMicrosoft_triggered();
void on_actionAddOffline_triggered();
@@ -97,12 +85,12 @@ public slots:
//! Updates the states of the dialog's buttons.
void updateButtonStates();
-protected slots:
- void ShowContextMenu(const QPoint &pos);
+ protected slots:
+ void ShowContextMenu(const QPoint& pos);
-private:
- void changeEvent(QEvent * event) override;
- QMenu * createPopupMenu() override;
+ private:
+ void changeEvent(QEvent* event) override;
+ QMenu* createPopupMenu() override;
shared_qobject_ptr<AccountList> m_accounts;
- Ui::AccountListPage *ui;
+ Ui::AccountListPage* ui;
};
diff --git a/launcher/ui/pages/global/CustomCommandsPage.cpp b/launcher/ui/pages/global/CustomCommandsPage.cpp
index df1420ca..cc8518c2 100644
--- a/launcher/ui/pages/global/CustomCommandsPage.cpp
+++ b/launcher/ui/pages/global/CustomCommandsPage.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
@@ -35,13 +35,12 @@
*/
#include "CustomCommandsPage.h"
-#include <QVBoxLayout>
-#include <QTabWidget>
#include <QTabBar>
+#include <QTabWidget>
+#include <QVBoxLayout>
-CustomCommandsPage::CustomCommandsPage(QWidget* parent): QWidget(parent)
+CustomCommandsPage::CustomCommandsPage(QWidget* parent) : QWidget(parent)
{
-
auto verticalLayout = new QVBoxLayout(this);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
@@ -56,9 +55,7 @@ CustomCommandsPage::CustomCommandsPage(QWidget* parent): QWidget(parent)
loadSettings();
}
-CustomCommandsPage::~CustomCommandsPage()
-{
-}
+CustomCommandsPage::~CustomCommandsPage() {}
bool CustomCommandsPage::apply()
{
@@ -77,13 +74,8 @@ void CustomCommandsPage::applySettings()
void CustomCommandsPage::loadSettings()
{
auto s = APPLICATION->settings();
- commands->initialize(
- false,
- true,
- s->get("PreLaunchCommand").toString(),
- s->get("WrapperCommand").toString(),
- s->get("PostExitCommand").toString()
- );
+ commands->initialize(false, true, s->get("PreLaunchCommand").toString(), s->get("WrapperCommand").toString(),
+ s->get("PostExitCommand").toString());
}
void CustomCommandsPage::retranslate()
diff --git a/launcher/ui/pages/global/CustomCommandsPage.h b/launcher/ui/pages/global/CustomCommandsPage.h
index 865503ff..ec1204ff 100644
--- a/launcher/ui/pages/global/CustomCommandsPage.h
+++ b/launcher/ui/pages/global/CustomCommandsPage.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
@@ -35,42 +35,29 @@
#pragma once
-#include <memory>
#include <QDialog>
+#include <memory>
-#include "ui/pages/BasePage.h"
#include <Application.h>
+#include "ui/pages/BasePage.h"
#include "ui/widgets/CustomCommands.h"
-class CustomCommandsPage : public QWidget, public BasePage
-{
+class CustomCommandsPage : public QWidget, public BasePage {
Q_OBJECT
-public:
- explicit CustomCommandsPage(QWidget *parent = 0);
+ public:
+ explicit CustomCommandsPage(QWidget* parent = 0);
~CustomCommandsPage();
- QString displayName() const override
- {
- return tr("Custom Commands");
- }
- QIcon icon() const override
- {
- return APPLICATION->getThemedIcon("custom-commands");
- }
- QString id() const override
- {
- return "custom-commands";
- }
- QString helpPage() const override
- {
- return "Custom-commands";
- }
+ QString displayName() const override { return tr("Custom Commands"); }
+ QIcon icon() const override { return APPLICATION->getThemedIcon("custom-commands"); }
+ QString id() const override { return "custom-commands"; }
+ QString helpPage() const override { return "Custom-commands"; }
bool apply() override;
void retranslate() override;
-private:
+ private:
void applySettings();
void loadSettings();
- CustomCommands * commands;
+ CustomCommands* commands;
};
diff --git a/launcher/ui/pages/global/ExternalToolsPage.cpp b/launcher/ui/pages/global/ExternalToolsPage.cpp
index 5ba0ebc2..33e9c538 100644
--- a/launcher/ui/pages/global/ExternalToolsPage.cpp
+++ b/launcher/ui/pages/global/ExternalToolsPage.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
@@ -36,20 +36,18 @@
#include "ExternalToolsPage.h"
#include "ui_ExternalToolsPage.h"
-#include <QMessageBox>
#include <QFileDialog>
+#include <QMessageBox>
#include <QStandardPaths>
#include <QTabBar>
-#include "settings/SettingsObject.h"
-#include "tools/BaseProfiler.h"
#include <FileSystem.h>
-#include "Application.h"
#include <tools/MCEditTool.h>
+#include "Application.h"
+#include "settings/SettingsObject.h"
+#include "tools/BaseProfiler.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"));
}
}
diff --git a/launcher/ui/pages/global/ExternalToolsPage.h b/launcher/ui/pages/global/ExternalToolsPage.h
index 8bd38a19..7248f0c9 100644
--- a/launcher/ui/pages/global/ExternalToolsPage.h
+++ b/launcher/ui/pages/global/ExternalToolsPage.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modif