Added a function to get an instance's type.
This commit is contained in:
parent
36396f7c6a
commit
69040f923b
@ -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 ////
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user