Merge pull request #3682 from kb-1000/rename-twitch-curseforge

NOISSUE rename Twitch to flame internally for consistency and to CurseForge for user displayed strings
This commit is contained in:
Petr Mrázek 2021-03-26 00:38:58 +00:00 committed by GitHub
commit 369a243f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 106 additions and 151 deletions

View File

@ -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());

View File

@ -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

View File

@ -37,7 +37,7 @@
#include <pages/modplatform/atlauncher/AtlPage.h>
#include <pages/modplatform/ftb/FtbPage.h>
#include <pages/modplatform/legacy_ftb/Page.h>
#include <pages/modplatform/twitch/TwitchPage.h>
#include <pages/modplatform/flame/FlamePage.h>
#include <pages/modplatform/ImportPage.h>
#include <pages/modplatform/technic/TechnicPage.h>
@ -124,17 +124,17 @@ void NewInstanceDialog::accept()
QList<BasePage *> 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
};
}

View File

@ -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<InstanceTask> creationTask;
bool importIcon = false;

View File

@ -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)

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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;
};

View File

@ -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,34 +10,36 @@
<height>745</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="searchEdit"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="searchButton">
<property name="text">
<string>Search</string>
</property>
<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="2" column="0" colspan="2">
<widget class="MCModInfoFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item>
<widget class="QListView" name="packView">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
@ -53,6 +55,22 @@
</property>
</widget>
</item>
<item>
<widget class="MCModInfoFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View File

@ -11,8 +11,9 @@
<!-- REDDIT logo icon, needs reddit license! -->
<file>scalable/reddit-alien.svg</file>
<!-- twitch logo icon -->
<file>scalable/twitch.svg</file>
<!-- Icon for CurseForge. Unknown license? -->
<file alias="32x32/flame.png">32x32/instances/flame.png</file>
<file alias="128x128/flame.png">128x128/instances/flame.png</file>
<!-- technic logo icon -->
<file>scalable/technic.svg</file>

View File

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="Layer_1"
data-name="Layer 1"
viewBox="0 0 134 134"
version="1.1"
sodipodi:docname="twitch.svg"
inkscape:version="0.92.2 2405546, 2018-03-11"
width="134"
height="134">
<metadata
id="metadata13">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Glitch</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1414"
inkscape:window-height="944"
id="namedview11"
showgrid="false"
inkscape:zoom="1.761194"
inkscape:cx="-109.17797"
inkscape:cy="66.999998"
inkscape:window-x="2640"
inkscape:window-y="554"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" />
<defs
id="defs4">
<style
id="style2">.cls-1{fill:#6441a4;fill-rule:evenodd;}</style>
</defs>
<title
id="title6">Glitch</title>
<path
class="cls-1"
d="M 9,0 0,23 v 94 h 32 v 17 H 50 L 67,117 H 93 L 128,82 V 0 Z M 116,76 96,96 H 64 L 47,113 V 96 H 20 V 12 h 96 z M 96,35 V 70 H 84 V 35 Z M 64,35 V 70 H 52 V 35 Z"
id="path8"
style="fill:#6441a4;fill-opacity:1;fill-rule:evenodd"
inkscape:connector-curvature="0" />
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB