summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/bundle.cpp4
-rw-r--r--options/bundle.hpp6
-rw-r--r--options/tie.hpp12
-rw-r--r--options/value.hpp23
4 files changed, 22 insertions, 23 deletions
diff --git a/options/bundle.cpp b/options/bundle.cpp
index 96291476..74e08eb9 100644
--- a/options/bundle.cpp
+++ b/options/bundle.cpp
@@ -199,12 +199,12 @@ OPENTRACK_OPTIONS_EXPORT bundler& singleton()
} // end options::detail
-OPENTRACK_OPTIONS_EXPORT std::shared_ptr<bundle_type> make_bundle(const QString& name)
+OPENTRACK_OPTIONS_EXPORT std::shared_ptr<bundle_> make_bundle(const QString& name)
{
if (name.size())
return detail::singleton().make_bundle(name);
else
- return std::make_shared<bundle_type>(QStringLiteral(""));
+ return std::make_shared<bundle_>(QStringLiteral(""));
}
QMutex* options::detail::bundle::get_mtx() const { return mtx; }
diff --git a/options/bundle.hpp b/options/bundle.hpp
index 2d7fa7f4..5bbe6f60 100644
--- a/options/bundle.hpp
+++ b/options/bundle.hpp
@@ -103,9 +103,9 @@ public:
OPENTRACK_OPTIONS_EXPORT bundler& singleton();
}
-using bundle_type = detail::bundle;
-using bundle = std::shared_ptr<bundle_type>;
+using bundle_ = detail::bundle;
+using bundle = std::shared_ptr<bundle_>;
-OPENTRACK_OPTIONS_EXPORT std::shared_ptr<bundle_type> make_bundle(const QString& name);
+OPENTRACK_OPTIONS_EXPORT std::shared_ptr<bundle_> make_bundle(const QString& name);
}
diff --git a/options/tie.hpp b/options/tie.hpp
index fcb4d60f..942c6098 100644
--- a/options/tie.hpp
+++ b/options/tie.hpp
@@ -131,8 +131,8 @@ inline void tie_setting(value<slider_value>& v, QSlider* w)
const int q_min = w->minimum();
const int q_max = w->maximum();
- w->setValue(v->to_slider_pos(q_min, q_max));
- v = v->update_from_slider(w->value(), q_min, q_max);
+ w->setValue(v().to_slider_pos(q_min, q_max));
+ v = v().update_from_slider(w->value(), q_min, q_max);
}
base_value::connect(w,
@@ -144,8 +144,8 @@ inline void tie_setting(value<slider_value>& v, QSlider* w)
{
const int q_min = w->minimum();
const int q_max = w->maximum();
- v = v->update_from_slider(pos, q_min, q_max);
- w->setValue(v->to_slider_pos(q_min, q_max));
+ v = v().update_from_slider(pos, q_min, q_max);
+ w->setValue(v().to_slider_pos(q_min, q_max));
});
},
v.DIRECT_CONNTYPE);
@@ -155,8 +155,8 @@ inline void tie_setting(value<slider_value>& v, QSlider* w)
[=, &v](double) {
const int q_min = w->minimum();
const int q_max = w->maximum();
- w->setValue(v->to_slider_pos(q_min, q_max));
- v = v->update_from_slider(w->value(), q_min, q_max);
+ w->setValue(v().to_slider_pos(q_min, q_max));
+ v = v().update_from_slider(w->value(), q_min, q_max);
},
v.SAFE_CONNTYPE);
}
diff --git a/options/value.hpp b/options/value.hpp
index 3c45bf15..01746d67 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -166,14 +166,6 @@ public:
{
}
- t get() const
- {
- t val = b->contains(self_name)
- ? static_cast<t>(b->get<element_type>(self_name))
- : def;
- return detail::value_get_traits<t>::get(val, def);
- }
-
t default_value() const
{
return def;
@@ -191,13 +183,20 @@ public:
emit valueChanged(static_cast<detail::value_type_t<t>>(get()));
}
- element_type const* operator->() const
+ element_type operator()() const
{
- static thread_local element_type last;
- last = get();
- return &last;
+ return get();
}
+
private:
+ t get() const
+ {
+ t val = b->contains(self_name)
+ ? static_cast<t>(b->get<element_type>(self_name))
+ : def;
+ return detail::value_get_traits<t>::get(val, def);
+ }
+
const t def;
};