summaryrefslogtreecommitdiffstats
path: root/logic/settings/SettingsObject.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-05-04 01:20:48 +0200
committerPetr Mrázek <peterix@gmail.com>2015-05-04 01:20:48 +0200
commit1b884d0a9dc28d8bca38fe8756482d991d0ea850 (patch)
treefabe4350a3d64123ad0801fe7c285c2150f9562b /logic/settings/SettingsObject.cpp
parent8e9d5f56b592fd0dd0f54e747a835391a775120d (diff)
downloadMultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.tar
MultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.tar.gz
MultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.tar.lz
MultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.tar.xz
MultiMC-1b884d0a9dc28d8bca38fe8756482d991d0ea850.zip
GH-907 improve Java testing and PermGen deprecation handling
Diffstat (limited to 'logic/settings/SettingsObject.cpp')
-rw-r--r--logic/settings/SettingsObject.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/logic/settings/SettingsObject.cpp b/logic/settings/SettingsObject.cpp
index e88eae49..5e682cbf 100644
--- a/logic/settings/SettingsObject.cpp
+++ b/logic/settings/SettingsObject.cpp
@@ -16,6 +16,7 @@
#include "settings/SettingsObject.h"
#include "settings/Setting.h"
#include "settings/OverrideSetting.h"
+#include "PassthroughSetting.h"
#include <QDebug>
#include <QVariant>
@@ -44,6 +45,22 @@ std::shared_ptr<Setting> SettingsObject::registerOverride(std::shared_ptr<Settin
return override;
}
+std::shared_ptr<Setting> SettingsObject::registerPassthrough(std::shared_ptr<Setting> original,
+ std::shared_ptr<Setting> gate)
+{
+ if (contains(original->id()))
+ {
+ qCritical() << QString("Failed to register setting %1. ID already exists.")
+ .arg(original->id());
+ return nullptr; // Fail
+ }
+ auto passthrough = std::make_shared<PassthroughSetting>(original, gate);
+ passthrough->m_storage = this;
+ connectSignals(*passthrough);
+ m_settings.insert(passthrough->id(), passthrough);
+ return passthrough;
+}
+
std::shared_ptr<Setting> SettingsObject::registerSetting(QStringList synonyms, QVariant defVal)
{
if (synonyms.empty())