From a62155c1c9e561327cc589fe3da7b6d5a107d58d Mon Sep 17 00:00:00 2001 From: swirl Date: Fri, 14 Jan 2022 18:20:06 -0500 Subject: preliminary stuff for paste.ee removal --- launcher/Application.cpp | 4 +- launcher/CMakeLists.txt | 6 +- launcher/ui/pages/global/PasteEEPage.cpp | 81 ------------------- launcher/ui/pages/global/PasteEEPage.h | 62 --------------- launcher/ui/pages/global/PasteEEPage.ui | 128 ------------------------------- launcher/ui/pages/global/PastePage.cpp | 81 +++++++++++++++++++ launcher/ui/pages/global/PastePage.h | 63 +++++++++++++++ launcher/ui/pages/global/PastePage.ui | 109 ++++++++++++++++++++++++++ 8 files changed, 258 insertions(+), 276 deletions(-) delete mode 100644 launcher/ui/pages/global/PasteEEPage.cpp delete mode 100644 launcher/ui/pages/global/PasteEEPage.h delete mode 100644 launcher/ui/pages/global/PasteEEPage.ui create mode 100644 launcher/ui/pages/global/PastePage.cpp create mode 100644 launcher/ui/pages/global/PastePage.h create mode 100644 launcher/ui/pages/global/PastePage.ui (limited to 'launcher') diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 47c9c20e..98e3e0fc 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -14,7 +14,7 @@ #include "ui/pages/global/ProxyPage.h" #include "ui/pages/global/ExternalToolsPage.h" #include "ui/pages/global/AccountListPage.h" -#include "ui/pages/global/PasteEEPage.h" +#include "ui/pages/global/PastePage.h" #include "ui/pages/global/CustomCommandsPage.h" #include "ui/themes/ITheme.h" @@ -728,7 +728,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); + m_globalSettingsProvider->addPage(); } qDebug() << "<> Settings loaded."; } diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index df361447..21859cad 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -711,8 +711,8 @@ SET(LAUNCHER_SOURCES ui/pages/global/LauncherPage.h ui/pages/global/ProxyPage.cpp ui/pages/global/ProxyPage.h - ui/pages/global/PasteEEPage.cpp - ui/pages/global/PasteEEPage.h + ui/pages/global/PastePage.cpp + ui/pages/global/PastePage.h # GUI - platform pages ui/pages/modplatform/VanillaPage.cpp @@ -848,7 +848,7 @@ qt5_wrap_ui(LAUNCHER_UI ui/pages/global/AccountListPage.ui ui/pages/global/JavaPage.ui ui/pages/global/LauncherPage.ui - ui/pages/global/PasteEEPage.ui + ui/pages/global/PastePage.ui ui/pages/global/ProxyPage.ui ui/pages/global/MinecraftPage.ui ui/pages/global/ExternalToolsPage.ui diff --git a/launcher/ui/pages/global/PasteEEPage.cpp b/launcher/ui/pages/global/PasteEEPage.cpp deleted file mode 100644 index 4b375d9a..00000000 --- a/launcher/ui/pages/global/PasteEEPage.cpp +++ /dev/null @@ -1,81 +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 "PasteEEPage.h" -#include "ui_PasteEEPage.h" - -#include -#include -#include -#include - -#include "settings/SettingsObject.h" -#include "tools/BaseProfiler.h" -#include "Application.h" - -PasteEEPage::PasteEEPage(QWidget *parent) : - QWidget(parent), - ui(new Ui::PasteEEPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide();\ - connect(ui->customAPIkeyEdit, &QLineEdit::textEdited, this, &PasteEEPage::textEdited); - loadSettings(); -} - -PasteEEPage::~PasteEEPage() -{ - delete ui; -} - -void PasteEEPage::loadSettings() -{ - auto s = APPLICATION->settings(); - QString keyToUse = s->get("PasteEEAPIKey").toString(); - if(keyToUse == "multimc") - { - ui->multimcButton->setChecked(true); - } - else - { - ui->customButton->setChecked(true); - ui->customAPIkeyEdit->setText(keyToUse); - } -} - -void PasteEEPage::applySettings() -{ - auto s = APPLICATION->settings(); - - QString pasteKeyToUse; - if (ui->customButton->isChecked()) - pasteKeyToUse = ui->customAPIkeyEdit->text(); - else - { - pasteKeyToUse = "multimc"; - } - s->set("PasteEEAPIKey", pasteKeyToUse); -} - -bool PasteEEPage::apply() -{ - applySettings(); - return true; -} - -void PasteEEPage::textEdited(const QString& text) -{ - ui->customButton->setChecked(true); -} diff --git a/launcher/ui/pages/global/PasteEEPage.h b/launcher/ui/pages/global/PasteEEPage.h deleted file mode 100644 index a1c7d434..00000000 --- a/launcher/ui/pages/global/PasteEEPage.h +++ /dev/null @@ -1,62 +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 "ui/pages/BasePage.h" -#include - -namespace Ui { -class PasteEEPage; -} - -class PasteEEPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit PasteEEPage(QWidget *parent = 0); - ~PasteEEPage(); - - QString displayName() const override - { - return tr("Log Upload"); - } - QIcon icon() const override - { - return APPLICATION->getThemedIcon("log"); - } - QString id() const override - { - return "log-upload"; - } - QString helpPage() const override - { - return "Log-Upload"; - } - virtual bool apply() override; - -private: - void loadSettings(); - void applySettings(); - -private slots: - void textEdited(const QString &text); - -private: - Ui::PasteEEPage *ui; -}; diff --git a/launcher/ui/pages/global/PasteEEPage.ui b/launcher/ui/pages/global/PasteEEPage.ui deleted file mode 100644 index 10883781..00000000 --- a/launcher/ui/pages/global/PasteEEPage.ui +++ /dev/null @@ -1,128 +0,0 @@ - - - PasteEEPage - - - - 0 - 0 - 491 - 474 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - Tab 1 - - - - - - paste.ee API key - - - - - - MultiMC key - 12MB &upload limit - - - pasteButtonGroup - - - - - - - &Your own key - 12MB upload limit: - - - pasteButtonGroup - - - - - - - QLineEdit::Password - - - Paste your API key here! - - - - - - - Qt::Horizontal - - - - - - - <html><head/><body><p><a href="https://paste.ee">paste.ee</a> is used by MultiMC for log uploads. If you have a <a href="https://paste.ee">paste.ee</a> account, you can add your API key here and have your uploaded logs paired with your account.</p></body></html> - - - Qt::RichText - - - true - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 216 - - - - - - - - - - - - tabWidget - multimcButton - customButton - customAPIkeyEdit - - - - - - - diff --git a/launcher/ui/pages/global/PastePage.cpp b/launcher/ui/pages/global/PastePage.cpp new file mode 100644 index 00000000..3378a6ef --- /dev/null +++ b/launcher/ui/pages/global/PastePage.cpp @@ -0,0 +1,81 @@ +/* Copyright 2013-2021 MultiMC & PolyMC 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 "PastePage.h" +#include "ui_PastePage.h" + +#include +#include +#include +#include + +#include "settings/SettingsObject.h" +#include "tools/BaseProfiler.h" +#include "Application.h" + +PastePage::PastePage(QWidget *parent) : + QWidget(parent), + ui(new Ui::PastePage) +{ + ui->setupUi(this); + ui->tabWidget->tabBar()->hide();\ + connect(ui->customAPIkeyEdit, &QLineEdit::textEdited, this, &PastePage::textEdited); + loadSettings(); +} + +PastePage::~PastePage() +{ + delete ui; +} + +void PastePage::loadSettings() +{ + auto s = APPLICATION->settings(); + QString keyToUse = s->get("PasteEEAPIKey").toString(); + if(keyToUse == "multimc") + { + ui->multimcButton->setChecked(true); + } + else + { + ui->customButton->setChecked(true); + ui->customAPIkeyEdit->setText(keyToUse); + } +} + +void PastePage::applySettings() +{ + auto s = APPLICATION->settings(); + + QString pasteKeyToUse; + if (ui->customButton->isChecked()) + pasteKeyToUse = ui->customAPIkeyEdit->text(); + else + { + pasteKeyToUse = "multimc"; + } + s->set("PasteEEAPIKey", pasteKeyToUse); +} + +bool PastePage::apply() +{ + applySettings(); + return true; +} + +void PastePage::textEdited(const QString& text) +{ + ui->customButton->setChecked(true); +} diff --git a/launcher/ui/pages/global/PastePage.h b/launcher/ui/pages/global/PastePage.h new file mode 100644 index 00000000..3930d4ec --- /dev/null +++ b/launcher/ui/pages/global/PastePage.h @@ -0,0 +1,63 @@ +/* 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 "ui/pages/BasePage.h" +#include + +namespace Ui { +class PastePage; +} + +class PastePage : public QWidget, public BasePage +{ + Q_OBJECT + +public: + explicit PastePage(QWidget *parent = 0); + ~PastePage(); + + QString displayName() const override + { + return tr("Log Upload"); + } + QIcon icon() const override + { + return APPLICATION->getThemedIcon("log"); + } + QString id() const override + { + return "log-upload"; + } + QString helpPage() const override + { + return "Log-Upload"; + } + virtual bool apply() override; + +private: + void loadSettings(); + void applySettings(); + +private slots: + void textEdited(const QString &text); + +private: + Ui::PastePage *ui; +}; + diff --git a/launcher/ui/pages/global/PastePage.ui b/launcher/ui/pages/global/PastePage.ui new file mode 100644 index 00000000..0bef5a22 --- /dev/null +++ b/launcher/ui/pages/global/PastePage.ui @@ -0,0 +1,109 @@ + + + PastePage + + + + 0 + 0 + 491 + 474 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + Pastebin Site + + + + + + Qt::Horizontal + + + + + + + + 0x0.st + + + + + paste.polymc.org + + + + + + + + <html><head/><body><p>paste.polymc.org is a pastebin managed by PolyMC's lead maintainer. Something something trust</p></body></html> + + + Qt::RichText + + + true + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 216 + + + + + + + + + + + + tabWidget + + + + + + + -- cgit