summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/slider.cpp10
-rw-r--r--options/slider.hpp11
2 files changed, 9 insertions, 12 deletions
diff --git a/options/slider.cpp b/options/slider.cpp
index b64358c1..76d1dddc 100644
--- a/options/slider.cpp
+++ b/options/slider.cpp
@@ -71,11 +71,11 @@ int slider_value::to_slider_pos(int q_min, int q_max) const
return int(std::round(((cur() - min()) * q_diff / div) + q_min));
}
-} // end ns options
+} // ns options
-using slider_value = options::slider_value;
+using options::slider_value;
-QDataStream& operator << (QDataStream& out, const options::slider_value& v)
+QDataStream& operator << (QDataStream& out, const slider_value& v)
{
out << v.cur()
<< v.min()
@@ -83,13 +83,13 @@ QDataStream& operator << (QDataStream& out, const options::slider_value& v)
return out;
}
-QDebug operator << (QDebug dbg, const options::slider_value& v)
+QDebug operator << (QDebug dbg, const slider_value& v)
{
return dbg << QStringLiteral("slider_value(cur=%1, min=%2, max=%3)")
.arg(v.cur()).arg(v.min()).arg(v.max()).toUtf8().constData();
}
-QDataStream& operator >> (QDataStream& in, options::slider_value& v)
+QDataStream& operator >> (QDataStream& in, slider_value& v)
{
double cur = 0, min = 0, max = 0;
in >> cur >> min >> max;
diff --git a/options/slider.hpp b/options/slider.hpp
index abf39685..5d21bf0f 100644
--- a/options/slider.hpp
+++ b/options/slider.hpp
@@ -27,10 +27,7 @@ namespace options
template<typename t, typename u, typename v>
slider_value(t cur, u min, v max) :
- cur_(double(cur)),
- min_(double(min)),
- max_(double(max))
- {}
+ slider_value((double)cur, (double)min, (double)max) {}
slider_value& operator=(const slider_value& v) = default;
slider_value(const slider_value& v) = default;
@@ -39,9 +36,9 @@ namespace options
bool operator==(const slider_value& v) const;
bool operator!=(const slider_value& v) const;
constexpr operator double() const { return cur_; }
- double cur() const { return cur_; }
- double min() const { return min_; }
- double max() const { return max_; }
+ constexpr double cur() const { return cur_; }
+ constexpr double min() const { return min_; }
+ constexpr 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;
};