summaryrefslogtreecommitdiffstats
path: root/logic/settings/OverrideSetting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'logic/settings/OverrideSetting.cpp')
-rw-r--r--logic/settings/OverrideSetting.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/logic/settings/OverrideSetting.cpp b/logic/settings/OverrideSetting.cpp
index e8a9bfff..25162dff 100644
--- a/logic/settings/OverrideSetting.cpp
+++ b/logic/settings/OverrideSetting.cpp
@@ -15,16 +15,40 @@
#include "OverrideSetting.h"
-OverrideSetting::OverrideSetting(std::shared_ptr<Setting> other)
+OverrideSetting::OverrideSetting(std::shared_ptr<Setting> other, std::shared_ptr<Setting> gate)
: Setting(other->configKeys(), QVariant())
{
+ Q_ASSERT(other);
+ Q_ASSERT(gate);
m_other = other;
+ m_gate = gate;
+}
+
+bool OverrideSetting::isOverriding() const
+{
+ return m_gate->get().toBool();
}
QVariant OverrideSetting::defValue() const
{
- if (m_other)
- return m_other->get();
- else
- return QVariant();
+ return m_other->get();
+}
+
+QVariant OverrideSetting::get() const
+{
+ if(isOverriding())
+ {
+ return Setting::get();
+ }
+ return m_other->get();
+}
+
+void OverrideSetting::reset()
+{
+ Setting::reset();
+}
+
+void OverrideSetting::set(QVariant value)
+{
+ Setting::set(value);
}