aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-12-18 15:41:46 -0300
committerflow <flowlnlnln@gmail.com>2023-01-13 16:23:07 -0300
commit45d1319891ce87cc1546a316ad550f892d411633 (patch)
treea1eaabd0e5fc362a82ebfbe93bfe20697608fe1e /launcher/modplatform/modrinth
parent39b7ac90d40eb53d7b88ef99b0fa46fb3e1840b9 (diff)
downloadPrismLauncher-45d1319891ce87cc1546a316ad550f892d411633.tar.gz
PrismLauncher-45d1319891ce87cc1546a316ad550f892d411633.tar.bz2
PrismLauncher-45d1319891ce87cc1546a316ad550f892d411633.zip
refactor(RD): decouple ResourceModels from ResourcePages
This makes it so that we don't need a reference to the parent page in the model. It will be useful once we change the page from a widget-based one to a QML page. It also makes tasks be created in the dialog instead of the page, so that the dialog can also have the necessary information to mark versions as selected / deselected easily. It also makes the task pointers into smart pointers. Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/modplatform/modrinth')
-rw-r--r--launcher/modplatform/modrinth/ModrinthAPI.h2
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.cpp4
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h
index bd84fb54..ec38d9ee 100644
--- a/launcher/modplatform/modrinth/ModrinthAPI.h
+++ b/launcher/modplatform/modrinth/ModrinthAPI.h
@@ -141,7 +141,7 @@ class ModrinthAPI : public NetworkResourceAPI {
get_arguments.append(QString("loaders=[\"%1\"]").arg(getModLoaderStrings(args.loaders.value()).join("\",\"")));
return QString("%1/project/%2/version%3%4")
- .arg(BuildConfig.MODRINTH_PROD_URL, args.addonId, get_arguments.isEmpty() ? "" : "?", get_arguments.join('&'));
+ .arg(BuildConfig.MODRINTH_PROD_URL, args.pack.addonId.toString(), get_arguments.isEmpty() ? "" : "?", get_arguments.join('&'));
};
auto getGameVersionsArray(std::list<Version> mcVersions) const -> QString
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
index a0161089..f270f470 100644
--- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
+++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
@@ -95,10 +95,10 @@ void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& ob
void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network,
- BaseInstance* inst)
+ const BaseInstance* inst)
{
QVector<ModPlatform::IndexedVersion> unsortedVersions;
- QString mcVersion = (static_cast<MinecraftInstance*>(inst))->getPackProfile()->getComponentVersion("net.minecraft");
+ QString mcVersion = (static_cast<const MinecraftInstance*>(inst))->getPackProfile()->getComponentVersion("net.minecraft");
for (auto versionIter : arr) {
auto obj = versionIter.toObject();
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.h b/launcher/modplatform/modrinth/ModrinthPackIndex.h
index 31881414..e73e4b18 100644
--- a/launcher/modplatform/modrinth/ModrinthPackIndex.h
+++ b/launcher/modplatform/modrinth/ModrinthPackIndex.h
@@ -29,7 +29,7 @@ void loadExtraPackData(ModPlatform::IndexedPack& m, QJsonObject& obj);
void loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network,
- BaseInstance* inst);
+ const BaseInstance* inst);
auto loadIndexedPackVersion(QJsonObject& obj, QString hash_type = "sha512", QString filename_prefer = "") -> ModPlatform::IndexedVersion;
} // namespace Modrinth