diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2020-11-14 23:01:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-14 23:01:45 +0100 |
commit | e8d53072e489f061f9339f67ab59b386c779b7cd (patch) | |
tree | 870a760332ec24c33e35ef44cc65e6d7033410e2 /src/effects | |
parent | 6b63440d604c6935229a70d27000ed79fc43b333 (diff) | |
parent | 63b3b5224942bdc9add9f8ea3df9c3d51a338f3c (diff) |
Merge pull request #3306 from Holzhaus/clazy-old-style-connect-effects
effects: Replace old-style Qt connect() calls
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/effectchainslot.cpp | 100 | ||||
-rw-r--r-- | src/effects/effectchainslot.h | 4 | ||||
-rw-r--r-- | src/effects/effectparameterslot.cpp | 18 | ||||
-rw-r--r-- | src/effects/effectrack.cpp | 24 | ||||
-rw-r--r-- | src/effects/effectrack.h | 1 | ||||
-rw-r--r-- | src/effects/effectslot.cpp | 35 | ||||
-rw-r--r-- | src/effects/effectslot.h | 2 | ||||
-rw-r--r-- | src/effects/effectsmanager.cpp | 14 |
8 files changed, 117 insertions, 81 deletions
diff --git a/src/effects/effectchainslot.cpp b/src/effects/effectchainslot.cpp index 686cac6e83..277e63eaed 100644 --- a/src/effects/effectchainslot.cpp +++ b/src/effects/effectchainslot.cpp @@ -18,8 +18,10 @@ EffectChainSlot::EffectChainSlot(EffectRack* pRack, const QString& group, m_group(group), m_pEffectRack(pRack) { m_pControlClear = new ControlPushButton(ConfigKey(m_group, "clear")); - connect(m_pControlClear, SIGNAL(valueChanged(double)), - this, SLOT(slotControlClear(double))); + connect(m_pControlClear, + &ControlPushButton::valueChanged, + this, + &EffectChainSlot::slotControlClear); m_pControlNumEffects = new ControlObject(ConfigKey(m_group, "num_effects")); m_pControlNumEffects->setReadOnly(); @@ -35,38 +37,54 @@ EffectChainSlot::EffectChainSlot(EffectRack* pRack, const QString& group, // Default to enabled. The skin might not show these buttons. m_pControlChainEnabled->setDefaultValue(true); m_pControlChainEnabled->set(true); - connect(m_pControlChainEnabled, SIGNAL(valueChanged(double)), - this, SLOT(slotControlChainEnabled(double))); + connect(m_pControlChainEnabled, + &ControlPushButton::valueChanged, + this, + &EffectChainSlot::slotControlChainEnabled); m_pControlChainMix = new ControlPotmeter(ConfigKey(m_group, "mix"), 0.0, 1.0, false, true, false, true, 1.0); - connect(m_pControlChainMix, SIGNAL(valueChanged(double)), - this, SLOT(slotControlChainMix(double))); + connect(m_pControlChainMix, + &ControlPotmeter::valueChanged, + this, + &EffectChainSlot::slotControlChainMix); m_pControlChainSuperParameter = new ControlPotmeter(ConfigKey(m_group, "super1"), 0.0, 1.0); - connect(m_pControlChainSuperParameter, SIGNAL(valueChanged(double)), - this, SLOT(slotControlChainSuperParameter(double))); + connect(m_pControlChainSuperParameter, + &ControlPotmeter::valueChanged, + this, + [this](double value) { + slotControlChainSuperParameter(value, false); + }); m_pControlChainSuperParameter->set(0.0); m_pControlChainSuperParameter->setDefaultValue(0.0); m_pControlChainMixMode = new ControlPushButton(ConfigKey(m_group, "mix_mode")); m_pControlChainMixMode->setButtonMode(ControlPushButton::TOGGLE); m_pControlChainMixMode->setStates(static_cast<int>(EffectChainMixMode::NumMixModes)); - connect(m_pControlChainMixMode, SIGNAL(valueChanged(double)), - this, SLOT(slotControlChainMixMode(double))); + connect(m_pControlChainMixMode, + &ControlPushButton::valueChanged, + this, + &EffectChainSlot::slotControlChainMixMode); m_pControlChainNextPreset = new ControlPushButton(ConfigKey(m_group, "next_chain")); - connect(m_pControlChainNextPreset, SIGNAL(valueChanged(double)), - this, SLOT(slotControlChainNextPreset(double))); + connect(m_pControlChainNextPreset, + &ControlPushButton::valueChanged, + this, + &EffectChainSlot::slotControlChainNextPreset); m_pControlChainPrevPreset = new ControlPushButton(ConfigKey(m_group, "prev_chain")); - connect(m_pControlChainPrevPreset, SIGNAL(valueChanged(double)), - this, SLOT(slotControlChainPrevPreset(double))); + connect(m_pControlChainPrevPreset, + &ControlPushButton::valueChanged, + this, + &EffectChainSlot::slotControlChainPrevPreset); // Ignoring no-ops is important since this is for +/- tickers. m_pControlChainSelector = new ControlEncoder(ConfigKey(m_group, "chain_selector"), false); - connect(m_pControlChainSelector, SIGNAL(valueChanged(double)), - this, SLOT(slotControlChainSelector(double))); + connect(m_pControlChainSelector, + &ControlEncoder::valueChanged, + this, + &EffectChainSlot::slotControlChainSelector); // ControlObjects for skin <-> controller mapping interaction. // Refer to comment in header for full explanation. @@ -204,18 +222,32 @@ void EffectChainSlot::loadEffectChainToSlot(EffectChainPointer pEffectChain) { if (pEffectChain) { m_pEffectChain = pEffectChain; - connect(m_pEffectChain.data(), SIGNAL(effectChanged(unsigned int)), - this, SLOT(slotChainEffectChanged(unsigned int))); - connect(m_pEffectChain.data(), SIGNAL(nameChanged(const QString&)), - this, SLOT(slotChainNameChanged(const QString&))); - connect(m_pEffectChain.data(), SIGNAL(enabledChanged(bool)), - this, SLOT(slotChainEnabledChanged(bool))); - connect(m_pEffectChain.data(), SIGNAL(mixChanged(double)), - this, SLOT(slotChainMixChanged(double))); - connect(m_pEffectChain.data(), SIGNAL(mixModeChanged(EffectChainMixMode)), - this, SLOT(slotChainMixModeChanged(EffectChainMixMode))); - connect(m_pEffectChain.data(), SIGNAL(channelStatusChanged(const QString&, bool)), - this, SLOT(slotChainChannelStatusChanged(const QString&, bool))); + connect(m_pEffectChain.data(), + &EffectChain::effectChanged, + this, + [this](unsigned int value) { + slotChainEffectChanged(value, true); + }); + connect(m_pEffectChain.data(), + &EffectChain::nameChanged, + this, + &EffectChainSlot::slotChainNameChanged); + connect(m_pEffectChain.data(), + &EffectChain::enabledChanged, + this, + &EffectChainSlot::slotChainEnabledChanged); + connect(m_pEffectChain.data(), + &EffectChain::mixChanged, + this, + &EffectChainSlot::slotChainMixChanged); + connect(m_pEffectChain.data(), + &EffectChain::mixModeChanged, + this, + &EffectChainSlot::slotChainMixModeChanged); + connect(m_pEffectChain.data(), + &EffectChain::channelStatusChanged, + this, + &EffectChainSlot::slotChainChannelStatusChanged); m_pControlChainLoaded->forceSet(true); m_pControlChainMixMode->set( @@ -297,14 +329,10 @@ EffectSlotPointer EffectChainSlot::addEffectSlot(const QString& group) { EffectSlot* pEffectSlot = new EffectSlot(group, m_iChainSlotNumber, m_slots.size()); // Rebroadcast effectLoaded signals - connect(pEffectSlot, SIGNAL(effectLoaded(EffectPointer, unsigned int)), - this, SLOT(slotEffectLoaded(EffectPointer, unsigned int))); - connect(pEffectSlot, SIGNAL(clearEffect(unsigned int)), - this, SLOT(slotClearEffect(unsigned int))); - connect(pEffectSlot, SIGNAL(nextEffect(unsigned int, unsigned int, EffectPointer)), - this, SIGNAL(nextEffect(unsigned int, unsigned int, EffectPointer))); - connect(pEffectSlot, SIGNAL(prevEffect(unsigned int, unsigned int, EffectPointer)), - this, SIGNAL(prevEffect(unsigned int, unsigned int, EffectPointer))); + connect(pEffectSlot, &EffectSlot::effectLoaded, this, &EffectChainSlot::slotEffectLoaded); + connect(pEffectSlot, &EffectSlot::clearEffect, this, &EffectChainSlot::slotClearEffect); + connect(pEffectSlot, &EffectSlot::nextEffect, this, &EffectChainSlot::nextEffect); + connect(pEffectSlot, &EffectSlot::prevEffect, this, &EffectChainSlot::prevEffect); EffectSlotPointer pSlot(pEffectSlot); m_slots.append(pSlot); diff --git a/src/effects/effectchainslot.h b/src/effects/effectchainslot.h index 8df609772d..e9d4653934 100644 --- a/src/effects/effectchainslot.h +++ b/src/effects/effectchainslot.h @@ -94,7 +94,7 @@ class EffectChainSlot : public QObject { private slots: - void slotChainEffectChanged(unsigned int effectSlotNumber, bool shouldEmit=true); + void slotChainEffectChanged(unsigned int effectSlotNumber, bool shouldEmit); void slotChainNameChanged(const QString& name); void slotChainEnabledChanged(bool enabled); void slotChainMixChanged(double mix); @@ -108,7 +108,7 @@ class EffectChainSlot : public QObject { void slotControlClear(double v); void slotControlChainEnabled(double v); void slotControlChainMix(double v); - void slotControlChainSuperParameter(double v, bool force = false); + void slotControlChainSuperParameter(double v, bool force); void slotControlChainMixMode(double v); void slotControlChainSelector(double v); void slotControlChainNextPreset(double v); diff --git a/src/effects/effectparameterslot.cpp b/src/effects/effectparameterslot.cpp index ea351bf7cd..706416aa04 100644 --- a/src/effects/effectparameterslot.cpp +++ b/src/effects/effectparameterslot.cpp @@ -14,8 +14,10 @@ EffectParameterSlot::EffectParameterSlot(const QString& group, const unsigned in m_pControlValue = new ControlEffectKnob( ConfigKey(m_group, itemPrefix)); - connect(m_pControlValue, SIGNAL(valueChanged(double)), - this, SLOT(slotValueChanged(double))); + connect(m_pControlValue, + &ControlEffectKnob::valueChanged, + this, + &EffectParameterSlot::slotValueChanged); m_pControlLoaded = new ControlObject( ConfigKey(m_group, itemPrefix + QString("_loaded"))); @@ -36,8 +38,10 @@ EffectParameterSlot::EffectParameterSlot(const QString& group, const unsigned in m_pControlLinkInverse = new ControlPushButton( ConfigKey(m_group, itemPrefix + QString("_link_inverse"))); m_pControlLinkInverse->setButtonMode(ControlPushButton::TOGGLE); - connect(m_pControlLinkInverse, SIGNAL(valueChanged(double)), - this, SLOT(slotLinkInverseChanged(double))); + connect(m_pControlLinkInverse, + &ControlPushButton::valueChanged, + this, + &EffectParameterSlot::slotLinkInverseChanged); m_pSoftTakeover = new SoftTakeover(); @@ -93,8 +97,10 @@ void EffectParameterSlot::loadEffect(EffectPointer pEffect) { m_pControlLinkInverse->set( static_cast<double>(m_pEffectParameter->getDefaultLinkInversion())); - connect(m_pEffectParameter, SIGNAL(valueChanged(double)), - this, SLOT(slotParameterValueChanged(double))); + connect(m_pEffectParameter, + &EffectParameter::valueChanged, + this, + &EffectParameterSlot::slotParameterValueChanged); } } emit updated(); diff --git a/src/effects/effectrack.cpp b/src/effects/effectrack.cpp index 16d6db9e4f..7995d796e8 100644 --- a/src/effects/effectrack.cpp +++ b/src/effects/effectrack.cpp @@ -246,15 +246,11 @@ EffectChainSlotPointer StandardEffectRack::addEffectChainSlot() { getRackNumber(), iChainSlotNumber, i)); } - connect(pChainSlot, SIGNAL(nextChain(unsigned int, EffectChainPointer)), - this, SLOT(loadNextChain(unsigned int, EffectChainPointer))); - connect(pChainSlot, SIGNAL(prevChain(unsigned int, EffectChainPointer)), - this, SLOT(loadPrevChain(unsigned int, EffectChainPointer))); + connect(pChainSlot, &EffectChainSlot::nextChain, this, &StandardEffectRack::loadNextChain); + connect(pChainSlot, &EffectChainSlot::prevChain, this, &StandardEffectRack::loadPrevChain); - connect(pChainSlot, SIGNAL(nextEffect(unsigned int, unsigned int, EffectPointer)), - this, SLOT(loadNextEffect(unsigned int, unsigned int, EffectPointer))); - connect(pChainSlot, SIGNAL(prevEffect(unsigned int, unsigned int, EffectPointer)), - this, SLOT(loadPrevEffect(unsigned int, unsigned int, EffectPointer))); + connect(pChainSlot, &EffectChainSlot::nextEffect, this, &StandardEffectRack::loadNextEffect); + connect(pChainSlot, &EffectChainSlot::prevEffect, this, &StandardEffectRack::loadPrevEffect); // Register all the existing channels with the new EffectChain. const QSet<ChannelHandleAndGroup>& registeredChannels = @@ -283,15 +279,11 @@ OutputEffectRack::OutputEffectRack(EffectsManager* pEffectsManager, // Add a single EffectSlot for the master EQ effect pChainSlot->addEffectSlot("[OutputEffectRack_[Master]_Effect1]"); - connect(pChainSlot, SIGNAL(nextChain(unsigned int, EffectChainPointer)), - this, SLOT(loadNextChain(unsigned int, EffectChainPointer))); - connect(pChainSlot, SIGNAL(prevChain(unsigned int, EffectChainPointer)), - this, SLOT(loadPrevChain(unsigned int, EffectChainPointer))); + connect(pChainSlot, &EffectChainSlot::nextChain, this, &OutputEffectRack::loadNextChain); + connect(pChainSlot, &EffectChainSlot::prevChain, this, &OutputEffectRack::loadPrevChain); - connect(pChainSlot, SIGNAL(nextEffect(unsigned int, unsigned int, EffectPointer)), - this, SLOT(loadNextEffect(unsigned int, unsigned int, EffectPointer))); - connect(pChainSlot, SIGNAL(prevEffect(unsigned int, unsigned int, EffectPointer)), - this, SLOT(loadPrevEffect(unsigned int, unsigned int, EffectPointer))); + connect(pChainSlot, &EffectChainSlot::nextEffect, this, &OutputEffectRack::loadNextEffect); + connect(pChainSlot, &EffectChainSlot::prevEffect, this, &OutputEffectRack::loadPrevEffect); // Register the master channel. const ChannelHandleAndGroup* masterHandleAndGroup = nullptr; diff --git a/src/effects/effectrack.h b/src/effects/effectrack.h index 3bd8fd046b..a83c7ff3bb 100644 --- a/src/effects/effectrack.h +++ b/src/effects/effectrack.h @@ -55,7 +55,6 @@ class EffectRack : public QObject { public slots: void slotClearRack(double v); - private slots: void loadNextChain(const unsigned int iChainSlotNumber, EffectChainPointer pLoadedChain); void loadPrevChain(const unsigned int iChainSlotNumber, diff --git a/src/effects/effectslot.cpp b/src/effects/effectslot.cpp index 15ba19c74c..a93e09baf0 100644 --- a/src/effects/effectslot.cpp +++ b/src/effects/effectslot.cpp @@ -37,25 +37,29 @@ EffectSlot::EffectSlot(const QString& group, // at the beginning of a set. m_pControlEnabled = new ControlPushButton(ConfigKey(m_group, "enabled")); m_pControlEnabled->setButtonMode(ControlPushButton::POWERWINDOW); - connect(m_pControlEnabled, SIGNAL(valueChanged(double)), - this, SLOT(slotEnabled(double))); + connect(m_pControlEnabled, &ControlPushButton::valueChanged, this, &EffectSlot::slotEnabled); m_pControlNextEffect = new ControlPushButton(ConfigKey(m_group, "next_effect")); - connect(m_pControlNextEffect, SIGNAL(valueChanged(double)), - this, SLOT(slotNextEffect(double))); + connect(m_pControlNextEffect, + &ControlPushButton::valueChanged, + this, + &EffectSlot::slotNextEffect); m_pControlPrevEffect = new ControlPushButton(ConfigKey(m_group, "prev_effect")); - connect(m_pControlPrevEffect, SIGNAL(valueChanged(double)), - this, SLOT(slotPrevEffect(double))); + connect(m_pControlPrevEffect, + &ControlPushButton::valueChanged, + this, + &EffectSlot::slotPrevEffect); // Ignoring no-ops is important since this is for +/- tickers. m_pControlEffectSelector = new ControlEncoder(ConfigKey(m_group, "effect_selector"), false); - connect(m_pControlEffectSelector, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectSelector(double))); + connect(m_pControlEffectSelector, + &ControlEncoder::valueChanged, + this, + &EffectSlot::slotEffectSelector); m_pControlClear = new ControlPushButton(ConfigKey(m_group, "clear")); - connect(m_pControlClear, SIGNAL(valueChanged(double)), - this, SLOT(slotClear(double))); + connect(m_pControlClear, &ControlPushButton::valueChanged, this, &EffectSlot::slotClear); for (unsigned int i = 0; i < kDefaultMaxParameters; ++i) { addEffectParameterSlot(); @@ -63,8 +67,9 @@ EffectSlot::EffectSlot(const QString& group, } m_pControlMetaParameter = new ControlPotmeter(ConfigKey(m_group, "meta"), 0.0, 1.0); - connect(m_pControlMetaParameter, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectMetaParameter(double))); + connect(m_pControlMetaParameter, &ControlPotmeter::valueChanged, this, [this](double value) { + slotEffectMetaParameter(value, false); + }); m_pControlMetaParameter->set(0.0); m_pControlMetaParameter->setDefaultValue(0.0); @@ -164,8 +169,10 @@ void EffectSlot::loadEffect(EffectPointer pEffect, bool adoptMetaknobPosition) { // disabled, so if this EffectSlot was enabled, enable the Effect and EngineEffect. pEffect->setEnabled(m_pControlEnabled->toBool()); - connect(pEffect.data(), SIGNAL(enabledChanged(bool)), - this, SLOT(slotEffectEnabledChanged(bool))); + connect(pEffect.data(), + &Effect::enabledChanged, + this, + &EffectSlot::slotEffectEnabledChanged); while (static_cast<unsigned int>(m_parameters.size()) < pEffect->numKnobParameters()) { diff --git a/src/effects/effectslot.h b/src/effects/effectslot.h index 1afc2a7f7a..5db3a0aafe 100644 --- a/src/effects/effectslot.h +++ b/src/effects/effectslot.h @@ -81,7 +81,7 @@ class EffectSlot : public QObject { void slotClear(double v); void slotEffectSelector(double v); void slotEffectEnabledChanged(bool enabled); - void slotEffectMetaParameter(double v, bool force = false); + void slotEffectMetaParameter(double v, bool force); signals: // Indicates that the effect pEffect has been loaded into this diff --git a/src/effects/effectsmanager.cpp b/src/effects/effectsmanager.cpp index 522982acd2..5bd859d39c 100644 --- a/src/effects/effectsmanager.cpp +++ b/src/effects/effectsmanager.cpp @@ -91,11 +91,15 @@ void EffectsManager::addEffectsBackend(EffectsBackend* pBackend) { std::sort(m_availableEffectManifests.begin(), m_availableEffectManifests.end(), alphabetizeEffectManifests); - connect(pBackend, SIGNAL(effectRegistered(EffectManifestPointer)), - this, SLOT(slotBackendRegisteredEffect(EffectManifestPointer))); - - connect(pBackend, SIGNAL(effectRegistered(EffectManifestPointer)), - this, SIGNAL(availableEffectsUpdated(EffectManifestPointer))); + connect(pBackend, + &EffectsBackend::effectRegistered, + this, + &EffectsManager::slotBackendRegisteredEffect); + + connect(pBackend, + &EffectsBackend::effectRegistered, + this, + &EffectsManager::availableEffectsUpdated); } void EffectsManager::slotBackendRegisteredEffect(EffectManifestPointer pManifest) { |