aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/flame
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/pages/modplatform/flame')
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModel.cpp8
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp11
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.h48
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp28
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameResourcePages.h29
5 files changed, 68 insertions, 56 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlameModel.cpp b/launcher/ui/pages/modplatform/flame/FlameModel.cpp
index fa55aa68..83c1270b 100644
--- a/launcher/ui/pages/modplatform/flame/FlameModel.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlameModel.cpp
@@ -40,14 +40,16 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
return edit;
}
return pack.description;
- } case Qt::DecorationRole: {
+ }
+ case Qt::DecorationRole: {
if (m_logoMap.contains(pack.logoName)) {
return (m_logoMap.value(pack.logoName));
}
QIcon icon = APPLICATION->getThemedIcon("screenshot-placeholder");
((ListModel*)this)->requestLogo(pack.logoName, pack.logoUrl);
return icon;
- } case Qt::UserRole: {
+ }
+ case Qt::UserRole: {
QVariant v;
v.setValue(pack);
return v;
@@ -68,7 +70,7 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
return QVariant();
}
-bool ListModel::setData(const QModelIndex &index, const QVariant &value, int role)
+bool ListModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
int pos = index.row();
if (pos >= modpacks.size() || pos < 0 || !index.isValid())
diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.cpp b/launcher/ui/pages/modplatform/flame/FlamePage.cpp
index cef26bb6..b676cad9 100644
--- a/launcher/ui/pages/modplatform/flame/FlamePage.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlamePage.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
@@ -42,9 +42,9 @@
#include "FlameModel.h"
#include "InstanceImportTask.h"
#include "Json.h"
+#include "modplatform/flame/FlameAPI.h"
#include "ui/dialogs/NewInstanceDialog.h"
#include "ui/widgets/ProjectItem.h"
-#include "modplatform/flame/FlameAPI.h"
static FlameAPI api;
@@ -252,10 +252,8 @@ void FlamePage::updateUi()
text += "<br>" + tr(" by ") + authorStrs.join(", ");
}
- if(current.extraInfoLoaded) {
- if (!current.extra.issuesUrl.isEmpty()
- || !current.extra.sourceUrl.isEmpty()
- || !current.extra.wikiUrl.isEmpty()) {
+ if (current.extraInfoLoaded) {
+ if (!current.extra.issuesUrl.isEmpty() || !current.extra.sourceUrl.isEmpty() || !current.extra.wikiUrl.isEmpty()) {
text += "<br><br>" + tr("External links:") + "<br>";
}
@@ -267,7 +265,6 @@ void FlamePage::updateUi()
text += "- " + tr("Source code: <a href=%1>%1</a>").arg(current.extra.sourceUrl) + "<br>";
}
-
text += "<hr>";
text += api.getModDescription(current.addonId).toUtf8();
diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.h b/launcher/ui/pages/modplatform/flame/FlamePage.h
index 8bdca38e..ff5c7975 100644
--- a/launcher/ui/pages/modplatform/flame/FlamePage.h
+++ b/launcher/ui/pages/modplatform/flame/FlamePage.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
@@ -37,45 +37,31 @@
#include <QWidget>
-#include "ui/pages/BasePage.h"
#include <Application.h>
-#include "tasks/Task.h"
#include <modplatform/flame/FlamePackIndex.h>
+#include "tasks/Task.h"
+#include "ui/pages/BasePage.h"
-namespace Ui
-{
+namespace Ui {
class FlamePage;
}
class NewInstanceDialog;
namespace Flame {
- class ListModel;
+class ListModel;
}
-class FlamePage : public QWidget, public BasePage
-{
+class FlamePage : public QWidget, public BasePage {
Q_OBJECT
-public:
- explicit FlamePage(NewInstanceDialog* dialog, QWidget *parent = 0);
+ public:
+ explicit FlamePage(NewInstanceDialog* dialog, QWidget* parent = 0);
virtual ~FlamePage();
- virtual QString displayName() const override
- {
- return "CurseForge";
- }
- virtual QIcon icon() const override
- {
- return APPLICATION->getThemedIcon("flame");
- }
- virtual QString id() const override
- {
- return "flame";
- }
- virtual QString helpPage() const override
- {
- return "Flame-platform";
- }
+ virtual QString displayName() const override { return "CurseForge"; }
+ virtual QIcon icon() const override { return APPLICATION->getThemedIcon("flame"); }
+ virtual QString id() const override { return "flame"; }
+ virtual QString helpPage() const override { return "Flame-platform"; }
virtual bool shouldDisplay() const override;
void retranslate() override;
@@ -83,18 +69,18 @@ public:
void openedImpl() override;
- bool eventFilter(QObject * watched, QEvent * event) override;
+ bool eventFilter(QObject* watched, QEvent* event) override;
-private:
+ private:
void suggestCurrent();
-private slots:
+ private slots:
void triggerSearch();
void onSelectionChanged(QModelIndex first, QModelIndex second);
void onVersionSelectionChanged(QString data);
-private:
- Ui::FlamePage *ui = nullptr;
+ private:
+ Ui::FlamePage* ui = nullptr;
NewInstanceDialog* dialog = nullptr;
Flame::ListModel* listModel = nullptr;
Flame::IndexedPack current;
diff --git a/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp b/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp
index f93e27e6..dc17e705 100644
--- a/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlameResourcePages.cpp
@@ -49,8 +49,7 @@ static bool isOptedOut(ModPlatform::IndexedVersion const& ver)
return ver.downloadUrl.isEmpty();
}
-FlameModPage::FlameModPage(ModDownloadDialog* dialog, BaseInstance& instance)
- : ModPage(dialog, instance)
+FlameModPage::FlameModPage(ModDownloadDialog* dialog, BaseInstance& instance) : ModPage(dialog, instance)
{
m_model = new FlameModModel(instance);
m_ui->packView->setModel(m_model);
@@ -67,7 +66,9 @@ FlameModPage::FlameModPage(ModDownloadDialog* dialog, BaseInstance& instance)
m_ui->packDescription->setMetaEntry(metaEntryBase());
}
-auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, std::optional<ResourceAPI::ModLoaderTypes> loaders) const -> bool
+auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver,
+ QString mineVer,
+ std::optional<ResourceAPI::ModLoaderTypes> loaders) const -> bool
{
Q_UNUSED(loaders);
return ver.mcVersion.contains(mineVer) && !ver.downloadUrl.isEmpty();
@@ -86,7 +87,7 @@ void FlameModPage::openUrl(const QUrl& url)
if (query.startsWith("remoteUrl=")) {
// attempt to resolve url from warning page
query.remove(0, 10);
- ModPage::openUrl({QUrl::fromPercentEncoding(query.toUtf8())}); // double decoding is necessary
+ ModPage::openUrl({ QUrl::fromPercentEncoding(query.toUtf8()) }); // double decoding is necessary
return;
}
}
@@ -125,7 +126,7 @@ void FlameResourcePackPage::openUrl(const QUrl& url)
if (query.startsWith("remoteUrl=")) {
// attempt to resolve url from warning page
query.remove(0, 10);
- ResourcePackResourcePage::openUrl({QUrl::fromPercentEncoding(query.toUtf8())}); // double decoding is necessary
+ ResourcePackResourcePage::openUrl({ QUrl::fromPercentEncoding(query.toUtf8()) }); // double decoding is necessary
return;
}
}
@@ -164,7 +165,7 @@ void FlameTexturePackPage::openUrl(const QUrl& url)
if (query.startsWith("remoteUrl=")) {
// attempt to resolve url from warning page
query.remove(0, 10);
- ResourcePackResourcePage::openUrl({QUrl::fromPercentEncoding(query.toUtf8())}); // double decoding is necessary
+ ResourcePackResourcePage::openUrl({ QUrl::fromPercentEncoding(query.toUtf8()) }); // double decoding is necessary
return;
}
}
@@ -175,8 +176,17 @@ void FlameTexturePackPage::openUrl(const QUrl& url)
// I don't know why, but doing this on the parent class makes it so that
// other mod providers start loading before being selected, at least with
// my Qt, so we need to implement this in every derived class...
-auto FlameModPage::shouldDisplay() const -> bool { return true; }
-auto FlameResourcePackPage::shouldDisplay() const -> bool { return true; }
-auto FlameTexturePackPage::shouldDisplay() const -> bool { return true; }
+auto FlameModPage::shouldDisplay() const -> bool
+{
+ return true;
+}
+auto FlameResourcePackPage::shouldDisplay() const -> bool
+{
+ return true;
+}
+auto FlameTexturePackPage::shouldDisplay() const -> bool
+{
+ return true;
+}
} // namespace ResourceDownload
diff --git a/launcher/ui/pages/modplatform/flame/FlameResourcePages.h b/launcher/ui/pages/modplatform/flame/FlameResourcePages.h
index 103a6bb9..c6ebc1ea 100644
--- a/launcher/ui/pages/modplatform/flame/FlameResourcePages.h
+++ b/launcher/ui/pages/modplatform/flame/FlameResourcePages.h
@@ -49,12 +49,27 @@
namespace ResourceDownload {
namespace Flame {
-static inline QString displayName() { return "CurseForge"; }
-static inline QIcon icon() { return APPLICATION->getThemedIcon("flame"); }
-static inline QString id() { return "curseforge"; }
-static inline QString debugName() { return "Flame"; }
-static inline QString metaEntryBase() { return "FlameMods"; }
+static inline QString displayName()
+{
+ return "CurseForge";
}
+static inline QIcon icon()
+{
+ return APPLICATION->getThemedIcon("flame");
+}
+static inline QString id()
+{
+ return "curseforge";
+}
+static inline QString debugName()
+{
+ return "Flame";
+}
+static inline QString metaEntryBase()
+{
+ return "FlameMods";
+}
+} // namespace Flame
class FlameModPage : public ModPage {
Q_OBJECT
@@ -78,7 +93,9 @@ class FlameModPage : public ModPage {
[[nodiscard]] inline auto helpPage() const -> QString override { return "Mod-platform"; }
- bool validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, std::optional<ResourceAPI::ModLoaderTypes> loaders = {}) const override;
+ bool validateVersion(ModPlatform::IndexedVersion& ver,
+ QString mineVer,
+ std::optional<ResourceAPI::ModLoaderTypes> loaders = {}) const override;
bool optedOut(ModPlatform::IndexedVersion& ver) const override;
void openUrl(const QUrl& url) override;