From b258eac215c791b2a8eed10cecbbf9551c87f0b9 Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Mon, 22 Nov 2021 03:55:16 +0100 Subject: NOISSUE continue reshuffling the codebase --- launcher/pages/BasePage.h | 58 -- launcher/pages/BasePageContainer.h | 10 - launcher/pages/BasePageProvider.h | 68 -- launcher/pages/global/AccountListPage.cpp | 259 ------- launcher/pages/global/AccountListPage.h | 85 --- launcher/pages/global/AccountListPage.ui | 129 ---- launcher/pages/global/CustomCommandsPage.cpp | 51 -- launcher/pages/global/CustomCommandsPage.h | 55 -- launcher/pages/global/ExternalToolsPage.cpp | 233 ------- launcher/pages/global/ExternalToolsPage.h | 74 -- launcher/pages/global/ExternalToolsPage.ui | 194 ------ launcher/pages/global/JavaPage.cpp | 153 ---- launcher/pages/global/JavaPage.h | 72 -- launcher/pages/global/JavaPage.ui | 260 ------- launcher/pages/global/LanguagePage.cpp | 51 -- launcher/pages/global/LanguagePage.h | 60 -- launcher/pages/global/LauncherPage.cpp | 466 ------------- launcher/pages/global/LauncherPage.h | 103 --- launcher/pages/global/LauncherPage.ui | 584 ---------------- launcher/pages/global/MinecraftPage.cpp | 91 --- launcher/pages/global/MinecraftPage.h | 70 -- launcher/pages/global/MinecraftPage.ui | 196 ------ launcher/pages/global/PasteEEPage.cpp | 81 --- launcher/pages/global/PasteEEPage.h | 62 -- launcher/pages/global/PasteEEPage.ui | 128 ---- launcher/pages/global/ProxyPage.cpp | 106 --- launcher/pages/global/ProxyPage.h | 66 -- launcher/pages/global/ProxyPage.ui | 203 ------ launcher/pages/instance/GameOptionsPage.cpp | 37 - launcher/pages/instance/GameOptionsPage.h | 63 -- launcher/pages/instance/GameOptionsPage.ui | 88 --- launcher/pages/instance/InstanceSettingsPage.cpp | 338 --------- launcher/pages/instance/InstanceSettingsPage.h | 76 -- launcher/pages/instance/InstanceSettingsPage.ui | 548 --------------- launcher/pages/instance/LegacyUpgradePage.cpp | 50 -- launcher/pages/instance/LegacyUpgradePage.h | 64 -- launcher/pages/instance/LegacyUpgradePage.ui | 47 -- launcher/pages/instance/LogPage.cpp | 328 --------- launcher/pages/instance/LogPage.h | 86 --- launcher/pages/instance/LogPage.ui | 182 ----- launcher/pages/instance/ModFolderPage.cpp | 363 ---------- launcher/pages/instance/ModFolderPage.h | 119 ---- launcher/pages/instance/ModFolderPage.ui | 164 ----- launcher/pages/instance/NotesPage.cpp | 21 - launcher/pages/instance/NotesPage.h | 60 -- launcher/pages/instance/NotesPage.ui | 49 -- launcher/pages/instance/OtherLogsPage.cpp | 313 --------- launcher/pages/instance/OtherLogsPage.h | 81 --- launcher/pages/instance/OtherLogsPage.ui | 150 ---- launcher/pages/instance/ResourcePackPage.h | 23 - launcher/pages/instance/ScreenshotsPage.cpp | 422 ----------- launcher/pages/instance/ScreenshotsPage.h | 89 --- launcher/pages/instance/ScreenshotsPage.ui | 87 --- launcher/pages/instance/ServersPage.cpp | 768 --------------------- launcher/pages/instance/ServersPage.h | 94 --- launcher/pages/instance/ServersPage.ui | 194 ------ launcher/pages/instance/ShaderPackPage.h | 22 - launcher/pages/instance/TexturePackPage.h | 22 - launcher/pages/instance/VersionPage.cpp | 642 ----------------- launcher/pages/instance/VersionPage.h | 104 --- launcher/pages/instance/VersionPage.ui | 285 -------- launcher/pages/instance/WorldListPage.cpp | 408 ----------- launcher/pages/instance/WorldListPage.h | 99 --- launcher/pages/instance/WorldListPage.ui | 161 ----- launcher/pages/modplatform/ImportPage.cpp | 130 ---- launcher/pages/modplatform/ImportPage.h | 70 -- launcher/pages/modplatform/ImportPage.ui | 52 -- launcher/pages/modplatform/VanillaPage.cpp | 103 --- launcher/pages/modplatform/VanillaPage.h | 75 -- launcher/pages/modplatform/VanillaPage.ui | 169 ----- .../modplatform/atlauncher/AtlFilterModel.cpp | 81 --- .../pages/modplatform/atlauncher/AtlFilterModel.h | 34 - .../pages/modplatform/atlauncher/AtlListModel.cpp | 193 ------ .../pages/modplatform/atlauncher/AtlListModel.h | 52 -- .../atlauncher/AtlOptionalModDialog.cpp | 209 ------ .../modplatform/atlauncher/AtlOptionalModDialog.h | 66 -- .../modplatform/atlauncher/AtlOptionalModDialog.ui | 65 -- launcher/pages/modplatform/atlauncher/AtlPage.cpp | 169 ----- launcher/pages/modplatform/atlauncher/AtlPage.h | 86 --- launcher/pages/modplatform/atlauncher/AtlPage.ui | 92 --- launcher/pages/modplatform/flame/FlameModel.cpp | 258 ------- launcher/pages/modplatform/flame/FlameModel.h | 76 -- launcher/pages/modplatform/flame/FlamePage.cpp | 185 ----- launcher/pages/modplatform/flame/FlamePage.h | 80 --- launcher/pages/modplatform/flame/FlamePage.ui | 90 --- launcher/pages/modplatform/ftb/FtbFilterModel.cpp | 76 -- launcher/pages/modplatform/ftb/FtbFilterModel.h | 35 - launcher/pages/modplatform/ftb/FtbListModel.cpp | 278 -------- launcher/pages/modplatform/ftb/FtbListModel.h | 61 -- launcher/pages/modplatform/ftb/FtbPage.cpp | 150 ---- launcher/pages/modplatform/ftb/FtbPage.h | 83 --- launcher/pages/modplatform/ftb/FtbPage.ui | 79 --- .../pages/modplatform/legacy_ftb/ListModel.cpp | 259 ------- launcher/pages/modplatform/legacy_ftb/ListModel.h | 78 --- launcher/pages/modplatform/legacy_ftb/Page.cpp | 369 ---------- launcher/pages/modplatform/legacy_ftb/Page.h | 119 ---- launcher/pages/modplatform/legacy_ftb/Page.ui | 135 ---- launcher/pages/modplatform/technic/TechnicData.h | 42 -- .../pages/modplatform/technic/TechnicModel.cpp | 237 ------- launcher/pages/modplatform/technic/TechnicModel.h | 70 -- launcher/pages/modplatform/technic/TechnicPage.cpp | 198 ------ launcher/pages/modplatform/technic/TechnicPage.h | 78 --- launcher/pages/modplatform/technic/TechnicPage.ui | 95 --- 103 files changed, 15392 deletions(-) delete mode 100644 launcher/pages/BasePage.h delete mode 100644 launcher/pages/BasePageContainer.h delete mode 100644 launcher/pages/BasePageProvider.h delete mode 100644 launcher/pages/global/AccountListPage.cpp delete mode 100644 launcher/pages/global/AccountListPage.h delete mode 100644 launcher/pages/global/AccountListPage.ui delete mode 100644 launcher/pages/global/CustomCommandsPage.cpp delete mode 100644 launcher/pages/global/CustomCommandsPage.h delete mode 100644 launcher/pages/global/ExternalToolsPage.cpp delete mode 100644 launcher/pages/global/ExternalToolsPage.h delete mode 100644 launcher/pages/global/ExternalToolsPage.ui delete mode 100644 launcher/pages/global/JavaPage.cpp delete mode 100644 launcher/pages/global/JavaPage.h delete mode 100644 launcher/pages/global/JavaPage.ui delete mode 100644 launcher/pages/global/LanguagePage.cpp delete mode 100644 launcher/pages/global/LanguagePage.h delete mode 100644 launcher/pages/global/LauncherPage.cpp delete mode 100644 launcher/pages/global/LauncherPage.h delete mode 100644 launcher/pages/global/LauncherPage.ui delete mode 100644 launcher/pages/global/MinecraftPage.cpp delete mode 100644 launcher/pages/global/MinecraftPage.h delete mode 100644 launcher/pages/global/MinecraftPage.ui delete mode 100644 launcher/pages/global/PasteEEPage.cpp delete mode 100644 launcher/pages/global/PasteEEPage.h delete mode 100644 launcher/pages/global/PasteEEPage.ui delete mode 100644 launcher/pages/global/ProxyPage.cpp delete mode 100644 launcher/pages/global/ProxyPage.h delete mode 100644 launcher/pages/global/ProxyPage.ui delete mode 100644 launcher/pages/instance/GameOptionsPage.cpp delete mode 100644 launcher/pages/instance/GameOptionsPage.h delete mode 100644 launcher/pages/instance/GameOptionsPage.ui delete mode 100644 launcher/pages/instance/InstanceSettingsPage.cpp delete mode 100644 launcher/pages/instance/InstanceSettingsPage.h delete mode 100644 launcher/pages/instance/InstanceSettingsPage.ui delete mode 100644 launcher/pages/instance/LegacyUpgradePage.cpp delete mode 100644 launcher/pages/instance/LegacyUpgradePage.h delete mode 100644 launcher/pages/instance/LegacyUpgradePage.ui delete mode 100644 launcher/pages/instance/LogPage.cpp delete mode 100644 launcher/pages/instance/LogPage.h delete mode 100644 launcher/pages/instance/LogPage.ui delete mode 100644 launcher/pages/instance/ModFolderPage.cpp delete mode 100644 launcher/pages/instance/ModFolderPage.h delete mode 100644 launcher/pages/instance/ModFolderPage.ui delete mode 100644 launcher/pages/instance/NotesPage.cpp delete mode 100644 launcher/pages/instance/NotesPage.h delete mode 100644 launcher/pages/instance/NotesPage.ui delete mode 100644 launcher/pages/instance/OtherLogsPage.cpp delete mode 100644 launcher/pages/instance/OtherLogsPage.h delete mode 100644 launcher/pages/instance/OtherLogsPage.ui delete mode 100644 launcher/pages/instance/ResourcePackPage.h delete mode 100644 launcher/pages/instance/ScreenshotsPage.cpp delete mode 100644 launcher/pages/instance/ScreenshotsPage.h delete mode 100644 launcher/pages/instance/ScreenshotsPage.ui delete mode 100644 launcher/pages/instance/ServersPage.cpp delete mode 100644 launcher/pages/instance/ServersPage.h delete mode 100644 launcher/pages/instance/ServersPage.ui delete mode 100644 launcher/pages/instance/ShaderPackPage.h delete mode 100644 launcher/pages/instance/TexturePackPage.h delete mode 100644 launcher/pages/instance/VersionPage.cpp delete mode 100644 launcher/pages/instance/VersionPage.h delete mode 100644 launcher/pages/instance/VersionPage.ui delete mode 100644 launcher/pages/instance/WorldListPage.cpp delete mode 100644 launcher/pages/instance/WorldListPage.h delete mode 100644 launcher/pages/instance/WorldListPage.ui delete mode 100644 launcher/pages/modplatform/ImportPage.cpp delete mode 100644 launcher/pages/modplatform/ImportPage.h delete mode 100644 launcher/pages/modplatform/ImportPage.ui delete mode 100644 launcher/pages/modplatform/VanillaPage.cpp delete mode 100644 launcher/pages/modplatform/VanillaPage.h delete mode 100644 launcher/pages/modplatform/VanillaPage.ui delete mode 100644 launcher/pages/modplatform/atlauncher/AtlFilterModel.cpp delete mode 100644 launcher/pages/modplatform/atlauncher/AtlFilterModel.h delete mode 100644 launcher/pages/modplatform/atlauncher/AtlListModel.cpp delete mode 100644 launcher/pages/modplatform/atlauncher/AtlListModel.h delete mode 100644 launcher/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp delete mode 100644 launcher/pages/modplatform/atlauncher/AtlOptionalModDialog.h delete mode 100644 launcher/pages/modplatform/atlauncher/AtlOptionalModDialog.ui delete mode 100644 launcher/pages/modplatform/atlauncher/AtlPage.cpp delete mode 100644 launcher/pages/modplatform/atlauncher/AtlPage.h delete mode 100644 launcher/pages/modplatform/atlauncher/AtlPage.ui delete mode 100644 launcher/pages/modplatform/flame/FlameModel.cpp delete mode 100644 launcher/pages/modplatform/flame/FlameModel.h delete mode 100644 launcher/pages/modplatform/flame/FlamePage.cpp delete mode 100644 launcher/pages/modplatform/flame/FlamePage.h delete mode 100644 launcher/pages/modplatform/flame/FlamePage.ui delete mode 100644 launcher/pages/modplatform/ftb/FtbFilterModel.cpp delete mode 100644 launcher/pages/modplatform/ftb/FtbFilterModel.h delete mode 100644 launcher/pages/modplatform/ftb/FtbListModel.cpp delete mode 100644 launcher/pages/modplatform/ftb/FtbListModel.h delete mode 100644 launcher/pages/modplatform/ftb/FtbPage.cpp delete mode 100644 launcher/pages/modplatform/ftb/FtbPage.h delete mode 100644 launcher/pages/modplatform/ftb/FtbPage.ui delete mode 100644 launcher/pages/modplatform/legacy_ftb/ListModel.cpp delete mode 100644 launcher/pages/modplatform/legacy_ftb/ListModel.h delete mode 100644 launcher/pages/modplatform/legacy_ftb/Page.cpp delete mode 100644 launcher/pages/modplatform/legacy_ftb/Page.h delete mode 100644 launcher/pages/modplatform/legacy_ftb/Page.ui delete mode 100644 launcher/pages/modplatform/technic/TechnicData.h delete mode 100644 launcher/pages/modplatform/technic/TechnicModel.cpp delete mode 100644 launcher/pages/modplatform/technic/TechnicModel.h delete mode 100644 launcher/pages/modplatform/technic/TechnicPage.cpp delete mode 100644 launcher/pages/modplatform/technic/TechnicPage.h delete mode 100644 launcher/pages/modplatform/technic/TechnicPage.ui (limited to 'launcher/pages') diff --git a/launcher/pages/BasePage.h b/launcher/pages/BasePage.h deleted file mode 100644 index 408965d0..00000000 --- a/launcher/pages/BasePage.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -#include "BasePageContainer.h" - -class BasePage -{ -public: - virtual ~BasePage() {} - virtual QString id() const = 0; - virtual QString displayName() const = 0; - virtual QIcon icon() const = 0; - virtual bool apply() { return true; } - virtual bool shouldDisplay() const { return true; } - virtual QString helpPage() const { return QString(); } - void opened() - { - isOpened = true; - openedImpl(); - } - void closed() - { - isOpened = false; - closedImpl(); - } - virtual void openedImpl() {} - virtual void closedImpl() {} - virtual void setParentContainer(BasePageContainer * container) - { - m_container = container; - }; -public: - int stackIndex = -1; - int listIndex = -1; -protected: - BasePageContainer * m_container = nullptr; - bool isOpened = false; -}; - -typedef std::shared_ptr BasePagePtr; diff --git a/launcher/pages/BasePageContainer.h b/launcher/pages/BasePageContainer.h deleted file mode 100644 index f8c7adeb..00000000 --- a/launcher/pages/BasePageContainer.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -class BasePageContainer -{ -public: - virtual ~BasePageContainer(){}; - virtual bool selectPage(QString pageId) = 0; - virtual void refreshContainer() = 0; - virtual bool requestClose() = 0; -}; diff --git a/launcher/pages/BasePageProvider.h b/launcher/pages/BasePageProvider.h deleted file mode 100644 index 7bfaaf3b..00000000 --- a/launcher/pages/BasePageProvider.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "pages/BasePage.h" -#include -#include - -class BasePageProvider -{ -public: - virtual QList getPages() = 0; - virtual QString dialogTitle() = 0; -}; - -class GenericPageProvider : public BasePageProvider -{ - typedef std::function PageCreator; -public: - explicit GenericPageProvider(const QString &dialogTitle) - : m_dialogTitle(dialogTitle) - { - } - virtual ~GenericPageProvider() {} - - QList getPages() override - { - QList pages; - for (PageCreator creator : m_creators) - { - pages.append(creator()); - } - return pages; - } - QString dialogTitle() override { return m_dialogTitle; } - - void setDialogTitle(const QString &title) - { - m_dialogTitle = title; - } - void addPageCreator(PageCreator page) - { - m_creators.append(page); - } - - template - void addPage() - { - addPageCreator([](){return new PageClass();}); - } - -private: - QList m_creators; - QString m_dialogTitle; -}; diff --git a/launcher/pages/global/AccountListPage.cpp b/launcher/pages/global/AccountListPage.cpp deleted file mode 100644 index 1e175df7..00000000 --- a/launcher/pages/global/AccountListPage.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "AccountListPage.h" -#include "ui_AccountListPage.h" - -#include -#include - -#include - -#include "net/NetJob.h" - -#include "dialogs/ProgressDialog.h" -#include "dialogs/LoginDialog.h" -#include "dialogs/CustomMessageBox.h" -#include "dialogs/SkinUploadDialog.h" -#include "tasks/Task.h" -#include "minecraft/auth/AccountTask.h" -#include "minecraft/services/SkinDelete.h" - -#include "Application.h" - -#include "BuildConfig.h" -#include - -#include "Secrets.h" - -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->setEmptyMode(VersionListView::String); - ui->listView->setContextMenuPolicy(Qt::CustomContextMenu); - - m_accounts = APPLICATION->accounts(); - - ui->listView->setModel(m_accounts.get()); - ui->listView->header()->setSectionResizeMode(0, QHeaderView::Stretch); - ui->listView->header()->setSectionResizeMode(1, QHeaderView::Stretch); - ui->listView->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); - ui->listView->setSelectionMode(QAbstractItemView::SingleSelection); - - // Expand the account column - - QItemSelectionModel *selectionModel = ui->listView->selectionModel(); - - connect(selectionModel, &QItemSelectionModel::selectionChanged, [this](const QItemSelection &sel, const QItemSelection &dsel) { - updateButtonStates(); - }); - connect(ui->listView, &VersionListView::customContextMenuRequested, this, &AccountListPage::ShowContextMenu); - - connect(m_accounts.get(), &AccountList::listChanged, this, &AccountListPage::listChanged); - connect(m_accounts.get(), &AccountList::listActivityChanged, this, &AccountListPage::listChanged); - connect(m_accounts.get(), &AccountList::defaultAccountChanged, this, &AccountListPage::listChanged); - - updateButtonStates(); - - // Xbox authentication won't work without a client identifier, so disable the button if it is missing - ui->actionAddMicrosoft->setVisible(Secrets::hasMSAClientID()); -} - -AccountListPage::~AccountListPage() -{ - delete ui; -} - -void AccountListPage::ShowContextMenu(const QPoint& pos) -{ - auto menu = ui->toolBar->createContextMenu(this, tr("Context menu")); - menu->exec(ui->listView->mapToGlobal(pos)); - delete menu; -} - -void AccountListPage::changeEvent(QEvent* event) -{ - if (event->type() == QEvent::LanguageChange) - { - ui->retranslateUi(this); - } - QMainWindow::changeEvent(event); -} - -QMenu * AccountListPage::createPopupMenu() -{ - QMenu* filteredMenu = QMainWindow::createPopupMenu(); - filteredMenu->removeAction(ui->toolBar->toggleViewAction() ); - return filteredMenu; -} - - -void AccountListPage::listChanged() -{ - updateButtonStates(); -} - -void AccountListPage::on_actionAddMojang_triggered() -{ - MinecraftAccountPtr account = LoginDialog::newAccount( - this, - tr("Please enter your Mojang account email and password to add your account.") - ); - - if (account) - { - m_accounts->addAccount(account); - if (m_accounts->count() == 1) { - m_accounts->setDefaultAccount(account); - } - } -} - -void AccountListPage::on_actionAddMicrosoft_triggered() -{ - if(BuildConfig.BUILD_PLATFORM == "osx64") { - CustomMessageBox::selectable( - this, - tr("Microsoft Accounts not available"), - tr( - "Microsoft accounts are only usable on macOS 10.13 or newer, with fully updated MultiMC.\n\n" - "Please update both your operating system and MultiMC." - ), - QMessageBox::Warning - )->exec(); - return; - } - MinecraftAccountPtr account = MSALoginDialog::newAccount( - this, - tr("Please enter your Mojang account email and password to add your account.") - ); - - if (account) - { - m_accounts->addAccount(account); - if (m_accounts->count() == 1) { - m_accounts->setDefaultAccount(account); - } - } -} - -void AccountListPage::on_actionRemove_triggered() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - m_accounts->removeAccount(selected); - } -} - -void AccountListPage::on_actionRefresh_triggered() { - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) { - QModelIndex selected = selection.first(); - MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value(); - AuthSessionPtr session = std::make_shared(); - auto task = account->refresh(session); - if (task) { - ProgressDialog progDialog(this); - progDialog.execWithTask(task.get()); - // TODO: respond to results of the task - } - } -} - - -void AccountListPage::on_actionSetDefault_triggered() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value(); - m_accounts->setDefaultAccount(account); - } -} - -void AccountListPage::on_actionNoDefault_triggered() -{ - m_accounts->setDefaultAccount(nullptr); -} - -void AccountListPage::updateButtonStates() -{ - // If there is no selection, disable buttons that require something selected. - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - bool hasSelection = selection.size() > 0; - bool accountIsReady = false; - if (hasSelection) - { - QModelIndex selected = selection.first(); - MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value(); - accountIsReady = !account->isActive(); - } - ui->actionRemove->setEnabled(accountIsReady); - ui->actionSetDefault->setEnabled(accountIsReady); - ui->actionUploadSkin->setEnabled(accountIsReady); - ui->actionDeleteSkin->setEnabled(accountIsReady); - ui->actionRefresh->setEnabled(accountIsReady); - - if(m_accounts->defaultAccount().get() == nullptr) { - ui->actionNoDefault->setEnabled(false); - ui->actionNoDefault->setChecked(true); - } - else { - ui->actionNoDefault->setEnabled(true); - ui->actionNoDefault->setChecked(false); - } -} - -void AccountListPage::on_actionUploadSkin_triggered() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value(); - SkinUploadDialog dialog(account, this); - dialog.exec(); - } -} - -void AccountListPage::on_actionDeleteSkin_triggered() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() <= 0) - return; - - QModelIndex selected = selection.first(); - AuthSessionPtr session = std::make_shared(); - MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value(); - auto login = account->refresh(session); - ProgressDialog prog(this); - if (prog.execWithTask((Task*)login.get()) != QDialog::Accepted) { - CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to login!"), QMessageBox::Warning)->exec(); - return; - } - auto deleteSkinTask = std::make_shared(this, session); - if (prog.execWithTask((Task*)deleteSkinTask.get()) != QDialog::Accepted) { - CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to delete current skin!"), QMessageBox::Warning)->exec(); - return; - } -} diff --git a/launcher/pages/global/AccountListPage.h b/launcher/pages/global/AccountListPage.h deleted file mode 100644 index eb131ea8..00000000 --- a/launcher/pages/global/AccountListPage.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "pages/BasePage.h" - -#include "minecraft/auth/AccountList.h" -#include "Application.h" - -namespace Ui -{ -class AccountListPage; -} - -class AuthenticateTask; - -class AccountListPage : public QMainWindow, public BasePage -{ - Q_OBJECT -public: - explicit AccountListPage(QWidget *parent = 0); - ~AccountListPage(); - - QString displayName() const override - { - return tr("Accounts"); - } - QIcon icon() const override - { - auto icon = APPLICATION->getThemedIcon("accounts"); - 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"; - } - -public slots: - void on_actionAddMojang_triggered(); - void on_actionAddMicrosoft_triggered(); - void on_actionRemove_triggered(); - void on_actionRefresh_triggered(); - void on_actionSetDefault_triggered(); - void on_actionNoDefault_triggered(); - void on_actionUploadSkin_triggered(); - void on_actionDeleteSkin_triggered(); - - void listChanged(); - - //! Updates the states of the dialog's buttons. - void updateButtonStates(); - -protected slots: - void ShowContextMenu(const QPoint &pos); - -private: - void changeEvent(QEvent * event) override; - QMenu * createPopupMenu() override; - shared_qobject_ptr m_accounts; - Ui::AccountListPage *ui; -}; diff --git a/launcher/pages/global/AccountListPage.ui b/launcher/pages/global/AccountListPage.ui deleted file mode 100644 index 8af23a2f..00000000 --- a/launcher/pages/global/AccountListPage.ui +++ /dev/null @@ -1,129 +0,0 @@ - - - AccountListPage - - - - 0 - 0 - 800 - 600 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - false - - - false - - - true - - - false - - - - - - - - RightToolBarArea - - - false - - - - - - - - - - - - - - Add Mojang - - - - - Remove - - - - - Set Default - - - - - true - - - No Default - - - - - Upload Skin - - - - - Delete Skin - - - Delete the currently active skin and go back to the default one - - - - - Add Microsoft - - - - - Refresh - - - Refresh the account tokens - - - - - - VersionListView - QTreeView -
widgets/VersionListView.h
-
- - WideBar - QToolBar -
widgets/WideBar.h
-
-
- - -
diff --git a/launcher/pages/global/CustomCommandsPage.cpp b/launcher/pages/global/CustomCommandsPage.cpp deleted file mode 100644 index 8541e3c1..00000000 --- a/launcher/pages/global/CustomCommandsPage.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "CustomCommandsPage.h" -#include -#include -#include - -CustomCommandsPage::CustomCommandsPage(QWidget* parent): QWidget(parent) -{ - - auto verticalLayout = new QVBoxLayout(this); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - verticalLayout->setContentsMargins(0, 0, 0, 0); - - auto tabWidget = new QTabWidget(this); - tabWidget->setObjectName(QStringLiteral("tabWidget")); - commands = new CustomCommands(this); - commands->setContentsMargins(6, 6, 6, 6); - tabWidget->addTab(commands, "Foo"); - tabWidget->tabBar()->hide(); - verticalLayout->addWidget(tabWidget); - loadSettings(); -} - -CustomCommandsPage::~CustomCommandsPage() -{ -} - -bool CustomCommandsPage::apply() -{ - applySettings(); - return true; -} - -void CustomCommandsPage::applySettings() -{ - auto s = APPLICATION->settings(); - s->set("PreLaunchCommand", commands->prelaunchCommand()); - s->set("WrapperCommand", commands->wrapperCommand()); - s->set("PostExitCommand", commands->postexitCommand()); -} - -void CustomCommandsPage::loadSettings() -{ - auto s = APPLICATION->settings(); - commands->initialize( - false, - true, - s->get("PreLaunchCommand").toString(), - s->get("WrapperCommand").toString(), - s->get("PostExitCommand").toString() - ); -} diff --git a/launcher/pages/global/CustomCommandsPage.h b/launcher/pages/global/CustomCommandsPage.h deleted file mode 100644 index f81b192a..00000000 --- a/launcher/pages/global/CustomCommandsPage.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2018-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "pages/BasePage.h" -#include -#include "widgets/CustomCommands.h" - -class CustomCommandsPage : public QWidget, public BasePage -{ - Q_OBJECT - -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"; - } - bool apply() override; - -private: - void applySettings(); - void loadSettings(); - CustomCommands * commands; -}; diff --git a/launcher/pages/global/ExternalToolsPage.cpp b/launcher/pages/global/ExternalToolsPage.cpp deleted file mode 100644 index 41d900aa..00000000 --- a/launcher/pages/global/ExternalToolsPage.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ExternalToolsPage.h" -#include "ui_ExternalToolsPage.h" - -#include -#include -#include -#include - -#include "settings/SettingsObject.h" -#include "tools/BaseProfiler.h" -#include -#include "Application.h" -#include - -ExternalToolsPage::ExternalToolsPage(QWidget *parent) : - QWidget(parent), - ui(new Ui::ExternalToolsPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - - #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) - ui->jsonEditorTextBox->setClearButtonEnabled(true); - #endif - - ui->mceditLink->setOpenExternalLinks(true); - ui->jvisualvmLink->setOpenExternalLinks(true); - ui->jprofilerLink->setOpenExternalLinks(true); - loadSettings(); -} - -ExternalToolsPage::~ExternalToolsPage() -{ - delete ui; -} - -void ExternalToolsPage::loadSettings() -{ - auto s = APPLICATION->settings(); - ui->jprofilerPathEdit->setText(s->get("JProfilerPath").toString()); - ui->jvisualvmPathEdit->setText(s->get("JVisualVMPath").toString()); - ui->mceditPathEdit->setText(s->get("MCEditPath").toString()); - - // Editors - ui->jsonEditorTextBox->setText(s->get("JsonEditor").toString()); -} -void ExternalToolsPage::applySettings() -{ - auto s = APPLICATION->settings(); - - s->set("JProfilerPath", ui->jprofilerPathEdit->text()); - s->set("JVisualVMPath", ui->jvisualvmPathEdit->text()); - s->set("MCEditPath", ui->mceditPathEdit->text()); - - // Editors - QString jsonEditor = ui->jsonEditorTextBox->text(); - if (!jsonEditor.isEmpty() && - (!QFileInfo(jsonEditor).exists() || !QFileInfo(jsonEditor).isExecutable())) - { - QString found = QStandardPaths::findExecutable(jsonEditor); - if (!found.isEmpty()) - { - jsonEditor = found; - } - } - s->set("JsonEditor", jsonEditor); -} - -void ExternalToolsPage::on_jprofilerPathBtn_clicked() -{ - QString raw_dir = ui->jprofilerPathEdit->text(); - QString error; - do - { - raw_dir = QFileDialog::getExistingDirectory(this, tr("JProfiler Folder"), raw_dir); - if (raw_dir.isEmpty()) - { - break; - } - QString cooked_dir = FS::NormalizePath(raw_dir); - 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 - { - ui->jprofilerPathEdit->setText(cooked_dir); - break; - } - } while (1); -} -void ExternalToolsPage::on_jprofilerCheckBtn_clicked() -{ - QString 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 - { - QMessageBox::information(this, tr("OK"), tr("JProfiler setup seems to be OK")); - } -} - -void ExternalToolsPage::on_jvisualvmPathBtn_clicked() -{ - QString raw_dir = ui->jvisualvmPathEdit->text(); - QString error; - do - { - raw_dir = QFileDialog::getOpenFileName(this, tr("JVisualVM Executable"), raw_dir); - if (raw_dir.isEmpty()) - { - break; - } - QString cooked_dir = FS::NormalizePath(raw_dir); - 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 - { - ui->jvisualvmPathEdit->setText(cooked_dir); - break; - } - } while (1); -} -void ExternalToolsPage::on_jvisualvmCheckBtn_clicked() -{ - QString 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 - { - QMessageBox::information(this, tr("OK"), tr("JVisualVM setup seems to be OK")); - } -} - -void ExternalToolsPage::on_mceditPathBtn_clicked() -{ - QString raw_dir = ui->mceditPathEdit->text(); - QString error; - 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()) - { - break; - } - QString cooked_dir = FS::NormalizePath(raw_dir); - if (!APPLICATION->mcedit()->check(cooked_dir, error)) - { - QMessageBox::critical(this, tr("Error"), tr("Error while checking MCEdit install:\n%1").arg(error)); - continue; - } - else - { - ui->mceditPathEdit->setText(cooked_dir); - break; - } - } while (1); -} -void ExternalToolsPage::on_mceditCheckBtn_clicked() -{ - QString 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 - { - 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() -#if defined(Q_OS_LINUX) - ? QString("/usr/bin") -#else - ? QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first() -#endif - : ui->jsonEditorTextBox->text()); - - 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()) - { - ui->jsonEditorTextBox->setText(cooked_file); - } - else - { - QMessageBox::warning(this, tr("Invalid"), - tr("The file chosen does not seem to be an executable")); - } -} - -bool ExternalToolsPage::apply() -{ - applySettings(); - return true; -} diff --git a/launcher/pages/global/ExternalToolsPage.h b/launcher/pages/global/ExternalToolsPage.h deleted file mode 100644 index 9571ce75..00000000 --- a/launcher/pages/global/ExternalToolsPage.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include - -namespace Ui { -class ExternalToolsPage; -} - -class ExternalToolsPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit ExternalToolsPage(QWidget *parent = 0); - ~ExternalToolsPage(); - - QString displayName() const override - { - return tr("External Tools"); - } - QIcon icon() const override - { - auto icon = APPLICATION->getThemedIcon("externaltools"); - if(icon.isNull()) - { - icon = APPLICATION->getThemedIcon("loadermods"); - } - return icon; - } - QString id() const override - { - return "external-tools"; - } - QString helpPage() const override - { - return "Tools"; - } - virtual bool apply() override; - -private: - void loadSettings(); - void applySettings(); - -private: - Ui::ExternalToolsPage *ui; - -private -slots: - void on_jprofilerPathBtn_clicked(); - void on_jprofilerCheckBtn_clicked(); - void on_jvisualvmPathBtn_clicked(); - void on_jvisualvmCheckBtn_clicked(); - void on_mceditPathBtn_clicked(); - void on_mceditCheckBtn_clicked(); - void on_jsonEditorBrowseBtn_clicked(); -}; diff --git a/launcher/pages/global/ExternalToolsPage.ui b/launcher/pages/global/ExternalToolsPage.ui deleted file mode 100644 index e79e9388..00000000 --- a/launcher/pages/global/ExternalToolsPage.ui +++ /dev/null @@ -1,194 +0,0 @@ - - - ExternalToolsPage - - - - 0 - 0 - 673 - 751 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - Tab 1 - - - - - - JProfiler - - - - - - - - - - - ... - - - - - - - - - Check - - - - - - - <html><head/><body><p><a href="https://www.ej-technologies.com/products/jprofiler/overview.html">https://www.ej-technologies.com/products/jprofiler/overview.html</a></p></body></html> - - - - - - - - - - JVisualVM - - - - - - - - - - - ... - - - - - - - - - Check - - - - - - - <html><head/><body><p><a href="https://visualvm.github.io/">https://visualvm.github.io/</a></p></body></html> - - - - - - - - - - MCEdit - - - - - - - - - - - ... - - - - - - - - - Check - - - - - - - <html><head/><body><p><a href="https://www.mcedit.net/">https://www.mcedit.net/</a></p></body></html> - - - - - - - - - - External Editors (leave empty for system default) - - - - - - - - - Text Editor: - - - - - - - ... - - - - - - - - - - Qt::Vertical - - - - 20 - 216 - - - - - - - - - - - - - diff --git a/launcher/pages/global/JavaPage.cpp b/launcher/pages/global/JavaPage.cpp deleted file mode 100644 index fe545636..00000000 --- a/launcher/pages/global/JavaPage.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "JavaPage.h" -#include "JavaCommon.h" -#include "ui_JavaPage.h" - -#include -#include -#include -#include - -#include "dialogs/VersionSelectDialog.h" - -#include "java/JavaUtils.h" -#include "java/JavaInstallList.h" - -#include "settings/SettingsObject.h" -#include -#include "Application.h" -#include - -JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - - auto sysMiB = Sys::getSystemRam() / Sys::mebibyte; - ui->maxMemSpinBox->setMaximum(sysMiB); - loadSettings(); -} - -JavaPage::~JavaPage() -{ - delete ui; -} - -bool JavaPage::apply() -{ - applySettings(); - return true; -} - -void JavaPage::applySettings() -{ - auto s = APPLICATION->settings(); - - // Memory - int min = ui->minMemSpinBox->value(); - int max = ui->maxMemSpinBox->value(); - if(min < max) - { - s->set("MinMemAlloc", min); - s->set("MaxMemAlloc", max); - } - else - { - s->set("MinMemAlloc", max); - s->set("MaxMemAlloc", min); - } - s->set("PermGen", ui->permGenSpinBox->value()); - - // Java Settings - s->set("JavaPath", ui->javaPathTextBox->text()); - s->set("JvmArgs", ui->jvmArgsTextBox->text()); - JavaCommon::checkJVMArgs(s->get("JvmArgs").toString(), this->parentWidget()); -} -void JavaPage::loadSettings() -{ - auto s = APPLICATION->settings(); - // Memory - int min = s->get("MinMemAlloc").toInt(); - int max = s->get("MaxMemAlloc").toInt(); - if(min < max) - { - ui->minMemSpinBox->setValue(min); - ui->maxMemSpinBox->setValue(max); - } - else - { - ui->minMemSpinBox->setValue(max); - ui->maxMemSpinBox->setValue(min); - } - ui->permGenSpinBox->setValue(s->get("PermGen").toInt()); - - // Java Settings - ui->javaPathTextBox->setText(s->get("JavaPath").toString()); - ui->jvmArgsTextBox->setText(s->get("JvmArgs").toString()); -} - -void JavaPage::on_javaDetectBtn_clicked() -{ - JavaInstallPtr java; - - VersionSelectDialog vselect(APPLICATION->javalist().get(), tr("Select a Java version"), this, true); - vselect.setResizeOn(2); - vselect.exec(); - - if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) - { - java = std::dynamic_pointer_cast(vselect.selectedVersion()); - ui->javaPathTextBox->setText(java->path); - } -} - -void JavaPage::on_javaBrowseBtn_clicked() -{ - QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable")); - - // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if(raw_path.isEmpty()) - { - return; - } - - QString cooked_path = FS::NormalizePath(raw_path); - QFileInfo javaInfo(cooked_path);; - if(!javaInfo.exists() || !javaInfo.isExecutable()) - { - return; - } - ui->javaPathTextBox->setText(cooked_path); -} - -void JavaPage::on_javaTestBtn_clicked() -{ - if(checker) - { - return; - } - checker.reset(new JavaCommon::TestCheck( - this, ui->javaPathTextBox->text(), ui->jvmArgsTextBox->text(), - ui->minMemSpinBox->value(), ui->maxMemSpinBox->value(), ui->permGenSpinBox->value())); - connect(checker.get(), SIGNAL(finished()), SLOT(checkerFinished())); - checker->run(); -} - -void JavaPage::checkerFinished() -{ - checker.reset(); -} diff --git a/launcher/pages/global/JavaPage.h b/launcher/pages/global/JavaPage.h deleted file mode 100644 index 56a1d36b..00000000 --- a/launcher/pages/global/JavaPage.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include "pages/BasePage.h" -#include "JavaCommon.h" -#include -#include - -class SettingsObject; - -namespace Ui -{ -class JavaPage; -} - -class JavaPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit JavaPage(QWidget *parent = 0); - ~JavaPage(); - - QString displayName() const override - { - return tr("Java"); - } - QIcon icon() const override - { - return APPLICATION->getThemedIcon("java"); - } - QString id() const override - { - return "java-settings"; - } - QString helpPage() const override - { - return "Java-settings"; - } - bool apply() override; - -private: - void applySettings(); - void loadSettings(); - -private -slots: - void on_javaDetectBtn_clicked(); - void on_javaTestBtn_clicked(); - void on_javaBrowseBtn_clicked(); - void checkerFinished(); - -private: - Ui::JavaPage *ui; - unique_qobject_ptr checker; -}; diff --git a/launcher/pages/global/JavaPage.ui b/launcher/pages/global/JavaPage.ui deleted file mode 100644 index b67e9994..00000000 --- a/launcher/pages/global/JavaPage.ui +++ /dev/null @@ -1,260 +0,0 @@ - - - JavaPage - - - - 0 - 0 - 545 - 580 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - Tab 1 - - - - - - Memory - - - - - - The maximum amount of memory Minecraft is allowed to use. - - - MiB - - - 128 - - - 65536 - - - 128 - - - 1024 - - - - - - - Minimum memory allocation: - - - - - - - Maximum memory allocation: - - - - - - - The amount of memory Minecraft is started with. - - - MiB - - - 128 - - - 65536 - - - 128 - - - 256 - - - - - - - PermGen: - - - - - - - The amount of memory available to store loaded Java classes. - - - MiB - - - 64 - - - 999999999 - - - 8 - - - 64 - - - - - - - - - - Java Runtime - - - - - - - 0 - 0 - - - - Java path: - - - - - - - - - - - - - 0 - 0 - - - - - 28 - 16777215 - - - - ... - - - - - -