aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-14 18:16:53 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-14 18:16:53 +0200
commit91ba4cf75ee30c64779edb5b7644e5a830de5026 (patch)
treeaa8c2433bfc3a54577aceeb706c4c2cd0986c95d /launcher/modplatform/flame
parent779f70057b021e285afd60cc650a14cd5feacffd (diff)
downloadPrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.tar.gz
PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.tar.bz2
PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.zip
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/modplatform/flame')
-rw-r--r--launcher/modplatform/flame/FileResolvingTask.cpp2
-rw-r--r--launcher/modplatform/flame/FlameAPI.cpp6
-rw-r--r--launcher/modplatform/flame/FlameCheckUpdate.h5
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp1
-rw-r--r--launcher/modplatform/flame/FlamePackIndex.cpp9
-rw-r--r--launcher/modplatform/flame/PackManifest.cpp7
-rw-r--r--launcher/modplatform/flame/PackManifest.h34
7 files changed, 25 insertions, 39 deletions
diff --git a/launcher/modplatform/flame/FileResolvingTask.cpp b/launcher/modplatform/flame/FileResolvingTask.cpp
index 9c0cb35b..860d7340 100644
--- a/launcher/modplatform/flame/FileResolvingTask.cpp
+++ b/launcher/modplatform/flame/FileResolvingTask.cpp
@@ -1,9 +1,9 @@
#include "FileResolvingTask.h"
#include "Json.h"
+#include "net/ApiDownload.h"
#include "net/ApiUpload.h"
#include "net/Upload.h"
-#include "net/ApiDownload.h"
#include "modplatform/modrinth/ModrinthPackIndex.h"
diff --git a/launcher/modplatform/flame/FlameAPI.cpp b/launcher/modplatform/flame/FlameAPI.cpp
index 7231b466..73ed1011 100644
--- a/launcher/modplatform/flame/FlameAPI.cpp
+++ b/launcher/modplatform/flame/FlameAPI.cpp
@@ -8,9 +8,9 @@
#include "Application.h"
#include "BuildConfig.h"
#include "Json.h"
+#include "net/ApiDownload.h"
#include "net/ApiUpload.h"
#include "net/NetJob.h"
-#include "net/ApiDownload.h"
#include "net/Upload.h"
Task::Ptr FlameAPI::matchFingerprints(const QList<uint>& fingerprints, std::shared_ptr<QByteArray> response)
@@ -75,8 +75,8 @@ auto FlameAPI::getModDescription(int modId) -> QString
auto netJob = makeShared<NetJob>(QString("Flame::ModDescription"), APPLICATION->network());
auto response = std::make_shared<QByteArray>();
- netJob->addNetAction(
- Net::ApiDownload::makeByteArray(QString("https://api.curseforge.com/v1/mods/%1/description").arg(QString::number(modId)), response));
+ netJob->addNetAction(Net::ApiDownload::makeByteArray(
+ QString("https://api.curseforge.com/v1/mods/%1/description").arg(QString::number(modId)), response));
QObject::connect(netJob.get(), &NetJob::succeeded, [&netJob, response, &description] {
QJsonParseError parse_error{};
diff --git a/launcher/modplatform/flame/FlameCheckUpdate.h b/launcher/modplatform/flame/FlameCheckUpdate.h
index 4a98d684..e3465d7e 100644
--- a/launcher/modplatform/flame/FlameCheckUpdate.h
+++ b/launcher/modplatform/flame/FlameCheckUpdate.h
@@ -8,7 +8,10 @@ class FlameCheckUpdate : public CheckUpdateTask {
Q_OBJECT
public:
- FlameCheckUpdate(QList<Mod*>& mods, std::list<Version>& mcVersions, std::optional<ResourceAPI::ModLoaderTypes> loaders, std::shared_ptr<ModFolderModel> mods_folder)
+ FlameCheckUpdate(QList<Mod*>& mods,
+ std::list<Version>& mcVersions,
+ std::optional<ResourceAPI::ModLoaderTypes> loaders,
+ std::shared_ptr<ModFolderModel> mods_folder)
: CheckUpdateTask(mods, mcVersions, loaders, mods_folder)
{}
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index 2215de19..19803cf6 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -194,4 +194,3 @@ ModPlatform::IndexedVersion FlameMod::loadDependencyVersions(const ModPlatform::
std::sort(versions.begin(), versions.end(), orderSortPredicate);
return versions.front();
}
-
diff --git a/launcher/modplatform/flame/FlamePackIndex.cpp b/launcher/modplatform/flame/FlamePackIndex.cpp
index ad48b7b6..21835a54 100644
--- a/launcher/modplatform/flame/FlamePackIndex.cpp
+++ b/launcher/modplatform/flame/FlamePackIndex.cpp
@@ -54,23 +54,22 @@ void Flame::loadIndexedInfo(IndexedPack& pack, QJsonObject& obj)
auto links_obj = Json::ensureObject(obj, "links");
pack.extra.websiteUrl = Json::ensureString(links_obj, "websiteUrl");
- if(pack.extra.websiteUrl.endsWith('/'))
+ if (pack.extra.websiteUrl.endsWith('/'))
pack.extra.websiteUrl.chop(1);
pack.extra.issuesUrl = Json::ensureString(links_obj, "issuesUrl");
- if(pack.extra.issuesUrl.endsWith('/'))
+ if (pack.extra.issuesUrl.endsWith('/'))
pack.extra.issuesUrl.chop(1);
pack.extra.sourceUrl = Json::ensureString(links_obj, "sourceUrl");
- if(pack.extra.sourceUrl.endsWith('/'))
+ if (pack.extra.sourceUrl.endsWith('/'))
pack.extra.sourceUrl.chop(1);
pack.extra.wikiUrl = Json::ensureString(links_obj, "wikiUrl");
- if(pack.extra.wikiUrl.endsWith('/'))
+ if (pack.extra.wikiUrl.endsWith('/'))
pack.extra.wikiUrl.chop(1);
pack.extraInfoLoaded = true;
-
}
void Flame::loadIndexedPackVersions(Flame::IndexedPack& pack, QJsonArray& arr)
diff --git a/launcher/modplatform/flame/PackManifest.cpp b/launcher/modplatform/flame/PackManifest.cpp
index ee4d0766..40a523d3 100644
--- a/launcher/modplatform/flame/PackManifest.cpp
+++ b/launcher/modplatform/flame/PackManifest.cpp
@@ -46,7 +46,7 @@ static void loadManifestV1(Flame::Manifest& pack, QJsonObject& manifest)
Flame::File file;
loadFileV1(file, obj);
- pack.files.insert(file.fileId,file);
+ pack.files.insert(file.fileId, file);
}
pack.overrides = Json::ensureString(manifest, "overrides", "overrides");
@@ -69,7 +69,7 @@ void Flame::loadManifest(Flame::Manifest& m, const QString& filepath)
loadManifestV1(m, obj);
}
-bool Flame::File::parseFromObject(const QJsonObject& obj, bool throw_on_blocked)
+bool Flame::File::parseFromObject(const QJsonObject& obj, bool throw_on_blocked)
{
fileName = Json::requireString(obj, "fileName");
// This is a piece of a Flame project JSON pulled out into the file metadata (here) for convenience
@@ -81,7 +81,7 @@ bool Flame::File::parseFromObject(const QJsonObject& obj, bool throw_on_blocked
// get the hash
hash = QString();
auto hashes = Json::ensureArray(obj, "hashes");
- for(QJsonValueRef item : hashes) {
+ for (QJsonValueRef item : hashes) {
auto hobj = Json::requireObject(item);
auto algo = Json::requireInteger(hobj, "algo");
auto value = Json::requireString(hobj, "value");
@@ -90,7 +90,6 @@ bool Flame::File::parseFromObject(const QJsonObject& obj, bool throw_on_blocked
}
}
-
// may throw, if the project is blocked
QString rawUrl = Json::ensureString(obj, "downloadUrl");
url = QUrl(rawUrl, QUrl::TolerantMode);
diff --git a/launcher/modplatform/flame/PackManifest.h b/launcher/modplatform/flame/PackManifest.h
index 0b7461d8..a608263c 100644
--- a/launcher/modplatform/flame/PackManifest.h
+++ b/launcher/modplatform/flame/PackManifest.h
@@ -41,10 +41,8 @@
#include <QUrl>
#include <QVector>
-namespace Flame
-{
-struct File
-{
+namespace Flame {
+struct File {
// NOTE: throws JSONValidationError
bool parseFromObject(const QJsonObject& object, bool throw_on_blocked = true);
@@ -61,45 +59,33 @@ struct File
QString fileName;
QUrl url;
QString targetFolder = QStringLiteral("mods");
- enum class Type
- {
- Unknown,
- Folder,
- Ctoc,
- SingleFile,
- Cmod2,
- Modpack,
- Mod
- } type = Type::Mod;
+ enum class Type { Unknown, Folder, Ctoc, SingleFile, Cmod2, Modpack, Mod } type = Type::Mod;
};
-struct Modloader
-{
+struct Modloader {
QString id;
bool primary = false;
};
-struct Minecraft
-{
+struct Minecraft {
QString version;
QString libraries;
QVector<Flame::Modloader> modLoaders;
};
-struct Manifest
-{
+struct Manifest {
QString manifestType;
int manifestVersion = 0;
Flame::Minecraft minecraft;
QString name;
QString version;
QString author;
- //File id -> File
- QMap<int,Flame::File> files;
+ // File id -> File
+ QMap<int, Flame::File> files;
QString overrides;
bool is_loaded = false;
};
-void loadManifest(Flame::Manifest & m, const QString &filepath);
-}
+void loadManifest(Flame::Manifest& m, const QString& filepath);
+} // namespace Flame