aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod/Mod.h
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft/mod/Mod.h')
-rw-r--r--launcher/minecraft/mod/Mod.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/launcher/minecraft/mod/Mod.h b/launcher/minecraft/mod/Mod.h
index 5f9c4684..7a13e44b 100644
--- a/launcher/minecraft/mod/Mod.h
+++ b/launcher/minecraft/mod/Mod.h
@@ -39,10 +39,12 @@
#include <QFileInfo>
#include <QList>
+#include "QObjectPtr.h"
#include "ModDetails.h"
-class Mod
+class Mod : public QObject
{
+ Q_OBJECT
public:
enum ModType
{
@@ -53,6 +55,8 @@ public:
MOD_LITEMOD, //!< The mod is a litemod
};
+ using Ptr = shared_qobject_ptr<Mod>;
+
Mod() = default;
Mod(const QFileInfo &file);
explicit Mod(const QDir& mods_dir, const Metadata::ModStruct& metadata);
@@ -77,12 +81,12 @@ public:
auto metadata() const -> const std::shared_ptr<Metadata::ModStruct>;
void setStatus(ModStatus status);
- void setMetadata(Metadata::ModStruct* metadata);
+ void setMetadata(const Metadata::ModStruct& metadata);
auto enable(bool value) -> bool;
// delete all the files of this mod
- auto destroy(QDir& index_dir) -> bool;
+ auto destroy(QDir& index_dir, bool preserve_metadata = false) -> bool;
// change the mod's filesystem path (used by mod lists for *MAGIC* purposes)
void repath(const QFileInfo &file);
@@ -111,7 +115,7 @@ protected:
std::shared_ptr<Metadata::ModStruct> m_temp_metadata;
/* Set the mod status while it doesn't have local details just yet */
- ModStatus m_temp_status = ModStatus::NotInstalled;
+ ModStatus m_temp_status = ModStatus::NoMetadata;
std::shared_ptr<ModDetails> m_localDetails;