From af5120c828831dfe41482ebaff79608ba8531ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 18 Nov 2019 00:38:36 +0100 Subject: GH-2859 remove twitch page and modpack import from URL The functionality was broken, beyond repair and an ongoing maintenance nightmare. --- application/CMakeLists.txt | 3 -- application/dialogs/NewInstanceDialog.cpp | 13 +---- application/dialogs/NewInstanceDialog.h | 2 - application/main.cpp | 1 - application/pages/modplatform/TwitchPage.cpp | 65 ----------------------- application/pages/modplatform/TwitchPage.h | 69 ------------------------ application/pages/modplatform/TwitchPage.ui | 79 ---------------------------- application/resources/assets/assets.qrc | 6 --- application/resources/assets/deadglitch.svg | 66 ----------------------- 9 files changed, 2 insertions(+), 302 deletions(-) delete mode 100644 application/pages/modplatform/TwitchPage.cpp delete mode 100644 application/pages/modplatform/TwitchPage.h delete mode 100644 application/pages/modplatform/TwitchPage.ui delete mode 100644 application/resources/assets/assets.qrc delete mode 100644 application/resources/assets/deadglitch.svg (limited to 'application') diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 0583c451..a0e01ac8 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -133,8 +133,6 @@ SET(MULTIMC_SOURCES pages/modplatform/legacy_ftb/Page.h pages/modplatform/legacy_ftb/ListModel.h pages/modplatform/legacy_ftb/ListModel.cpp - pages/modplatform/TwitchPage.cpp - pages/modplatform/TwitchPage.h pages/modplatform/ImportPage.cpp pages/modplatform/ImportPage.h @@ -277,7 +275,6 @@ SET(MULTIMC_UIS ) set(MULTIMC_QRCS - resources/assets/assets.qrc resources/backgrounds/backgrounds.qrc resources/multimc/multimc.qrc resources/pe_dark/pe_dark.qrc diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp index c5936953..804340bc 100644 --- a/application/dialogs/NewInstanceDialog.cpp +++ b/application/dialogs/NewInstanceDialog.cpp @@ -35,7 +35,6 @@ #include "widgets/PageContainer.h" #include #include -#include #include @@ -95,14 +94,8 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString if(!url.isEmpty()) { QUrl actualUrl(url); - if(actualUrl.host() == "www.curseforge.com") { - m_container->selectPage("twitch"); - twitchPage->setUrl(url); - } - else { - m_container->selectPage("import"); - importPage->setUrl(url); - } + m_container->selectPage("import"); + importPage->setUrl(url); } updateDialogState(); @@ -126,13 +119,11 @@ void NewInstanceDialog::accept() QList NewInstanceDialog::getPages() { importPage = new ImportPage(this); - twitchPage = new TwitchPage(this); return { new VanillaPage(this), importPage, new LegacyFTB::Page(this), - twitchPage }; } diff --git a/application/dialogs/NewInstanceDialog.h b/application/dialogs/NewInstanceDialog.h index 0b8b2fb8..c86ab73f 100644 --- a/application/dialogs/NewInstanceDialog.h +++ b/application/dialogs/NewInstanceDialog.h @@ -29,7 +29,6 @@ class NewInstanceDialog; class PageContainer; class QDialogButtonBox; class ImportPage; -class TwitchPage; class NewInstanceDialog : public QDialog, public BasePageProvider { @@ -68,7 +67,6 @@ private: QString InstIconKey; ImportPage *importPage = nullptr; - TwitchPage *twitchPage = nullptr; std::unique_ptr creationTask; bool importIcon = false; diff --git a/application/main.cpp b/application/main.cpp index c871bf1b..b0360c7e 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -43,7 +43,6 @@ int main(int argc, char *argv[]) { Q_INIT_RESOURCE(multimc); Q_INIT_RESOURCE(backgrounds); - Q_INIT_RESOURCE(assets); Q_INIT_RESOURCE(pe_dark); Q_INIT_RESOURCE(pe_light); diff --git a/application/pages/modplatform/TwitchPage.cpp b/application/pages/modplatform/TwitchPage.cpp deleted file mode 100644 index 389e3194..00000000 --- a/application/pages/modplatform/TwitchPage.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "TwitchPage.h" -#include "ui_TwitchPage.h" - -#include "MultiMC.h" -#include "dialogs/NewInstanceDialog.h" -#include - -TwitchPage::TwitchPage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), ui(new Ui::TwitchPage), dialog(dialog) -{ - ui->setupUi(this); - connect(ui->checkButton, &QPushButton::clicked, this, &TwitchPage::triggerCheck); - connect(ui->twitchLabel, &DropLabel::droppedURLs, [this](QList urls){ - if(urls.size()) { - setUrl(urls[0].toString()); - } - }); -} - -TwitchPage::~TwitchPage() -{ - delete ui; -} - -bool TwitchPage::shouldDisplay() const -{ - return true; -} - -void TwitchPage::openedImpl() -{ - dialog->setSuggestedPack(); -} - -void TwitchPage::triggerCheck(bool) -{ - if(m_modIdResolver) { - return; - } - auto task = new Flame::UrlResolvingTask(ui->lineEdit->text()); - connect(task, &Task::finished, this, &TwitchPage::checkDone); - m_modIdResolver.reset(task); - task->start(); -} - -void TwitchPage::setUrl(const QString& url) -{ - ui->lineEdit->setText(url); - triggerCheck(true); -} - -void TwitchPage::checkDone() -{ - auto result = m_modIdResolver->getResults(); - auto formatted = QString("Project %1, File %2").arg(result.projectId).arg(result.fileId); - if(result.resolved && result.type == Flame::File::Type::Modpack) { - ui->twitchLabel->setText(formatted); - QFileInfo fi(result.fileName); - dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(result.url)); - } else { - ui->twitchLabel->setPixmap(QPixmap(QString::fromUtf8(":/assets/deadglitch"))); - dialog->setSuggestedPack(); - } - m_modIdResolver.reset(); -} diff --git a/application/pages/modplatform/TwitchPage.h b/application/pages/modplatform/TwitchPage.h deleted file mode 100644 index 600913cd..00000000 --- a/application/pages/modplatform/TwitchPage.h +++ /dev/null @@ -1,69 +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 "pages/BasePage.h" -#include -#include "tasks/Task.h" -#include "modplatform/flame/UrlResolvingTask.h" - -namespace Ui -{ -class TwitchPage; -} - -class NewInstanceDialog; - -class TwitchPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit TwitchPage(NewInstanceDialog* dialog, QWidget *parent = 0); - virtual ~TwitchPage(); - virtual QString displayName() const override - { - return tr("Twitch URL"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("twitch"); - } - virtual QString id() const override - { - return "twitch"; - } - virtual QString helpPage() const override - { - return "Twitch-platform"; - } - virtual bool shouldDisplay() const override; - - void openedImpl() override; - - void setUrl(const QString & url); - -private slots: - void triggerCheck(bool checked); - void checkDone(); - -private: - Ui::TwitchPage *ui = nullptr; - NewInstanceDialog* dialog = nullptr; - shared_qobject_ptr m_modIdResolver; -}; diff --git a/application/pages/modplatform/TwitchPage.ui b/application/pages/modplatform/TwitchPage.ui deleted file mode 100644 index 43a775a0..00000000 --- a/application/pages/modplatform/TwitchPage.ui +++ /dev/null @@ -1,79 +0,0 @@ - - - TwitchPage - - - - 0 - 0 - 666 - 424 - - - - - - - - 0 - 0 - - - - - 40 - - - - :/assets/deadglitch - - - Qt::AlignCenter - - - - - - - Check - - - - - - - Twitch URL: - - - - - - - - - - Drag and drop an Install button from CurseForge into the area above. - - - Qt::AlignCenter - - - - - - - - DropLabel - QLabel -
widgets/DropLabel.h
-
-
- - lineEdit - checkButton - - - - - -
diff --git a/application/resources/assets/assets.qrc b/application/resources/assets/assets.qrc deleted file mode 100644 index 7a916f05..00000000 --- a/application/resources/assets/assets.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - - deadglitch.svg - - diff --git a/application/resources/assets/deadglitch.svg b/application/resources/assets/deadglitch.svg deleted file mode 100644 index 5682b8a3..00000000 --- a/application/resources/assets/deadglitch.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - -- cgit v1.2.3