From a0cb1a0d427087c84690224b37c2c9d0fba4f6cb Mon Sep 17 00:00:00 2001 From: kb1000 Date: Wed, 24 Mar 2021 00:59:43 +0100 Subject: [PATCH] NOISSUE rename Twitch to flame internally for consistency and to CurseForge for user displayed strings --- api/logic/Env.cpp | 2 +- application/CMakeLists.txt | 12 +-- application/dialogs/NewInstanceDialog.cpp | 8 +- application/dialogs/NewInstanceDialog.h | 4 +- .../TwitchData.h => flame/FlameData.h} | 4 +- .../TwitchModel.cpp => flame/FlameModel.cpp} | 18 ++--- .../TwitchModel.h => flame/FlameModel.h} | 5 +- .../TwitchPage.cpp => flame/FlamePage.cpp} | 36 ++++----- .../TwitchPage.h => flame/FlamePage.h} | 26 +++---- .../TwitchPage.ui => flame/FlamePage.ui} | 74 ++++++++++++------- application/resources/multimc/multimc.qrc | 5 +- .../resources/multimc/scalable/twitch.svg | 63 ---------------- 12 files changed, 106 insertions(+), 151 deletions(-) rename application/pages/modplatform/{twitch/TwitchData.h => flame/FlameData.h} (90%) rename application/pages/modplatform/{twitch/TwitchModel.cpp => flame/FlameModel.cpp} (92%) rename application/pages/modplatform/{twitch/TwitchModel.h => flame/FlameModel.h} (95%) rename application/pages/modplatform/{twitch/TwitchPage.cpp => flame/FlamePage.cpp} (69%) rename application/pages/modplatform/{twitch/TwitchPage.h => flame/FlamePage.h} (75%) rename application/pages/modplatform/{twitch/TwitchPage.ui => flame/FlamePage.ui} (62%) delete mode 100644 application/resources/multimc/scalable/twitch.svg diff --git a/api/logic/Env.cpp b/api/logic/Env.cpp index 42a1cff7..71b49d95 100644 --- a/api/logic/Env.cpp +++ b/api/logic/Env.cpp @@ -100,7 +100,7 @@ void Env::initHttpMetaCache() m_metacache->addBase("FTBPacks", QDir("cache/FTBPacks").absolutePath()); m_metacache->addBase("ModpacksCHPacks", QDir("cache/ModpacksCHPacks").absolutePath()); m_metacache->addBase("TechnicPacks", QDir("cache/TechnicPacks").absolutePath()); - m_metacache->addBase("TwitchPacks", QDir("cache/TwitchPacks").absolutePath()); + m_metacache->addBase("FlamePacks", QDir("cache/FlamePacks").absolutePath()); m_metacache->addBase("skins", QDir("accounts/skins").absolutePath()); m_metacache->addBase("root", QDir::currentPath()); m_metacache->addBase("translations", QDir("translations").absolutePath()); diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index a81327e3..afd13574 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -145,11 +145,11 @@ SET(MULTIMC_SOURCES pages/modplatform/legacy_ftb/ListModel.h pages/modplatform/legacy_ftb/ListModel.cpp - pages/modplatform/twitch/TwitchData.h - pages/modplatform/twitch/TwitchModel.cpp - pages/modplatform/twitch/TwitchModel.h - pages/modplatform/twitch/TwitchPage.cpp - pages/modplatform/twitch/TwitchPage.h + pages/modplatform/flame/FlameData.h + pages/modplatform/flame/FlameModel.cpp + pages/modplatform/flame/FlameModel.h + pages/modplatform/flame/FlamePage.cpp + pages/modplatform/flame/FlamePage.h pages/modplatform/technic/TechnicModel.cpp pages/modplatform/technic/TechnicModel.h @@ -276,7 +276,7 @@ SET(MULTIMC_UIS pages/modplatform/atlauncher/AtlPage.ui pages/modplatform/ftb/FtbPage.ui pages/modplatform/legacy_ftb/Page.ui - pages/modplatform/twitch/TwitchPage.ui + pages/modplatform/flame/FlamePage.ui pages/modplatform/technic/TechnicPage.ui pages/modplatform/ImportPage.ui diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp index d70cbffe..112e46ff 100644 --- a/application/dialogs/NewInstanceDialog.cpp +++ b/application/dialogs/NewInstanceDialog.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include @@ -124,17 +124,17 @@ void NewInstanceDialog::accept() QList NewInstanceDialog::getPages() { importPage = new ImportPage(this); - twitchPage = new TwitchPage(this); + flamePage = new FlamePage(this); auto technicPage = new TechnicPage(this); return { new VanillaPage(this), importPage, new AtlPage(this), + flamePage, new FtbPage(this), new LegacyFTB::Page(this), - technicPage, - twitchPage + technicPage }; } diff --git a/application/dialogs/NewInstanceDialog.h b/application/dialogs/NewInstanceDialog.h index 88ed00e5..f8d96dbf 100644 --- a/application/dialogs/NewInstanceDialog.h +++ b/application/dialogs/NewInstanceDialog.h @@ -29,7 +29,7 @@ class NewInstanceDialog; class PageContainer; class QDialogButtonBox; class ImportPage; -class TwitchPage; +class FlamePage; class NewInstanceDialog : public QDialog, public BasePageProvider { @@ -68,7 +68,7 @@ private: QString InstIconKey; ImportPage *importPage = nullptr; - TwitchPage *twitchPage = nullptr; + FlamePage *flamePage = nullptr; std::unique_ptr creationTask; bool importIcon = false; diff --git a/application/pages/modplatform/twitch/TwitchData.h b/application/pages/modplatform/flame/FlameData.h similarity index 90% rename from application/pages/modplatform/twitch/TwitchData.h rename to 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 #include -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 similarity index 92% rename from application/pages/modplatform/twitch/TwitchModel.cpp rename to 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 @@ -10,7 +10,7 @@ #include #include -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 similarity index 95% rename from application/pages/modplatform/twitch/TwitchModel.h rename to 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 #include #include @@ -16,9 +15,9 @@ #include #include -#include "TwitchData.h" +#include "FlameData.h" -namespace Twitch { +namespace Flame { typedef QMap LogoMap; diff --git a/application/pages/modplatform/twitch/TwitchPage.cpp b/application/pages/modplatform/flame/FlamePage.cpp similarity index 69% rename from application/pages/modplatform/twitch/TwitchPage.cpp rename to 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 -#include "TwitchModel.h" +#include "FlameModel.h" #include -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(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(); + current = model->data(first, Qt::UserRole).value(); QString text = ""; QString name = current.name; @@ -72,7 +72,7 @@ void TwitchPage::onSelectionChanged(QModelIndex first, QModelIndex second) else text = "" + name + ""; 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 similarity index 75% rename from application/pages/modplatform/twitch/TwitchPage.h rename to 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 #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 similarity index 62% rename from application/pages/modplatform/twitch/TwitchPage.ui rename to 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 @@ - TwitchPage - + FlamePage + 0 @@ -10,34 +10,36 @@ 745 - - - - - - - - Search - + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + Search + + + + - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - + Qt::ScrollBarAlwaysOff @@ -53,6 +55,22 @@ + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + diff --git a/application/resources/multimc/multimc.qrc b/application/resources/multimc/multimc.qrc index 4e95869e..249e8e28 100644 --- a/application/resources/multimc/multimc.qrc +++ b/application/resources/multimc/multimc.qrc @@ -11,8 +11,9 @@ scalable/reddit-alien.svg - - scalable/twitch.svg + + 32x32/instances/flame.png + 128x128/instances/flame.png scalable/technic.svg diff --git a/application/resources/multimc/scalable/twitch.svg b/application/resources/multimc/scalable/twitch.svg deleted file mode 100644 index 80999380..00000000 --- a/application/resources/multimc/scalable/twitch.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - image/svg+xml - - Glitch - - - - - - - - Glitch - -