From 48b2f95129cb8ad67932ae000e32ce212080e037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 9 Jul 2019 21:43:12 +0200 Subject: [PATCH] Revert "NOISSUE simple/stupid default game options, UI only" This reverts commit 497d9bec029247f202befb34cc3d5da6e810fa73. --- application/CMakeLists.txt | 3 - application/MultiMC.cpp | 7 -- .../pages/global/DefaultGameOptionsPage.cpp | 110 ------------------ .../pages/global/DefaultGameOptionsPage.h | 73 ------------ .../pages/global/DefaultGameOptionsPage.ui | 96 --------------- 5 files changed, 289 deletions(-) delete mode 100644 application/pages/global/DefaultGameOptionsPage.cpp delete mode 100644 application/pages/global/DefaultGameOptionsPage.h delete mode 100644 application/pages/global/DefaultGameOptionsPage.ui diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 9b5412a9..10e1afc7 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -111,8 +111,6 @@ SET(MULTIMC_SOURCES pages/global/AccountListPage.h pages/global/CustomCommandsPage.cpp pages/global/CustomCommandsPage.h - pages/global/DefaultGameOptionsPage.cpp - pages/global/DefaultGameOptionsPage.h pages/global/ExternalToolsPage.cpp pages/global/ExternalToolsPage.h pages/global/JavaPage.cpp @@ -244,7 +242,6 @@ SET(MULTIMC_UIS # Global settings pages pages/global/AccountListPage.ui - pages/global/DefaultGameOptionsPage.ui pages/global/ExternalToolsPage.ui pages/global/JavaPage.ui pages/global/MinecraftPage.ui diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index e07e3888..d76bd0a7 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -13,7 +13,6 @@ #include "pages/global/PasteEEPage.h" #include "pages/global/PackagesPage.h" #include "pages/global/CustomCommandsPage.h" -#include "pages/global/DefaultGameOptionsPage.h" #include "themes/ITheme.h" #include "themes/SystemTheme.h" @@ -486,11 +485,6 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) // The cat m_settings->registerSetting("TheCat", false); - - // Default options - m_settings->registerSetting("DefaultOptionsMode", "NoAutojump"); - m_settings->registerSetting("DefaultOptionsText", "autoJump:false"); - m_settings->registerSetting("InstSortMode", "Name"); m_settings->registerSetting("SelectedInstance", QString()); @@ -525,7 +519,6 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) m_globalSettingsProvider = std::make_shared(tr("Settings")); m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); diff --git a/application/pages/global/DefaultGameOptionsPage.cpp b/application/pages/global/DefaultGameOptionsPage.cpp deleted file mode 100644 index ce97907f..00000000 --- a/application/pages/global/DefaultGameOptionsPage.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "DefaultGameOptionsPage.h" -#include "ui_DefaultGameOptionsPage.h" -#include "minecraft/MinecraftInstance.h" -#include "minecraft/gameoptions/GameOptions.h" -#include -#include "MultiMC.h" -namespace { -enum Mode { - NoDefault = 0, - NoAutojump = 1, - Fulltext = 2 -}; -} - -DefaultGameOptionsPage::DefaultGameOptionsPage(QWidget* parent) : QWidget(parent), ui(new Ui::DefaultGameOptionsPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - ui->defaultOptionsMode->setId(ui->radioDisabled, NoDefault); - ui->defaultOptionsMode->setId(ui->radioNoAutojump, NoAutojump); - ui->defaultOptionsMode->setId(ui->radioFullText, Fulltext); - loadSettings(); - updateEnabledWidgets(); - connect(ui->defaultOptionsMode, SIGNAL(buttonClicked(int)), SLOT(radioChanged(int))); -} - -bool DefaultGameOptionsPage::apply() -{ - applySettings(); - return true; -} - -void DefaultGameOptionsPage::updateEnabledWidgets() -{ - auto id = ui->defaultOptionsMode->checkedId(); - switch(id) { - case NoDefault: - default: - case NoAutojump: { - ui->textEdit->setEnabled(false); - break; - } - case Fulltext: { - ui->textEdit->setEnabled(true); - break; - } - } -} - -void DefaultGameOptionsPage::radioChanged(int) -{ - updateEnabledWidgets(); -} - - -void DefaultGameOptionsPage::applySettings() -{ - auto s = MMC->settings(); - - auto id = ui->defaultOptionsMode->checkedId(); - switch(id) { - case NoDefault: { - s->set("DefaultOptionsMode", "NoDefault"); - break; - } - default: - case NoAutojump: { - s->set("DefaultOptionsMode", "NoAutojump"); - break; - } - case Fulltext: { - s->set("DefaultOptionsMode", "Fulltext"); - break; - } - } - - s->set("DefaultOptionsText", ui->textEdit->toPlainText()); -} - -void DefaultGameOptionsPage::loadSettings() -{ - auto s = MMC->settings(); - auto modeStr = s->get("DefaultOptionsMode").toString(); - if(modeStr == "NoDefault") { - ui->radioDisabled->setChecked(true); - } else if(modeStr == "Fulltext") { - ui->radioFullText->setChecked(true); - } else { - ui->radioNoAutojump->setChecked(true); - } - ui->textEdit->setText(s->get("DefaultOptionsText").toString()); -} - - -DefaultGameOptionsPage::~DefaultGameOptionsPage() -{ - delete ui; -} - -void DefaultGameOptionsPage::openedImpl() -{ -} - -void DefaultGameOptionsPage::closedImpl() -{ -} - -#include "DefaultGameOptionsPage.moc" - - diff --git a/application/pages/global/DefaultGameOptionsPage.h b/application/pages/global/DefaultGameOptionsPage.h deleted file mode 100644 index d6142c34..00000000 --- a/application/pages/global/DefaultGameOptionsPage.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2013-2019 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 - -namespace Ui -{ -class DefaultGameOptionsPage; -} - -class GameOptions; -class MinecraftInstance; - -class DefaultGameOptionsPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit DefaultGameOptionsPage(QWidget *parent = 0); - virtual ~DefaultGameOptionsPage(); - - void openedImpl() override; - void closedImpl() override; - - virtual QString displayName() const override - { - return tr("Game Options"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("settings"); - } - virtual QString id() const override - { - return "defaultgameoptions"; - } - virtual QString helpPage() const override - { - return "Default-Game-Options"; - } - - bool apply() override; - -private: - void applySettings(); - void loadSettings(); - void updateEnabledWidgets(); - -private slots: - void radioChanged(int); - -private: // data - Ui::DefaultGameOptionsPage *ui = nullptr; -}; - diff --git a/application/pages/global/DefaultGameOptionsPage.ui b/application/pages/global/DefaultGameOptionsPage.ui deleted file mode 100644 index 2ccde7ce..00000000 --- a/application/pages/global/DefaultGameOptionsPage.ui +++ /dev/null @@ -1,96 +0,0 @@ - - - DefaultGameOptionsPage - - - - 0 - 0 - 706 - 575 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - 0 - 0 - - - - Tab 1 - - - - - - No Default - - - true - - - defaultOptionsMode - - - - - - - No Autojump - - - defaultOptionsMode - - - - - - - Full Text - - - defaultOptionsMode - - - - - - - - - - - - - - tabWidget - radioDisabled - radioNoAutojump - radioFullText - textEdit - - - - - - -