aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/ModAPI.h
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-03-07 16:22:57 -0300
committerflow <thiagodonato300@gmail.com>2022-03-07 16:22:57 -0300
commitf714adf6d2cc94f20ba37f2776d0d61e22267f0e (patch)
treea72a3f07b0edc45e8c07f97daa8b2786d7cf3ad3 /launcher/modplatform/ModAPI.h
parent39bd04f06ff42623f7349096d707c4a877fc7cd7 (diff)
downloadPrismLauncher-f714adf6d2cc94f20ba37f2776d0d61e22267f0e.tar.gz
PrismLauncher-f714adf6d2cc94f20ba37f2776d0d61e22267f0e.tar.bz2
PrismLauncher-f714adf6d2cc94f20ba37f2776d0d61e22267f0e.zip
refactor: move NetJob away from ModModel to ModAPI
This is done so that 1. ModAPI behaves more like an actual API instead of just a helper, and 2. Allows for more easily creating other mod providers that may or may not use network tasks (foreshadowing lol)
Diffstat (limited to 'launcher/modplatform/ModAPI.h')
-rw-r--r--launcher/modplatform/ModAPI.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/launcher/modplatform/ModAPI.h b/launcher/modplatform/ModAPI.h
index 4d22a63d..8503d7fc 100644
--- a/launcher/modplatform/ModAPI.h
+++ b/launcher/modplatform/ModAPI.h
@@ -1,21 +1,30 @@
#pragma once
+#include <QJsonDocument>
#include <QString>
+namespace ModPlatform {
+class ListModel;
+}
+
class ModAPI {
- public:
- virtual ~ModAPI() = default;
+ protected:
+ using CallerType = ModPlatform::ListModel;
+
+ public:
+ virtual ~ModAPI() = default;
+
+ // https://docs.curseforge.com/?http#tocS_ModLoaderType
+ enum ModLoaderType { Any = 0, Forge = 1, Cauldron = 2, LiteLoader = 3, Fabric = 4 };
- // https://docs.curseforge.com/?http#tocS_ModLoaderType
- enum ModLoaderType {
- Any = 0,
- Forge = 1,
- Cauldron = 2,
- LiteLoader = 3,
- Fabric = 4
- };
+ struct SearchArgs {
+ int offset;
+ QString search;
+ QString sorting;
+ ModLoaderType mod_loader;
+ QString version;
+ };
- inline virtual QString getModSearchURL(int, QString, QString, ModLoaderType, QString) const { return ""; };
- inline virtual QString getVersionsURL(const QString& addonId) const { return ""; };
- inline virtual QString getAuthorURL(const QString& name) const { return ""; };
+ inline virtual void searchMods(CallerType* caller, SearchArgs&& args) const {};
+ inline virtual void getVersions(CallerType* caller, const QString& addonId, const QString& debugName = "") const {};
};