summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmultimc/include/instance.h11
-rw-r--r--plugins/stdinstance/stdinstance.cpp10
-rw-r--r--plugins/stdinstance/stdinstance.h7
-rw-r--r--plugins/stdinstance/stdinstancetype.cpp4
4 files changed, 27 insertions, 5 deletions
diff --git a/libmultimc/include/instance.h b/libmultimc/include/instance.h
index 7de61343..aaefbd6e 100644
--- a/libmultimc/include/instance.h
+++ b/libmultimc/include/instance.h
@@ -22,6 +22,7 @@
#include <settingsobject.h>
#include "inifile.h"
+#include "instancetypeinterface.h"
#include "libmmc_config.h"
@@ -251,6 +252,16 @@ public:
QString modListFile() const;
+
+ //////// INSTANCE TYPE STUFF ////////
+
+ /*!
+ * \brief Returns a pointer to this instance's type.
+ * \return A pointer to this instance's type interface.
+ */
+ virtual const InstanceTypeInterface *instanceType() const = 0;
+
+
//////// OTHER FUNCTIONS ////////
//// Version System ////
diff --git a/plugins/stdinstance/stdinstance.cpp b/plugins/stdinstance/stdinstance.cpp
index 217514a3..077b6b15 100644
--- a/plugins/stdinstance/stdinstance.cpp
+++ b/plugins/stdinstance/stdinstance.cpp
@@ -21,11 +21,12 @@
#include <javautils.h>
-StdInstance::StdInstance(const QString &rootDir, QObject *parent) :
+StdInstance::StdInstance(const QString &rootDir, const InstanceTypeInterface *iType, QObject *parent) :
Instance(rootDir, parent)
{
- settings().registerSetting(new Setting("lastVersionUpdate", 0));
+ m_instType = iType;
+ settings().registerSetting(new Setting("lastVersionUpdate", 0));
}
bool StdInstance::shouldUpdateCurrentVersion()
@@ -55,3 +56,8 @@ void StdInstance::updateCurrentVersion(bool keepCurrent)
setCurrentVersion(newVersion);
}
}
+
+const InstanceTypeInterface *StdInstance::instanceType() const
+{
+ return m_instType;
+}
diff --git a/plugins/stdinstance/stdinstance.h b/plugins/stdinstance/stdinstance.h
index d657d9aa..9c4b6fd6 100644
--- a/plugins/stdinstance/stdinstance.h
+++ b/plugins/stdinstance/stdinstance.h
@@ -22,15 +22,20 @@ class StdInstance : public Instance
{
Q_OBJECT
public:
- explicit StdInstance(const QString &rootDir, QObject *parent = 0);
+ explicit StdInstance(const QString &rootDir, const InstanceTypeInterface *iType, QObject *parent = 0);
virtual bool shouldUpdateCurrentVersion();
virtual void updateCurrentVersion(bool keepCurrent);
+ virtual const InstanceTypeInterface *instanceType() const;
+
////// TIMESTAMPS //////
virtual qint64 lastVersionUpdate() { return settings().get("lastVersionUpdate").value<qint64>(); }
virtual void setLastVersionUpdate(qint64 val) { settings().set("lastVersionUpdate", val); }
+
+protected:
+ const InstanceTypeInterface *m_instType;
};
#endif // STDINSTANCE_H
diff --git a/plugins/stdinstance/stdinstancetype.cpp b/plugins/stdinstance/stdinstancetype.cpp
index 5a3a6649..93c5fd16 100644
--- a/plugins/stdinstance/stdinstancetype.cpp
+++ b/plugins/stdinstance/stdinstancetype.cpp
@@ -36,7 +36,7 @@ InstanceLoader::InstTypeError StdInstanceType::createInstance(Instance *&inst,
return InstanceLoader::CantCreateDir;
}
- StdInstance *stdInst = new StdInstance(instDir);
+ StdInstance *stdInst = new StdInstance(instDir, this);
// TODO: Verify that the instance is valid.
@@ -48,7 +48,7 @@ InstanceLoader::InstTypeError StdInstanceType::createInstance(Instance *&inst,
InstanceLoader::InstTypeError StdInstanceType::loadInstance(Instance *&inst,
const QString &instDir) const
{
- StdInstance *stdInst = new StdInstance(instDir);
+ StdInstance *stdInst = new StdInstance(instDir, this);
// TODO: Verify that the instance is valid.