diff options
author | Petr Mrázek <peterix@gmail.com> | 2019-11-18 00:38:36 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2019-11-18 00:38:36 +0100 |
commit | af5120c828831dfe41482ebaff79608ba8531ede (patch) | |
tree | 2e308ff3f356f8af94ce9bf7635a2884471ae5db /application/pages/modplatform | |
parent | 47ed2f48d4a118876263f37b9fe2ab8911c2a8fe (diff) | |
download | MultiMC-af5120c828831dfe41482ebaff79608ba8531ede.tar MultiMC-af5120c828831dfe41482ebaff79608ba8531ede.tar.gz MultiMC-af5120c828831dfe41482ebaff79608ba8531ede.tar.lz MultiMC-af5120c828831dfe41482ebaff79608ba8531ede.tar.xz MultiMC-af5120c828831dfe41482ebaff79608ba8531ede.zip |
GH-2859 remove twitch page and modpack import from URL
The functionality was broken, beyond repair and an ongoing maintenance
nightmare.
Diffstat (limited to 'application/pages/modplatform')
-rw-r--r-- | application/pages/modplatform/TwitchPage.cpp | 65 | ||||
-rw-r--r-- | application/pages/modplatform/TwitchPage.h | 69 | ||||
-rw-r--r-- | application/pages/modplatform/TwitchPage.ui | 79 |
3 files changed, 0 insertions, 213 deletions
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 <InstanceImportTask.h> - -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<QUrl> 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 <QWidget> - -#include "pages/BasePage.h" -#include <MultiMC.h> -#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<Flame::UrlResolvingTask> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>TwitchPage</class> - <widget class="QWidget" name="TwitchPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>666</width> - <height>424</height> - </rect> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="0" colspan="3"> - <widget class="DropLabel" name="twitchLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <pointsize>40</pointsize> - </font> - </property> - <property name="pixmap"> - <pixmap resource="../../resources/assets/assets.qrc">:/assets/deadglitch</pixmap> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QPushButton" name="checkButton"> - <property name="text"> - <string>Check</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Twitch URL:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="lineEdit"/> - </item> - <item row="2" column="0" colspan="3"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Drag and drop an Install button from CurseForge into the area above.</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>DropLabel</class> - <extends>QLabel</extends> - <header>widgets/DropLabel.h</header> - </customwidget> - </customwidgets> - <tabstops> - <tabstop>lineEdit</tabstop> - <tabstop>checkButton</tabstop> - </tabstops> - <resources> - <include location="../../resources/assets/assets.qrc"/> - </resources> - <connections/> -</ui> |