aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame/FlameModIndex.cpp
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-11-25 09:23:46 -0300
committerflow <flowlnlnln@gmail.com>2023-01-13 16:23:00 -0300
commit6a1807995390b2a2cbe074ee1f47d3791e0e3f10 (patch)
tree592c7ea5be22577d4034668177119271c2218527 /launcher/modplatform/flame/FlameModIndex.cpp
parentb937d334362c0810ab59b3bc4660a2bbea31c7da (diff)
downloadPrismLauncher-6a1807995390b2a2cbe074ee1f47d3791e0e3f10.tar.gz
PrismLauncher-6a1807995390b2a2cbe074ee1f47d3791e0e3f10.tar.bz2
PrismLauncher-6a1807995390b2a2cbe074ee1f47d3791e0e3f10.zip
refactor: generalize mod models and APIs to resources
Firstly, this abstract away behavior in the mod download models that can also be applied to other types of resources into a superclass, allowing other resource types to be implemented without so much code duplication. For that, this also generalizes the APIs used (currently, ModrinthAPI and FlameAPI) to be able to make requests to other types of resources. It also does a general cleanup of both of those. In particular, this makes use of std::optional instead of invalid values for errors and, well, optional values :p This is a squash of some commits that were becoming too interlaced together to be cleanly separated. Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/modplatform/flame/FlameModIndex.cpp')
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index 32aa4bdb..617b98ce 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -11,7 +11,7 @@ static ModPlatform::ProviderCapabilities ProviderCaps;
void FlameMod::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
{
pack.addonId = Json::requireInteger(obj, "id");
- pack.provider = ModPlatform::Provider::FLAME;
+ pack.provider = ModPlatform::ResourceProvider::FLAME;
pack.name = Json::requireString(obj, "name");
pack.slug = Json::requireString(obj, "slug");
pack.websiteUrl = Json::ensureString(Json::ensureObject(obj, "links"), "websiteUrl", "");
@@ -127,7 +127,7 @@ auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) ->
auto hash_list = Json::ensureArray(obj, "hashes");
for (auto h : hash_list) {
auto hash_entry = Json::ensureObject(h);
- auto hash_types = ProviderCaps.hashType(ModPlatform::Provider::FLAME);
+ auto hash_types = ProviderCaps.hashType(ModPlatform::ResourceProvider::FLAME);
auto hash_algo = enumToString(Json::ensureInteger(hash_entry, "algo", 1, "algorithm"));
if (hash_types.contains(hash_algo)) {
file.hash = Json::requireString(hash_entry, "value");