summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2020-01-16 17:58:46 +0100
committerGitHub <noreply@github.com>2020-01-16 17:58:46 +0100
commit52c9145f3979d12866b0ee3e1a23eb19b72fb272 (patch)
tree9089515ead64a2d170752e0a6a4f5b87f030cbbc /src/control
parent11dd86ab24d54065e607d388df2efa2929563e35 (diff)
parent0bbf808b19d907e8b51026c7d2cecbd493fcc988 (diff)
Merge pull request #2446 from Holzhaus/clazy-fixes
Some Clazy Fixes
Diffstat (limited to 'src/control')
-rw-r--r--src/control/control.cpp4
-rw-r--r--src/control/controlindicator.cpp2
-rw-r--r--src/control/controlmodel.cpp2
-rw-r--r--src/control/controlobject.cpp2
-rw-r--r--src/control/controlobjectscript.h2
-rw-r--r--src/control/controlproxy.h58
6 files changed, 41 insertions, 29 deletions
diff --git a/src/control/control.cpp b/src/control/control.cpp
index f78f6b85a0..78f6484eb8 100644
--- a/src/control/control.cpp
+++ b/src/control/control.cpp
@@ -180,7 +180,7 @@ void ControlDoublePrivate::set(double value, QObject* pSender) {
return;
}
if (m_confirmRequired) {
- emit(valueChangeRequest(value));
+ emit valueChangeRequest(value);
} else {
setInner(value, pSender);
}
@@ -195,7 +195,7 @@ void ControlDoublePrivate::setInner(double value, QObject* pSender) {
return;
}
m_value.setValue(value);
- emit(valueChanged(value, pSender));
+ emit valueChanged(value, pSender);
if (m_bTrack) {
Stat::track(m_trackKey, static_cast<Stat::StatType>(m_trackType),
diff --git a/src/control/controlindicator.cpp b/src/control/controlindicator.cpp
index c2e225a89f..7a35b51370 100644
--- a/src/control/controlindicator.cpp
+++ b/src/control/controlindicator.cpp
@@ -22,7 +22,7 @@ ControlIndicator::~ControlIndicator() {
void ControlIndicator::setBlinkValue(enum BlinkValue bv) {
if (m_blinkValue != bv) {
m_blinkValue = bv; // must be set at first, to avoid timer toggle
- emit(blinkValueChanged());
+ emit blinkValueChanged();
}
}
diff --git a/src/control/controlmodel.cpp b/src/control/controlmodel.cpp
index 32bd034c5c..0ebfbad2be 100644
--- a/src/control/controlmodel.cpp
+++ b/src/control/controlmodel.cpp
@@ -97,7 +97,7 @@ bool ControlModel::setHeaderData(int section,
}
m_headerInfo[section][role] = value;
- emit(headerDataChanged(orientation, section, section));
+ emit headerDataChanged(orientation, section, section);
return true;
}
diff --git a/src/control/controlobject.cpp b/src/control/controlobject.cpp
index 6a20ea3c6b..db41618534 100644
--- a/src/control/controlobject.cpp
+++ b/src/control/controlobject.cpp
@@ -57,7 +57,7 @@ ControlObject::~ControlObject() {
void ControlObject::privateValueChanged(double dValue, QObject* pSender) {
// Only emit valueChanged() if we did not originate this change.
if (pSender != this) {
- emit(valueChanged(dValue));
+ emit valueChanged(dValue);
}
}
diff --git a/src/control/controlobjectscript.h b/src/control/controlobjectscript.h
index 217b93650d..853c1435cf 100644
--- a/src/control/controlobjectscript.h
+++ b/src/control/controlobjectscript.h
@@ -26,7 +26,7 @@ class ControlObjectScript : public ControlProxy {
// Called from update();
void emitValueChanged() override {
- emit(trigger(get(), this));
+ emit trigger(get(), this);
}
signals:
diff --git a/src/control/controlproxy.h b/src/control/controlproxy.h
index 405122c2d6..0e26436e98 100644
--- a/src/control/controlproxy.h
+++ b/src/control/controlproxy.h
@@ -30,9 +30,10 @@ class ControlProxy : public QObject {
return m_key;
}
- template <typename Receiver, typename Slot>
+ template<typename Receiver, typename Slot>
bool connectValueChanged(Receiver receiver,
- Slot func, Qt::ConnectionType requestedConnectionType = Qt::AutoConnection) {
+ Slot func,
+ Qt::ConnectionType requestedConnectionType = Qt::AutoConnection) {
if (!m_pControl) {
return false;
}
@@ -48,28 +49,18 @@ class ControlProxy : public QObject {
// requested: Queued -> COP = Queued / SCO = Auto
// requested: BlockingQueued -> Assert(false)
- auto copSlot = &ControlProxy::slotValueChangedAuto;
- Qt::ConnectionType copConnection;
Qt::ConnectionType scoConnection;
- switch(requestedConnectionType) {
+ switch (requestedConnectionType) {
case Qt::AutoConnection:
- copConnection = Qt::AutoConnection;
+ case Qt::QueuedConnection:
scoConnection = Qt::AutoConnection;
break;
case Qt::DirectConnection:
- copSlot = &ControlProxy::slotValueChangedDirect;
- copConnection = Qt::DirectConnection;
scoConnection = Qt::DirectConnection;
break;
- case Qt::QueuedConnection:
- copSlot = &ControlProxy::slotValueChangedQueued;
- copConnection = Qt::QueuedConnection;
- scoConnection = Qt::AutoConnection;
- break;
case Qt::BlockingQueuedConnection:
// We must not block the signal source by a blocking connection
- DEBUG_ASSERT(false);
- return false;
+ [[fallthrough]];
default:
DEBUG_ASSERT(false);
return false;
@@ -85,18 +76,39 @@ class ControlProxy : public QObject {
// use only explicit direct connection if requested
// the caller must not delete this until the all signals are
// processed to avoid segfaults
- connect(m_pControl.data(), &ControlDoublePrivate::valueChanged,
- this, copSlot,
- static_cast<Qt::ConnectionType>(copConnection | Qt::UniqueConnection));
+ Qt::ConnectionType copConnection = static_cast<Qt::ConnectionType>(
+ requestedConnectionType | Qt::UniqueConnection);
+
+ // clazy requires us to to pass a member function to connect() directly
+ // (i.e. w/o and intermediate variable) when used with
+ // Qt::UniqueConnection. Otherwise it detects a false positive and
+ // throws a [-Wclazy-lambda-unique-connection] warning.
+ switch (requestedConnectionType) {
+ case Qt::AutoConnection:
+ connect(m_pControl.data(), &ControlDoublePrivate::valueChanged, this, &ControlProxy::slotValueChangedAuto, copConnection);
+ break;
+ case Qt::DirectConnection:
+ connect(m_pControl.data(), &ControlDoublePrivate::valueChanged, this, &ControlProxy::slotValueChangedDirect, copConnection);
+ break;
+ case Qt::QueuedConnection:
+ connect(m_pControl.data(), &ControlDoublePrivate::valueChanged, this, &ControlProxy::slotValueChangedQueued, copConnection);
+ break;
+ default:
+ // Should be unreachable, but just to make sure ;-)
+ DEBUG_ASSERT(false);
+ return false;
+ }
return true;
}
// Called from update();
virtual void emitValueChanged() {
- emit(valueChanged(get()));
+ emit valueChanged(get());
}
- inline bool valid() const { return m_pControl != NULL; }
+ inline bool valid() const {
+ return m_pControl != NULL;
+ }
// Returns the value of the object. Thread safe, non-blocking.
inline double get() const {
@@ -162,7 +174,7 @@ class ControlProxy : public QObject {
void slotValueChangedDirect(double v, QObject* pSetter) {
if (pSetter != this) {
// This is base implementation of this function without scaling
- emit(valueChanged(v));
+ emit valueChanged(v);
}
}
@@ -170,7 +182,7 @@ class ControlProxy : public QObject {
void slotValueChangedAuto(double v, QObject* pSetter) {
if (pSetter != this) {
// This is base implementation of this function without scaling
- emit(valueChanged(v));
+ emit valueChanged(v);
}
}
@@ -178,7 +190,7 @@ class ControlProxy : public QObject {
void slotValueChangedQueued(double v, QObject* pSetter) {
if (pSetter != this) {
// This is base implementation of this function without scaling
- emit(valueChanged(v));
+ emit valueChanged(v);
}
}