diff options
-rw-r--r-- | migration/20160917_00-accela.cpp | 2 | ||||
-rw-r--r-- | options/bundle.cpp | 4 | ||||
-rw-r--r-- | options/bundle.hpp | 6 | ||||
-rw-r--r-- | options/tie.hpp | 12 | ||||
-rw-r--r-- | options/value.hpp | 23 |
5 files changed, 23 insertions, 24 deletions
diff --git a/migration/20160917_00-accela.cpp b/migration/20160917_00-accela.cpp index 60104c24..aefe6dda 100644 --- a/migration/20160917_00-accela.cpp +++ b/migration/20160917_00-accela.cpp @@ -94,7 +94,7 @@ struct move_accela_to_sliders : migration tmp = val; } - value<slider_value> tmp(new_b, slider_name, slider_value(-1e6, s.rot_nonlinearity->min(), s.rot_nonlinearity->max())); + value<slider_value> tmp(new_b, slider_name, slider_value(-1e6, s.rot_nonlinearity().min(), s.rot_nonlinearity().max())); tmp = old_b->contains(slider_name) ? old_b->get<slider_value>(slider_name) : slider_value(1.1, 1, 1.75); 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; }; |