diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-26 16:59:02 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-26 17:19:02 +0200 |
commit | 47dec53450dec0264489cddb0005e13593f43399 (patch) | |
tree | 4e2eb58b6b14b640f81d6f603adf54d191de0457 /opentrack-compat/options.cpp | |
parent | eeddec10f1f5a9374290438bab4abf246912e5ca (diff) |
compat/options: finish slider value support more
Diffstat (limited to 'opentrack-compat/options.cpp')
-rw-r--r-- | opentrack-compat/options.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/opentrack-compat/options.cpp b/opentrack-compat/options.cpp index 4f8da9f7..1c222ba0 100644 --- a/opentrack-compat/options.cpp +++ b/opentrack-compat/options.cpp @@ -201,7 +201,21 @@ pbundle bundle(const QString& name) return detail::singleton().bundle(name); } +slider_value::operator double() const +{ + return min + cur * (max-min); +} +slider_value slider_value::from_abs(double val, double min, double max) +{ + if (min > max) + min = max; + if (val < min) + val = min; + if (val > max) + val = max; + return slider_value((val - min) / (max - min), min, max); +} // end } |