diff options
author | kb1000 <kaeptmblaubaer1000@gmail.com> | 2021-03-24 00:59:43 +0100 |
---|---|---|
committer | kb1000 <kaeptmblaubaer1000@gmail.com> | 2021-03-24 00:59:43 +0100 |
commit | a0cb1a0d427087c84690224b37c2c9d0fba4f6cb (patch) | |
tree | 0bba964c2e4f5bcc3f27cecce57c4ebbaf78ebcb /application/pages/modplatform | |
parent | cbc973a5afb1a2ba321ea851f89e7189ce322460 (diff) | |
download | PrismLauncher-a0cb1a0d427087c84690224b37c2c9d0fba4f6cb.tar.gz PrismLauncher-a0cb1a0d427087c84690224b37c2c9d0fba4f6cb.tar.bz2 PrismLauncher-a0cb1a0d427087c84690224b37c2c9d0fba4f6cb.zip |
NOISSUE rename Twitch to flame internally for consistency and to CurseForge for user displayed strings
Diffstat (limited to 'application/pages/modplatform')
-rw-r--r-- | application/pages/modplatform/flame/FlameData.h (renamed from application/pages/modplatform/twitch/TwitchData.h) | 4 | ||||
-rw-r--r-- | application/pages/modplatform/flame/FlameModel.cpp (renamed from application/pages/modplatform/twitch/TwitchModel.cpp) | 18 | ||||
-rw-r--r-- | application/pages/modplatform/flame/FlameModel.h (renamed from application/pages/modplatform/twitch/TwitchModel.h) | 5 | ||||
-rw-r--r-- | application/pages/modplatform/flame/FlamePage.cpp (renamed from application/pages/modplatform/twitch/TwitchPage.cpp) | 36 | ||||
-rw-r--r-- | application/pages/modplatform/flame/FlamePage.h (renamed from application/pages/modplatform/twitch/TwitchPage.h) | 26 | ||||
-rw-r--r-- | application/pages/modplatform/flame/FlamePage.ui (renamed from application/pages/modplatform/twitch/TwitchPage.ui) | 70 |
6 files changed, 88 insertions, 71 deletions
diff --git a/application/pages/modplatform/twitch/TwitchData.h b/application/pages/modplatform/flame/FlameData.h index dd000b84..9245ba8a 100644 --- a/application/pages/modplatform/twitch/TwitchData.h +++ b/application/pages/modplatform/flame/FlameData.h @@ -3,7 +3,7 @@ #include <QString> #include <QList> -namespace Twitch { +namespace Flame { struct ModpackAuthor { QString name; @@ -35,4 +35,4 @@ struct Modpack }; } -Q_DECLARE_METATYPE(Twitch::Modpack) +Q_DECLARE_METATYPE(Flame::Modpack) diff --git a/application/pages/modplatform/twitch/TwitchModel.cpp b/application/pages/modplatform/flame/FlameModel.cpp index 5c6c7858..cd3109e0 100644 --- a/application/pages/modplatform/twitch/TwitchModel.cpp +++ b/application/pages/modplatform/flame/FlameModel.cpp @@ -1,4 +1,4 @@ -#include "TwitchModel.h" +#include "FlameModel.h" #include "MultiMC.h" #include <MMCStrings.h> @@ -10,7 +10,7 @@ #include <RWStorage.h> #include <Env.h> -namespace Twitch { +namespace Flame { ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) { @@ -99,8 +99,8 @@ void ListModel::requestLogo(QString logo, QString url) return; } - MetaEntryPtr entry = ENV.metacache()->resolveEntry("TwitchPacks", QString("logos/%1").arg(logo.section(".", 0, 0))); - NetJob *job = new NetJob(QString("Twitch Icon Download %1").arg(logo)); + MetaEntryPtr entry = ENV.metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0))); + NetJob *job = new NetJob(QString("Flame Icon Download %1").arg(logo)); job->addNetAction(Net::Download::makeCached(QUrl(url), entry)); auto fullPath = entry->getFullPath(); @@ -127,7 +127,7 @@ void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallbac { if(m_logoMap.contains(logo)) { - callback(ENV.metacache()->resolveEntry("TwitchPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath()); + callback(ENV.metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath()); } else { @@ -158,7 +158,7 @@ void ListModel::fetchMore(const QModelIndex& parent) void ListModel::performPaginatedSearch() { - NetJob *netJob = new NetJob("Twitch::Search"); + NetJob *netJob = new NetJob("Flame::Search"); auto searchUrl = QString( "https://addons-ecs.forgesvc.net/api/v2/addon/search?" "categoryId=0&" @@ -198,14 +198,14 @@ void ListModel::searchWithTerm(const QString& term) performPaginatedSearch(); } -void Twitch::ListModel::searchRequestFinished() +void Flame::ListModel::searchRequestFinished() { jobPtr.reset(); QJsonParseError parse_error; QJsonDocument doc = QJsonDocument::fromJson(response, &parse_error); if(parse_error.error != QJsonParseError::NoError) { - qWarning() << "Error while parsing JSON response from Twitch at " << parse_error.offset << " reason: " << parse_error.errorString(); + qWarning() << "Error while parsing JSON response from CurseForge at " << parse_error.offset << " reason: " << parse_error.errorString(); qWarning() << response; return; } @@ -292,7 +292,7 @@ void Twitch::ListModel::searchRequestFinished() endInsertRows(); } -void Twitch::ListModel::searchRequestFailed(QString reason) +void Flame::ListModel::searchRequestFailed(QString reason) { jobPtr.reset(); diff --git a/application/pages/modplatform/twitch/TwitchModel.h b/application/pages/modplatform/flame/FlameModel.h index ad355c64..b4dded76 100644 --- a/application/pages/modplatform/twitch/TwitchModel.h +++ b/application/pages/modplatform/flame/FlameModel.h @@ -1,6 +1,5 @@ #pragma once -#include <modplatform/legacy_ftb/PackHelpers.h> #include <RWStorage.h> #include <QAbstractListModel> @@ -16,9 +15,9 @@ #include <functional> #include <net/NetJob.h> -#include "TwitchData.h" +#include "FlameData.h" -namespace Twitch { +namespace Flame { typedef QMap<QString, QIcon> LogoMap; diff --git a/application/pages/modplatform/twitch/TwitchPage.cpp b/application/pages/modplatform/flame/FlamePage.cpp index 1e9f9dbb..3889f15a 100644 --- a/application/pages/modplatform/twitch/TwitchPage.cpp +++ b/application/pages/modplatform/flame/FlamePage.cpp @@ -1,29 +1,29 @@ -#include "TwitchPage.h" -#include "ui_TwitchPage.h" +#include "FlamePage.h" +#include "ui_FlamePage.h" #include "MultiMC.h" #include "dialogs/NewInstanceDialog.h" #include <InstanceImportTask.h> -#include "TwitchModel.h" +#include "FlameModel.h" #include <QKeyEvent> -TwitchPage::TwitchPage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), ui(new Ui::TwitchPage), dialog(dialog) +FlamePage::FlamePage(NewInstanceDialog* dialog, QWidget *parent) + : QWidget(parent), ui(new Ui::FlamePage), dialog(dialog) { ui->setupUi(this); - connect(ui->searchButton, &QPushButton::clicked, this, &TwitchPage::triggerSearch); + connect(ui->searchButton, &QPushButton::clicked, this, &FlamePage::triggerSearch); ui->searchEdit->installEventFilter(this); - model = new Twitch::ListModel(this); + model = new Flame::ListModel(this); ui->packView->setModel(model); - connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &TwitchPage::onSelectionChanged); + connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FlamePage::onSelectionChanged); } -TwitchPage::~TwitchPage() +FlamePage::~FlamePage() { delete ui; } -bool TwitchPage::eventFilter(QObject* watched, QEvent* event) +bool FlamePage::eventFilter(QObject* watched, QEvent* event) { if (watched == ui->searchEdit && event->type() == QEvent::KeyPress) { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); @@ -36,22 +36,22 @@ bool TwitchPage::eventFilter(QObject* watched, QEvent* event) return QWidget::eventFilter(watched, event); } -bool TwitchPage::shouldDisplay() const +bool FlamePage::shouldDisplay() const { return true; } -void TwitchPage::openedImpl() +void FlamePage::openedImpl() { suggestCurrent(); } -void TwitchPage::triggerSearch() +void FlamePage::triggerSearch() { model->searchWithTerm(ui->searchEdit->text()); } -void TwitchPage::onSelectionChanged(QModelIndex first, QModelIndex second) +void FlamePage::onSelectionChanged(QModelIndex first, QModelIndex second) { if(!first.isValid()) { @@ -63,7 +63,7 @@ void TwitchPage::onSelectionChanged(QModelIndex first, QModelIndex second) return; } - current = model->data(first, Qt::UserRole).value<Twitch::Modpack>(); + current = model->data(first, Qt::UserRole).value<Flame::Modpack>(); QString text = ""; QString name = current.name; @@ -72,7 +72,7 @@ void TwitchPage::onSelectionChanged(QModelIndex first, QModelIndex second) else text = "<a href=\"" + current.websiteUrl + "\">" + name + "</a>"; if (!current.authors.empty()) { - auto authorToStr = [](Twitch::ModpackAuthor & author) { + auto authorToStr = [](Flame::ModpackAuthor & author) { if(author.url.isEmpty()) { return author.name; } @@ -90,7 +90,7 @@ void TwitchPage::onSelectionChanged(QModelIndex first, QModelIndex second) suggestCurrent(); } -void TwitchPage::suggestCurrent() +void FlamePage::suggestCurrent() { if(!isOpened) { @@ -103,7 +103,7 @@ void TwitchPage::suggestCurrent() dialog->setSuggestedPack(current.name, new InstanceImportTask(current.latestFile.downloadUrl)); QString editedLogoName; - editedLogoName = "twitch_" + current.logoName.section(".", 0, 0); + editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0); model->getLogo(current.logoName, current.logoUrl, [this, editedLogoName](QString logo) { dialog->setSuggestedIconFromFile(logo, editedLogoName); diff --git a/application/pages/modplatform/twitch/TwitchPage.h b/application/pages/modplatform/flame/FlamePage.h index 093900ff..e50186f5 100644 --- a/application/pages/modplatform/twitch/TwitchPage.h +++ b/application/pages/modplatform/flame/FlamePage.h @@ -20,41 +20,41 @@ #include "pages/BasePage.h" #include <MultiMC.h> #include "tasks/Task.h" -#include "TwitchData.h" +#include "FlameData.h" namespace Ui { -class TwitchPage; +class FlamePage; } class NewInstanceDialog; -namespace Twitch { +namespace Flame { class ListModel; } -class TwitchPage : public QWidget, public BasePage +class FlamePage : public QWidget, public BasePage { Q_OBJECT public: - explicit TwitchPage(NewInstanceDialog* dialog, QWidget *parent = 0); - virtual ~TwitchPage(); + explicit FlamePage(NewInstanceDialog* dialog, QWidget *parent = 0); + virtual ~FlamePage(); virtual QString displayName() const override { - return tr("Twitch"); + return tr("CurseForge"); } virtual QIcon icon() const override { - return MMC->getThemedIcon("twitch"); + return MMC->getThemedIcon("flame"); } virtual QString id() const override { - return "twitch"; + return "flame"; } virtual QString helpPage() const override { - return "Twitch-platform"; + return "Flame-platform"; } virtual bool shouldDisplay() const override; @@ -70,8 +70,8 @@ private slots: void onSelectionChanged(QModelIndex first, QModelIndex second); private: - Ui::TwitchPage *ui = nullptr; + Ui::FlamePage *ui = nullptr; NewInstanceDialog* dialog = nullptr; - Twitch::ListModel* model = nullptr; - Twitch::Modpack current; + Flame::ListModel* model = nullptr; + Flame::Modpack current; }; diff --git a/application/pages/modplatform/twitch/TwitchPage.ui b/application/pages/modplatform/flame/FlamePage.ui index c78d8ce0..21e23f1f 100644 --- a/application/pages/modplatform/twitch/TwitchPage.ui +++ b/application/pages/modplatform/flame/FlamePage.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>TwitchPage</class> - <widget class="QWidget" name="TwitchPage"> + <class>FlamePage</class> + <widget class="QWidget" name="FlamePage"> <property name="geometry"> <rect> <x>0</x> @@ -10,18 +10,52 @@ <height>745</height> </rect> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLineEdit" name="searchEdit"/> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QWidget" name="widget" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLineEdit" name="searchEdit"/> + </item> + <item> + <widget class="QPushButton" name="searchButton"> + <property name="text"> + <string>Search</string> + </property> + </widget> + </item> + </layout> + </widget> </item> - <item row="0" column="1"> - <widget class="QPushButton" name="searchButton"> - <property name="text"> - <string>Search</string> + <item> + <widget class="QListView" name="packView"> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="iconSize"> + <size> + <width>48</width> + <height>48</height> + </size> </property> </widget> </item> - <item row="2" column="0" colspan="2"> + <item> <widget class="MCModInfoFrame" name="frame"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> @@ -37,22 +71,6 @@ </property> </widget> </item> - <item row="1" column="0" colspan="2"> - <widget class="QListView" name="packView"> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="alternatingRowColors"> - <bool>true</bool> - </property> - <property name="iconSize"> - <size> - <width>48</width> - <height>48</height> - </size> - </property> - </widget> - </item> </layout> </widget> <customwidgets> |