summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-10-27 17:20:06 +0100
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-10-27 17:30:51 +0100
commitc3cbb1d14186366f5d1d4c1100488f77df23c9c4 (patch)
tree0fbe6844a66301f3c6084d916b26ba0c385840cd /src/control
parent4897fa6b461c972928056880616591dda333c476 (diff)
Use ControlObject::toBool() method to fix -Wfloat-conversion errors
This fixes a bunch of warnigs regarding implicit casts from double to bool.
Diffstat (limited to 'src/control')
-rw-r--r--src/control/controlobject.cpp6
-rw-r--r--src/control/controlobject.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/control/controlobject.cpp b/src/control/controlobject.cpp
index 543046e576..c96a852b64 100644
--- a/src/control/controlobject.cpp
+++ b/src/control/controlobject.cpp
@@ -94,6 +94,12 @@ double ControlObject::get(const ConfigKey& key) {
return pCop ? pCop->get() : 0.0;
}
+// static
+bool ControlObject::toBool(const ConfigKey& key) {
+ const double value = ControlObject::get(key);
+ return (value != 0);
+}
+
double ControlObject::getParameter() const {
return m_pControl ? m_pControl->getParameter() : 0.0;
}
diff --git a/src/control/controlobject.h b/src/control/controlobject.h
index a3e247f846..b0c7cfaa72 100644
--- a/src/control/controlobject.h
+++ b/src/control/controlobject.h
@@ -86,6 +86,7 @@ class ControlObject : public QObject {
// Instantly returns the value of the ControlObject
static double get(const ConfigKey& key);
+ static bool toBool(const ConfigKey& key);
// Sets the ControlObject value. May require confirmation by owner.
inline void set(double value) {