aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/packwiz/Packwiz.h
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-04-15 22:37:10 -0300
committerflow <flowlnlnln@gmail.com>2022-05-23 14:42:28 -0300
commit092d2f8917271264871d69239ecb8836b34d0994 (patch)
tree23285b6b99bf1ea24eaa36e4045af2593ff3da34 /launcher/modplatform/packwiz/Packwiz.h
parente9fb566c0797865a37e5b59a49163258b3adb328 (diff)
downloadPrismLauncher-092d2f8917271264871d69239ecb8836b34d0994.tar.gz
PrismLauncher-092d2f8917271264871d69239ecb8836b34d0994.tar.bz2
PrismLauncher-092d2f8917271264871d69239ecb8836b34d0994.zip
feat: add support for converting builtin -> packwiz mod formats
Also adds more documentation.
Diffstat (limited to 'launcher/modplatform/packwiz/Packwiz.h')
-rw-r--r--launcher/modplatform/packwiz/Packwiz.h36
1 files changed, 23 insertions, 13 deletions
diff --git a/launcher/modplatform/packwiz/Packwiz.h b/launcher/modplatform/packwiz/Packwiz.h
index 541059d0..457d268a 100644
--- a/launcher/modplatform/packwiz/Packwiz.h
+++ b/launcher/modplatform/packwiz/Packwiz.h
@@ -6,33 +6,43 @@
#include <QUrl>
#include <QVariant>
-namespace ModPlatform {
-} // namespace ModPlatform
-
class QDir;
+// Mod from launcher/minecraft/mod/Mod.h
+class Mod;
+
class Packwiz {
public:
struct Mod {
- QString name;
- QString filename;
+ QString name {};
+ QString filename {};
// FIXME: make side an enum
- QString side = "both";
+ QString side {"both"};
// [download]
- QUrl url;
+ QUrl url {};
// FIXME: make hash-format an enum
- QString hash_format;
- QString hash;
+ QString hash_format {};
+ QString hash {};
// [update]
- ModPlatform::Provider provider;
- QVariant file_id;
- QVariant project_id;
+ ModPlatform::Provider provider {};
+ QVariant file_id {};
+ QVariant project_id {};
+
+ public:
+ // This is a heuristic, but should work for now.
+ auto isValid() const -> bool { return !name.isEmpty(); }
};
- /* Generates the object representing the information in a mod.toml file via its common representation in the launcher */
+ /* Generates the object representing the information in a mod.toml file via
+ * its common representation in the launcher, when downloading mods.
+ * */
static auto createModFormat(QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version) -> Mod;
+ /* Generates the object representing the information in a mod.toml file via
+ * its common representation in the launcher.
+ * */
+ static auto createModFormat(QDir& index_dir, ::Mod& internal_mod) -> Mod;
/* Updates the mod index for the provided mod.
* This creates a new index if one does not exist already