diff options
Diffstat (limited to 'opentrack-compat/options.hpp')
-rw-r--r-- | opentrack-compat/options.hpp | 52 |
1 files changed, 1 insertions, 51 deletions
diff --git a/opentrack-compat/options.hpp b/opentrack-compat/options.hpp index 86c699d6..53249746 100644 --- a/opentrack-compat/options.hpp +++ b/opentrack-compat/options.hpp @@ -5,8 +5,6 @@ * copyright notice and this permission notice appear in all copies. */ -// XXX TODO this header is too long - #pragma once #include <memory> @@ -43,6 +41,7 @@ #include <QDebug> #include "export.hpp" +#include "slider.hpp" template<typename t> using mem = std::shared_ptr<t>; @@ -50,55 +49,6 @@ template<typename t> using mem = std::shared_ptr<t>; #define OPENTRACK_DEFAULT_CONFIG "default.ini" #define OPENTRACK_ORG "opentrack-2.3" -namespace options -{ - class OPENTRACK_COMPAT_EXPORT slider_value final - { - double cur_, min_, max_; - public: - slider_value(double cur, double min, double max); - slider_value(const slider_value& v); - slider_value(); - slider_value& operator=(const slider_value& v); - bool operator==(const slider_value& v) const; - operator double() const { return cur_; } - double cur() const { return cur_; } - double min() const { return min_; } - double max() const { return max_; } - slider_value update_from_slider(int pos, int q_min, int q_max) const; - int to_slider_pos(int q_min, int q_max) const; - }; -} - -QT_BEGIN_NAMESPACE - -inline QDebug operator << (QDebug dbg, const options::slider_value& val) -{ - return dbg << val.cur(); -} - -inline QDataStream& operator << (QDataStream& out, const options::slider_value& v) -{ - out << v.cur() - << v.min() - << v.max(); - return out; -} - -inline QDataStream& operator >> (QDataStream& in, options::slider_value& v) -{ - double cur, min, max; - in >> cur; - in >> min; - in >> max; - v = options::slider_value(cur, min, max); - return in; -} - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(options::slider_value) - namespace options { namespace { class custom_type_initializer |