summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--options/base-value.cpp6
-rw-r--r--options/base-value.hpp6
-rw-r--r--options/connector.cpp4
-rw-r--r--options/value.hpp13
4 files changed, 10 insertions, 19 deletions
diff --git a/options/base-value.cpp b/options/base-value.cpp
index ec96fe6c..be18bbfd 100644
--- a/options/base-value.cpp
+++ b/options/base-value.cpp
@@ -13,13 +13,9 @@ value_::~value_()
b->on_value_destructed(this);
}
-void value_::notify() const
-{
- bundle_value_changed();
-}
-
namespace options::detail {
+// necessary due to circular dependency
void set_value_to_default(value_* val)
{
val->set_to_default();
diff --git a/options/base-value.hpp b/options/base-value.hpp
index 14eaeb10..7baff0b3 100644
--- a/options/base-value.hpp
+++ b/options/base-value.hpp
@@ -26,8 +26,6 @@ class OTR_OPTIONS_EXPORT value_ : public QObject
{
Q_OBJECT
- friend class detail::connector;
-
template<typename t>
using signal_sig = void(value_::*)(cv_qualified<t>) const;
@@ -91,10 +89,8 @@ public slots:
OTR_OPTIONS_SLOT(const QList<slider_value>&)
OTR_OPTIONS_SLOT(const QList<QPointF>&)
- virtual void bundle_value_changed() const = 0;
virtual void set_to_default() = 0;
-
- void notify() const;
+ virtual void notify() const = 0;
friend void ::options::detail::set_value_to_default(value_* val);
};
diff --git a/options/connector.cpp b/options/connector.cpp
index 838a2e0e..90770167 100644
--- a/options/connector.cpp
+++ b/options/connector.cpp
@@ -68,14 +68,14 @@ void connector::notify_values(const QString& name) const
auto it = connected_values.find(name);
if (it != connected_values.cend())
for (value_type val : it->second)
- val->bundle_value_changed();
+ val->notify();
}
void connector::notify_all_values() const
{
for (const auto& [k, v] : connected_values)
for (value_type val : v)
- val->bundle_value_changed();
+ val->notify();
}
} // ns options::detail
diff --git a/options/value.hpp b/options/value.hpp
index 3a58f74c..898f6b05 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -57,13 +57,6 @@ class value final : public value_
return traits::pass_value(traits::value_with_default(traits::value_from_qvariant(variant), def));
}
- friend class detail::connector;
- void bundle_value_changed() const override
- {
- if (!self_name.isEmpty())
- emit valueChanged(traits::storage_from_value(get()));
- }
-
void store_variant(const QVariant& value) override
{
if (self_name.isEmpty())
@@ -80,6 +73,12 @@ class value final : public value_
public:
cc_noinline
+ void notify() const override
+ {
+ if (!self_name.isEmpty())
+ emit valueChanged(traits::storage_from_value(get()));
+ }
+
value<u>& operator=(const t& datum)
{
store_variant(traits::qvariant_from_value(traits::pass_value(datum)));