summaryrefslogtreecommitdiffstats
path: root/libinstance/src/instance.cpp
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-02-25 16:36:27 -0600
committerAndrew <forkk@forkk.net>2013-02-25 16:36:27 -0600
commitbd64cda6726e088ebc860c3fc3ee220ed00121bd (patch)
tree135a1784cf2b7910dd7e258f52129b31a4f4244e /libinstance/src/instance.cpp
parent4ca35a760dfc53fd69f0f2030868ebeda250ed59 (diff)
downloadMultiMC-bd64cda6726e088ebc860c3fc3ee220ed00121bd.tar
MultiMC-bd64cda6726e088ebc860c3fc3ee220ed00121bd.tar.gz
MultiMC-bd64cda6726e088ebc860c3fc3ee220ed00121bd.tar.lz
MultiMC-bd64cda6726e088ebc860c3fc3ee220ed00121bd.tar.xz
MultiMC-bd64cda6726e088ebc860c3fc3ee220ed00121bd.zip
Added instance setting overrides.
Diffstat (limited to 'libinstance/src/instance.cpp')
-rw-r--r--libinstance/src/instance.cpp46
1 files changed, 32 insertions, 14 deletions
diff --git a/libinstance/src/instance.cpp b/libinstance/src/instance.cpp
index 85b43640..377acd32 100644
--- a/libinstance/src/instance.cpp
+++ b/libinstance/src/instance.cpp
@@ -17,7 +17,9 @@
#include <QFileInfo>
-#include "settingsobject.h"
+#include "inisettingsobject.h"
+#include "setting.h"
+#include "overridesetting.h"
#include "pathutils.h"
@@ -25,7 +27,33 @@ Instance::Instance(const QString &rootDir, QObject *parent) :
QObject(parent)
{
m_rootDir = rootDir;
- config.loadFile(PathCombine(rootDir, "instance.cfg"));
+ m_settings = new INISettingsObject(PathCombine(rootDir, "instance.cfg"), this);
+
+ settings().registerSetting(new Setting("name", "Unnamed Instance"));
+ settings().registerSetting(new Setting("iconKey", "default"));
+ settings().registerSetting(new Setting("notes", ""));
+ settings().registerSetting(new Setting("NeedsRebuild", true));
+ settings().registerSetting(new Setting("JarVersion", "Unknown"));
+ settings().registerSetting(new Setting("LwjglVersion", "Mojang"));
+ settings().registerSetting(new Setting("IntendedJarVersion", ""));
+ settings().registerSetting(new Setting("lastLaunchTime", 0));
+
+ // Java Settings
+ settings().registerSetting(new OverrideSetting("JavaPath", globalSettings->getSetting("JavaPath")));
+ settings().registerSetting(new OverrideSetting("JvmArgs", globalSettings->getSetting("JvmArgs")));
+
+ // Custom Commands
+ settings().registerSetting(new OverrideSetting("PreLaunchCommand",
+ globalSettings->getSetting("PreLaunchCommand")));
+ settings().registerSetting(new OverrideSetting("PostExitCommand",
+ globalSettings->getSetting("PostExitCommand")));
+
+ // Memory
+ settings().registerSetting(new OverrideSetting("MinMemAlloc", globalSettings->getSetting("MinMemAlloc")));
+ settings().registerSetting(new OverrideSetting("MaxMemAlloc", globalSettings->getSetting("MaxMemAlloc")));
+
+ // Auto login
+ settings().registerSetting(new OverrideSetting("AutoLogin", globalSettings->getSetting("AutoLogin")));
}
QString Instance::id() const
@@ -97,17 +125,7 @@ QString Instance::mcJar() const
return PathCombine(binDir(), "minecraft.jar");
}
-QVariant Instance::getField(const QString &name, QVariant defVal) const
-{
- return config.get(name, defVal);
-}
-
-void Instance::setField(const QString &name, QVariant val)
-{
- config.set(name, val);
-}
-
-SettingsObject &Instance::settings()
+SettingsObject &Instance::settings() const
{
- return *globalSettings;
+ return *m_settings;
}