From 2ab7121f08fe12b628848720bb432af43aca0175 Mon Sep 17 00:00:00 2001 From: Be Date: Sat, 5 Jan 2019 16:06:29 -0600 Subject: remove need for lambdas with connectValueChange(Request) and remove old SLOT syntax for ControlProxy::connectValueChangeRequest. That was easier than getting it to play nice with the templating required for the new functor syntax. --- src/control/control.cpp | 8 -- src/control/control.h | 10 +- src/control/controlindicator.cpp | 2 +- src/control/controlobject.cpp | 12 +-- src/control/controlobject.h | 12 ++- src/control/controlproxy.cpp | 137 ---------------------------- src/control/controlproxy.h | 77 +++++++++++++--- src/controllers/midi/midioutputhandler.cpp | 2 +- src/controllers/midi/midioutputhandler.h | 2 +- src/effects/effectparameterslot.cpp | 2 +- src/engine/bpmcontrol.cpp | 12 ++- src/engine/bpmcontrol.h | 4 +- src/engine/enginebuffer.cpp | 6 +- src/engine/enginedelay.cpp | 2 +- src/engine/enginetalkoverducking.cpp | 2 +- src/engine/keycontrol.cpp | 40 ++++---- src/engine/loopingcontrol.cpp | 2 +- src/engine/sync/internalclock.cpp | 2 +- src/engine/sync/synccontrol.cpp | 26 +++--- src/library/autodj/autodjprocessor.cpp | 4 +- src/library/columncache.cpp | 2 +- src/library/librarycontrol.cpp | 6 +- src/library/previewbuttondelegate.cpp | 2 +- src/mixer/basetrackplayer.cpp | 8 +- src/mixer/microphone.cpp | 2 +- src/mixer/playermanager.cpp | 10 +- src/preferences/dialog/dlgprefbroadcast.cpp | 4 +- src/preferences/dialog/dlgprefdeck.cpp | 4 +- src/preferences/dialog/dlgprefeq.cpp | 2 +- src/preferences/dialog/dlgprefsound.cpp | 8 +- src/preferences/dialog/dlgprefvinyl.cpp | 2 +- src/util/timer.cpp | 2 +- src/vinylcontrol/vinylcontrolmanager.cpp | 4 +- src/waveform/renderers/waveformmark.cpp | 6 -- src/waveform/renderers/waveformmark.h | 6 +- src/waveform/visualplayposition.cpp | 3 +- src/widget/controlwidgetconnection.cpp | 2 +- src/widget/wbeatspinbox.cpp | 2 +- src/widget/wkey.cpp | 4 +- src/widget/wmainmenubar.cpp | 2 +- src/widget/wnumberpos.cpp | 7 +- src/widget/wnumberrate.cpp | 6 +- src/widget/woverview.cpp | 11 +-- src/widget/wspinny.cpp | 15 ++- src/widget/wtracktableview.cpp | 2 +- src/widget/wwaveformviewer.cpp | 2 +- src/widget/wwidgetstack.cpp | 9 +- 47 files changed, 202 insertions(+), 295 deletions(-) diff --git a/src/control/control.cpp b/src/control/control.cpp index 2a29d83f90..f78f6b85a0 100644 --- a/src/control/control.cpp +++ b/src/control/control.cpp @@ -256,11 +256,3 @@ double ControlDoublePrivate::getMidiParameter() const { } return pBehavior->valueToMidiParameter(get()); } - -bool ControlDoublePrivate::connectValueChangeRequest(const QObject* receiver, - std::function method, Qt::ConnectionType type) { - // confirmation is only required if connect was successful - m_confirmRequired = connect(this, &ControlDoublePrivate::valueChangeRequest, - receiver, method, type); - return m_confirmRequired; -} diff --git a/src/control/control.h b/src/control/control.h index 596ea0a4f6..f0d87ec6eb 100644 --- a/src/control/control.h +++ b/src/control/control.h @@ -115,8 +115,14 @@ class ControlDoublePrivate : public QObject { // confirmed by setAndConfirm() or not. Note: Once connected, the CO value // itself is ONLY set by setAndConfirm() typically called in the connected // slot. - bool connectValueChangeRequest(const QObject* receiver, - std::function method, Qt::ConnectionType type); + template + bool connectValueChangeRequest(Receiver receiver, + Slot func, Qt::ConnectionType type) { + // confirmation is only required if connect was successful + m_confirmRequired = connect(this, &ControlDoublePrivate::valueChangeRequest, + receiver, func, type); + return m_confirmRequired; + } signals: // Emitted when the ControlDoublePrivate value changes. pSender is a diff --git a/src/control/controlindicator.cpp b/src/control/controlindicator.cpp index c3935f6403..fc18b845e2 100644 --- a/src/control/controlindicator.cpp +++ b/src/control/controlindicator.cpp @@ -9,7 +9,7 @@ ControlIndicator::ControlIndicator(ConfigKey key) // Tick time in audio buffer resolution m_pCOTGuiTickTime = new ControlProxy("[Master]", "guiTickTime", this); m_pCOTGuiTick50ms = new ControlProxy("[Master]", "guiTick50ms", this); - m_pCOTGuiTick50ms->connectValueChanged(SLOT(slotGuiTick50ms(double))); + m_pCOTGuiTick50ms->connectValueChanged(this, &ControlIndicator::slotGuiTick50ms); connect(this, SIGNAL(blinkValueChanged()), this, SLOT(slotBlinkValueChanged())); } diff --git a/src/control/controlobject.cpp b/src/control/controlobject.cpp index 75a6792671..57414d8881 100644 --- a/src/control/controlobject.cpp +++ b/src/control/controlobject.cpp @@ -117,18 +117,8 @@ void ControlObject::set(const ConfigKey& key, const double& value) { } } -bool ControlObject::connectValueChangeRequest(const QObject* receiver, - std::function method, - Qt::ConnectionType type) { - bool ret = false; - if (m_pControl) { - ret = m_pControl->connectValueChangeRequest(receiver, method, type); - } - return ret; -} - void ControlObject::setReadOnly() { - connectValueChangeRequest(this, [=](double value){readOnlyHandler(value);}, + connectValueChangeRequest(this, &ControlObject::readOnlyHandler, Qt::DirectConnection); } diff --git a/src/control/controlobject.h b/src/control/controlobject.h index 2902f82cef..1cd164b31f 100644 --- a/src/control/controlobject.h +++ b/src/control/controlobject.h @@ -151,9 +151,15 @@ class ControlObject : public QObject { // You need to use Qt::DirectConnection for the engine objects, since the // audio thread has no Qt event queue. But be a ware of race conditions in this case. // ref: http://qt-project.org/doc/qt-4.8/qt.html#ConnectionType-enum - bool connectValueChangeRequest(const QObject* receiver, - std::function method, - Qt::ConnectionType type = Qt::AutoConnection); + template + bool connectValueChangeRequest(Receiver receiver, Slot func, + Qt::ConnectionType type = Qt::AutoConnection) { + bool ret = false; + if (m_pControl) { + ret = m_pControl->connectValueChangeRequest(receiver, func, type); + } + return ret; + } // Installs a value-change request handler that ignores all sets. void setReadOnly(); diff --git a/src/control/controlproxy.cpp b/src/control/controlproxy.cpp index 1e4f6530ee..9434ed6e71 100644 --- a/src/control/controlproxy.cpp +++ b/src/control/controlproxy.cpp @@ -35,140 +35,3 @@ ControlProxy::~ControlProxy() { //qDebug() << "ControlProxy::~ControlProxy()"; } -bool ControlProxy::connectValueChanged(const QObject* receiver, - std::function method, Qt::ConnectionType requestedConnectionType) { - - if (!m_pControl) { - return false; - } - - // We connect to the - // ControlObjectPrivate only once and in a way that - // the requested ConnectionType is working as desired. - // We try to avoid direct connections if not requested - // since you cannot safely delete an object with a pending - // direct connection. This fixes bug Bug #1406124 - // requested: Auto -> COP = Auto / SCO = Auto - // requested: Direct -> COP = Direct / SCO = Direct - // requested: Queued -> COP = Queued / SCO = Auto - // requested: BlockingQueued -> Assert(false) - - std::function copSlot; - Qt::ConnectionType copConnection; - Qt::ConnectionType scoConnection; - switch(requestedConnectionType) { - case Qt::AutoConnection: - copSlot = [=](double value){slotValueChangedAuto(value, this);}; - copConnection = Qt::AutoConnection; - scoConnection = Qt::AutoConnection; - break; - case Qt::DirectConnection: - copSlot = [=](double value){slotValueChangedDirect(value, this);}; - copConnection = Qt::DirectConnection; - scoConnection = Qt::DirectConnection; - break; - case Qt::QueuedConnection: - copSlot = [=](double value){slotValueChangedQueued(value, this);}; - 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; - default: - DEBUG_ASSERT(false); - return false; - } - - if (!connect(this, &ControlProxy::valueChanged, receiver, method, scoConnection)) { - return false; - } - - // Connect to ControlObjectPrivate only if required. Do not allow - // duplicate connections. - - // 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(copConnection | Qt::UniqueConnection)); - return true; -} - -bool ControlProxy::connectValueChanged(const QObject* receiver, - const char* method, Qt::ConnectionType requestedConnectionType) { - - if (!m_pControl) { - return false; - } - - // We connect to the - // ControlObjectPrivate only once and in a way that - // the requested ConnectionType is working as desired. - // We try to avoid direct connections if not requested - // since you cannot safely delete an object with a pending - // direct connection. This fixes bug Bug #1406124 - // requested: Auto -> COP = Auto / SCO = Auto - // requested: Direct -> COP = Direct / SCO = Direct - // requested: Queued -> COP = Queued / SCO = Auto - // requested: BlockingQueued -> Assert(false) - - const char* copSlot; - Qt::ConnectionType copConnection; - Qt::ConnectionType scoConnection; - switch(requestedConnectionType) { - case Qt::AutoConnection: - copSlot = SLOT(slotValueChangedAuto(double, QObject*)); - copConnection = Qt::AutoConnection; - scoConnection = Qt::AutoConnection; - break; - case Qt::DirectConnection: - copSlot = SLOT(slotValueChangedDirect(double, QObject*)); - copConnection = Qt::DirectConnection; - scoConnection = Qt::DirectConnection; - break; - case Qt::QueuedConnection: - copSlot = SLOT(slotValueChangedQueued(double, QObject*)); - 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; - default: - DEBUG_ASSERT(false); - return false; - } - - if (!connect((QObject*)this, SIGNAL(valueChanged(double)), - receiver, method, scoConnection)) { - return false; - } - - // Connect to ControlObjectPrivate only if required. Do not allow - // duplicate connections. - - // 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(), SIGNAL(valueChanged(double, QObject*)), - this, copSlot, - static_cast(copConnection | Qt::UniqueConnection)); - return true; -} - -// connect to parent object -bool ControlProxy::connectValueChanged( - std::function method, Qt::ConnectionType type) { - DEBUG_ASSERT(parent() != NULL); - return connectValueChanged(parent(), method, type); -} - -bool ControlProxy::connectValueChanged( - const char* method, Qt::ConnectionType type) { - DEBUG_ASSERT(parent() != NULL); - return connectValueChanged(parent(), method, type); -} diff --git a/src/control/controlproxy.h b/src/control/controlproxy.h index a619cd0af6..4c72cce95a 100644 --- a/src/control/controlproxy.h +++ b/src/control/controlproxy.h @@ -30,17 +30,72 @@ class ControlProxy : public QObject { return m_key; } - bool connectValueChanged(const QObject* receiver, - std::function method, Qt::ConnectionType type = Qt::AutoConnection); - // for legacy SLOT syntax from Qt < 5. TODO: replace all uses with Qt 5 functor syntax - bool connectValueChanged(const QObject* receiver, - const char* method, Qt::ConnectionType type = Qt::AutoConnection); - - bool connectValueChanged( - std::function method, Qt::ConnectionType type = Qt::AutoConnection); - // for legacy SLOT syntax from Qt < 5. TODO: replace all uses with Qt 5 functor syntax - bool connectValueChanged( - const char* method, Qt::ConnectionType type = Qt::AutoConnection); + template + bool connectValueChanged(Receiver receiver, + Slot func, Qt::ConnectionType requestedConnectionType = Qt::AutoConnection) { + if (!m_pControl) { + return false; + } + + // We connect to the + // ControlObjectPrivate only once and in a way that + // the requested ConnectionType is working as desired. + // We try to avoid direct connections if not requested + // since you cannot safely delete an object with a pending + // direct connection. This fixes bug Bug #1406124 + // requested: Auto -> COP = Auto / SCO = Auto + // requested: Direct -> COP = Direct / SCO = Direct + // requested: Queued -> COP = Queued / SCO = Auto + // requested: BlockingQueued -> Assert(false) + + auto copSlot = &ControlProxy::slotValueChangedAuto; + Qt::ConnectionType copConnection; + Qt::ConnectionType scoConnection; + switch(requestedConnectionType) { + case Qt::AutoConnection: + copConnection = Qt::AutoConnection; + 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; + default: + DEBUG_ASSERT(false); + return false; + } + + if (!connect(this, &ControlProxy::valueChanged, receiver, func, scoConnection)) { + return false; + } + + // Connect to ControlObjectPrivate only if required. Do not allow + // duplicate connections. + + // 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(copConnection | Qt::UniqueConnection)); + return true; + } + // TODO: get the compiler to accept parent() for the receiver + //template + //bool connectValueChanged(Slot func, Qt::ConnectionType type = Qt::AutoConnection) { + // DEBUG_ASSERT(parent() != nullptr); + // return connectValueChanged(parent(), func, type); + //} // Called from update(); virtual void emitValueChanged() { diff --git a/src/controllers/midi/midioutputhandler.cpp b/src/controllers/midi/midioutputhandler.cpp index 0a69509cc2..6c3a045f65 100644 --- a/src/controllers/midi/midioutputhandler.cpp +++ b/src/controllers/midi/midioutputhandler.cpp @@ -19,7 +19,7 @@ MidiOutputHandler::MidiOutputHandler(MidiController* controller, m_mapping(mapping), m_cos(mapping.controlKey, this), m_lastVal(-1) { // -1 = virgin - m_cos.connectValueChanged(SLOT(controlChanged(double))); + m_cos.connectValueChanged(this, &MidiOutputHandler::controlChanged); } MidiOutputHandler::~MidiOutputHandler() { diff --git a/src/controllers/midi/midioutputhandler.h b/src/controllers/midi/midioutputhandler.h index c28ea8d3b6..9b1230b8e5 100644 --- a/src/controllers/midi/midioutputhandler.h +++ b/src/controllers/midi/midioutputhandler.h @@ -16,7 +16,7 @@ class MidiController; -class MidiOutputHandler : QObject { +class MidiOutputHandler : public QObject { Q_OBJECT public: MidiOutputHandler(MidiController* controller, diff --git a/src/effects/effectparameterslot.cpp b/src/effects/effectparameterslot.cpp index 7650aa2a47..d229d34176 100644 --- a/src/effects/effectparameterslot.cpp +++ b/src/effects/effectparameterslot.cpp @@ -31,7 +31,7 @@ EffectParameterSlot::EffectParameterSlot(const QString& group, const unsigned in m_pControlLinkType->setStates( static_cast(EffectManifestParameter::LinkType::NUM_LINK_TYPES)); m_pControlLinkType->connectValueChangeRequest( - this, [=](double value){slotLinkTypeChanging(value);}); + this, &EffectParameterSlot::slotLinkTypeChanging); m_pControlLinkInverse = new ControlPushButton( ConfigKey(m_group, itemPrefix + QString("_link_inverse"))); diff --git a/src/engine/bpmcontrol.cpp b/src/engine/bpmcontrol.cpp index e1240d85ef..013fe53213 100644 --- a/src/engine/bpmcontrol.cpp +++ b/src/engine/bpmcontrol.cpp @@ -38,14 +38,14 @@ BpmControl::BpmControl(QString group, m_pPlayButton = new ControlProxy(group, "play", this); m_pReverseButton = new ControlProxy(group, "reverse", this); m_pRateSlider = new ControlProxy(group, "rate", this); - m_pRateSlider->connectValueChanged([=](double value){slotUpdateEngineBpm();}, + m_pRateSlider->connectValueChanged(this, &BpmControl::slotUpdateEngineBpm, Qt::DirectConnection); m_pQuantize = ControlObject::getControl(group, "quantize"); m_pRateRange = new ControlProxy(group, "rateRange", this); - m_pRateRange->connectValueChanged([=](double value){slotUpdateRateSlider();}, + m_pRateRange->connectValueChanged(this, &BpmControl::slotUpdateRateSlider, Qt::DirectConnection); m_pRateDir = new ControlProxy(group, "rate_dir", this); - m_pRateDir->connectValueChanged([=](double value){slotUpdateEngineBpm();}, + m_pRateDir->connectValueChanged(this, &BpmControl::slotUpdateEngineBpm, Qt::DirectConnection); m_pPrevBeat.reset(new ControlProxy(group, "beat_prev")); @@ -733,13 +733,15 @@ double BpmControl::getPhaseOffset(double dThisPosition) { return dNewPlaypos - dThisPosition; } -void BpmControl::slotUpdateEngineBpm() { +void BpmControl::slotUpdateEngineBpm(double value) { + Q_UNUSED(value); // Adjust playback bpm in response to a change in the rate slider. double dRate = calcRateRatio(); m_pEngineBpm->set(m_pLocalBpm->get() * dRate); } -void BpmControl::slotUpdateRateSlider() { +void BpmControl::slotUpdateRateSlider(double value) { + Q_UNUSED(value); // Adjust rate slider position to reflect change in rate range. double localBpm = m_pLocalBpm->get(); double rateScale = m_pRateDir->get() * m_pRateRange->get(); diff --git a/src/engine/bpmcontrol.h b/src/engine/bpmcontrol.h index 5d53225aed..a715179ee0 100644 --- a/src/engine/bpmcontrol.h +++ b/src/engine/bpmcontrol.h @@ -83,8 +83,8 @@ class BpmControl : public EngineControl { void slotControlBeatSyncTempo(double); void slotTapFilter(double,int); void slotBpmTap(double); - void slotUpdateRateSlider(); - void slotUpdateEngineBpm(); + void slotUpdateRateSlider(double v = 0.0); + void slotUpdateEngineBpm(double v = 0.0); void slotUpdatedTrackBeats(); void slotBeatsTranslate(double); void slotBeatsTranslateMatchAlignment(double); diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index 6759bab800..1a7687230b 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -108,7 +108,7 @@ EngineBuffer::EngineBuffer(QString group, UserSettingsPointer pConfig, m_playButton = new ControlPushButton(ConfigKey(m_group, "play")); m_playButton->setButtonMode(ControlPushButton::TOGGLE); m_playButton->connectValueChangeRequest( - this, [=](double value){slotControlPlayRequest(value);}, + this, &EngineBuffer::slotControlPlayRequest, Qt::DirectConnection); //Play from Start Button (for sampler) @@ -167,7 +167,7 @@ EngineBuffer::EngineBuffer(QString group, UserSettingsPointer pConfig, m_pSampleRate = new ControlProxy("[Master]", "samplerate", this); m_pKeylockEngine = new ControlProxy("[Master]", "keylock_engine", this); - m_pKeylockEngine->connectValueChanged(SLOT(slotKeylockEngineChanged(double)), + m_pKeylockEngine->connectValueChanged(this, &EngineBuffer::slotKeylockEngineChanged, Qt::DirectConnection); m_pTrackSamples = new ControlObject(ConfigKey(m_group, "track_samples")); @@ -252,7 +252,7 @@ EngineBuffer::EngineBuffer(QString group, UserSettingsPointer pConfig, m_bScalerChanged = true; m_pPassthroughEnabled = new ControlProxy(group, "passthrough", this); - m_pPassthroughEnabled->connectValueChanged(SLOT(slotPassthroughChanged(double)), + m_pPassthroughEnabled->connectValueChanged(this, &EngineBuffer::slotPassthroughChanged, Qt::DirectConnection); #ifdef __SCALER_DEBUG__ diff --git a/src/engine/enginedelay.cpp b/src/engine/enginedelay.cpp index b1846beb64..71bc49b302 100644 --- a/src/engine/enginedelay.cpp +++ b/src/engine/enginedelay.cpp @@ -39,7 +39,7 @@ EngineDelay::EngineDelay(const char* group, ConfigKey delayControl, bool bPersis SLOT(slotDelayChanged()), Qt::DirectConnection); m_pSampleRate = new ControlProxy(group, "samplerate", this); - m_pSampleRate->connectValueChanged(SLOT(slotDelayChanged()), Qt::DirectConnection); + m_pSampleRate->connectValueChanged(this, &EngineDelay::slotDelayChanged, Qt::DirectConnection); } EngineDelay::~EngineDelay() { diff --git a/src/engine/enginetalkoverducking.cpp b/src/engine/enginetalkoverducking.cpp index 290db999fd..803f5f51d8 100644 --- a/src/engine/enginetalkoverducking.cpp +++ b/src/engine/enginetalkoverducking.cpp @@ -9,7 +9,7 @@ EngineTalkoverDucking::EngineTalkoverDucking( m_pConfig(pConfig), m_group(group) { m_pMasterSampleRate = new ControlProxy(m_group, "samplerate", this); - m_pMasterSampleRate->connectValueChanged(SLOT(slotSampleRateChanged(double)), + m_pMasterSampleRate->connectValueChanged(this, &EngineTalkoverDucking::slotSampleRateChanged, Qt::DirectConnection); m_pDuckStrength = new ControlPotmeter(ConfigKey(m_group, "duckStrength"), 0.0, 1.0); diff --git a/src/engine/keycontrol.cpp b/src/engine/keycontrol.cpp index 4924783f74..2d648e4f39 100644 --- a/src/engine/keycontrol.cpp +++ b/src/engine/keycontrol.cpp @@ -28,8 +28,8 @@ KeyControl::KeyControl(QString group, m_pPitch->setStepCount(12); // Fine adjust with semitone / 10 = 10 ct;. m_pPitch->setSmallStepCount(120); - connect(m_pPitch, SIGNAL(valueChanged(double)), - this, SLOT(slotPitchChanged(double)), + connect(m_pPitch, &ControlObject::valueChanged, + this, &KeyControl::slotPitchChanged, Qt::DirectConnection); // pitch_adjust is the distance to the linear pitch in semitones @@ -40,34 +40,34 @@ KeyControl::KeyControl(QString group, m_pPitchAdjust->setStepCount(6); // Fine adjust with semitone / 10 = 10 ct;. m_pPitchAdjust->setSmallStepCount(60); - connect(m_pPitchAdjust, SIGNAL(valueChanged(double)), - this, SLOT(slotPitchAdjustChanged(double)), + connect(m_pPitchAdjust, &ControlObject::valueChanged, + this, &KeyControl::slotPitchAdjustChanged, Qt::DirectConnection); m_pButtonSyncKey = new ControlPushButton(ConfigKey(group, "sync_key")); - connect(m_pButtonSyncKey, SIGNAL(valueChanged(double)), - this, SLOT(slotSyncKey(double)), + connect(m_pButtonSyncKey, &ControlObject::valueChanged, + this, &KeyControl::slotSyncKey, Qt::DirectConnection); m_pButtonResetKey = new ControlPushButton(ConfigKey(group, "reset_key")); - connect(m_pButtonResetKey, SIGNAL(valueChanged(double)), - this, SLOT(slotResetKey(double)), + connect(m_pButtonResetKey, &ControlObject::valueChanged, + this, &KeyControl::slotResetKey, Qt::DirectConnection); m_pFileKey = new ControlObject(ConfigKey(group, "file_key")); - connect(m_pFileKey, SIGNAL(valueChanged(double)), - this, SLOT(slotFileKeyChanged(double)), + connect(m_pFileKey, &ControlObject::valueChanged, + this, &KeyControl::slotFileKeyChanged, Qt::DirectConnection); m_pEngineKey = new ControlObject(ConfigKey(group, "key")); - connect(m_pEngineKey, SIGNAL(valueChanged(double)), - this, SLOT(slotSetEngineKey(double)), + connect(m_pEngineKey, &ControlObject::valueChanged, + this, &KeyControl::slotSetEngineKey, Qt::DirectConnection); m_pEngineKeyDistance = new ControlPotmeter(ConfigKey(group, "visual_key_distance"), -0.5, 0.5); - connect(m_pEngineKeyDistance, SIGNAL(valueChanged(double)), - this, SLOT(slotSetEngineKeyDistance(double)), + connect(m_pEngineKeyDistance, &ControlObject::valueChanged, + this, &KeyControl::slotSetEngineKeyDistance, Qt::DirectConnection); m_keylockMode = new ControlPushButton(ConfigKey(group, "keylockMode")); @@ -78,27 +78,27 @@ KeyControl::KeyControl(QString group, // In case of vinyl control "rate" is a filtered mean value for display m_pRateSlider = new ControlProxy(group, "rate", this); - m_pRateSlider->connectValueChanged(SLOT(slotRateChanged()), + m_pRateSlider->connectValueChanged(this, &KeyControl::slotRateChanged, Qt::DirectConnection); m_pRateRange = new ControlProxy(group, "rateRange", this); - m_pRateRange->connectValueChanged(SLOT(slotRateChanged()), + m_pRateRange->connectValueChanged(this, &KeyControl::slotRateChanged, Qt::DirectConnection); m_pRateDir = new ControlProxy(group, "rate_dir", this); - m_pRateDir->connectValueChanged(SLOT(slotRateChanged()), + m_pRateDir->connectValueChanged(this, &KeyControl::slotRateChanged, Qt::DirectConnection); m_pVCEnabled = new ControlProxy(group, "vinylcontrol_enabled", this); - m_pVCEnabled->connectValueChanged(SLOT(slotRateChanged()), + m_pVCEnabled->connectValueChanged(this, &KeyControl::slotRateChanged, Qt::DirectConnection); m_pVCRate = new ControlProxy(group, "vinylcontrol_rate", this); - m_pVCRate->connectValueChanged(SLOT(slotRateChanged()), + m_pVCRate->connectValueChanged(this, &KeyControl::slotRateChanged, Qt::DirectConnection); m_pKeylock = new ControlProxy(group, "keylock", this); - m_pKeylock->connectValueChanged(SLOT(slotRateChanged()), + m_pKeylock->connectValueChanged(this, &KeyControl::slotRateChanged, Qt::DirectConnection); } diff --git a/src/engine/loopingcontrol.cpp b/src/engine/loopingcontrol.cpp index d35b06b102..b19c10e93b 100644 --- a/src/engine/loopingcontrol.cpp +++ b/src/engine/loopingcontrol.cpp @@ -128,7 +128,7 @@ LoopingControl::LoopingControl(QString group, m_pCOBeatLoopSize = new ControlObject(ConfigKey(group, "beatloop_size"), true, false, false, 4.0); m_pCOBeatLoopSize->connectValueChangeRequest(this, - [=](double value){slotBeatLoopSizeChangeRequest(value);}, Qt::DirectConnection); + &LoopingControl::slotBeatLoopSizeChangeRequest, Qt::DirectConnection); m_pCOBeatLoopActivate = new ControlPushButton(ConfigKey(group, "beatloop_activate")); connect(m_pCOBeatLoopActivate, &ControlObject::valueChanged, this, &LoopingControl::slotBeatLoopToggle); diff --git a/src/engine/sync/internalclock.cpp b/src/engine/sync/internalclock.cpp index 06ad2e26d1..0cd009399b 100644 --- a/src/engine/sync/internalclock.cpp +++ b/src/engine/sync/internalclock.cpp @@ -36,7 +36,7 @@ InternalClock::InternalClock(const char* pGroup, SyncableListener* pEngineSync) new ControlPushButton(ConfigKey(pGroup, "sync_master"))); m_pSyncMasterEnabled->setButtonMode(ControlPushButton::TOGGLE); m_pSyncMasterEnabled->connectValueChangeRequest( - this, [=](double value){slotSyncMasterEnabledChangeRequest(value);}, + this, &InternalClock::slotSyncMasterEnabledChangeRequest, Qt::DirectConnection); } diff --git a/src/engine/sync/synccontrol.cpp b/src/engine/sync/synccontrol.cpp index 4ea442a9b8..eb7a0b2f8b 100644 --- a/src/engine/sync/synccontrol.cpp +++ b/src/engine/sync/synccontrol.cpp @@ -40,37 +40,37 @@ SyncControl::SyncControl(const QString& group, UserSettingsPointer pConfig, // Play button. We only listen to this to disable master if the deck is // stopped. m_pPlayButton = new ControlProxy(group, "play", this); - m_pPlayButton->connectValueChanged(SLOT(slotControlPlay(double)), + m_pPlayButton->connectValueChanged(this, &SyncControl::slotControlPlay, Qt::DirectConnection); m_pSyncMode.reset(new ControlPushButton(ConfigKey(group, "sync_mode"))); m_pSyncMode->setButtonMode(ControlPushButton::TOGGLE); m_pSyncMode->setStates(SYNC_NUM_MODES); m_pSyncMode->connectValueChangeRequest( - this, [=](double value){slotSyncModeChangeRequest(value);}, Qt::DirectConnection); + this, &SyncControl::slotSyncModeChangeRequest, Qt::DirectConnection); m_pSyncMasterEnabled.reset( new ControlPushButton(ConfigKey(group, "sync_master"))); m_pSyncMasterEnabled->setButtonMode(ControlPushButton::TOGGLE); m_pSyncMasterEnabled->connectValueChangeRequest( - this, [=](double value){slotSyncMasterEnabledChangeRequest(value);}, Qt::DirectConnection); + this, &SyncControl::slotSyncMasterEnabledChangeRequest, Qt::DirectConnection); m_pSyncEnabled.reset( new ControlPushButton(ConfigKey(group, "sync_enabled"))); m_pSyncEnabled->setButtonMode(ControlPushButton::LONGPRESSLATCHING); m_pSyncEnabled->connectValueChangeRequest( - this, [=](double value){slotSyncEnabledChangeRequest(value);}, Qt::DirectConnection); + this, &SyncControl::slotSyncEnabledChangeRequest, Qt::DirectConnection); m_pSyncBeatDistance.reset( new ControlObject(ConfigKey(group, "beat_distance"))); m_pPassthroughEnabled = new ControlProxy(group, "passthrough", this); - m_pPassthroughEnabled->connectValueChanged( - SLOT(slotPassthroughChanged(double)), Qt::DirectConnection); + m_pPassthroughEnabled->connectValueChanged(this, + &SyncControl::slotPassthroughChanged, Qt::DirectConnection); m_pEjectButton = new ControlProxy(group, "eject", this); - m_pEjectButton->connectValueChanged( - SLOT(slotEjectPushed(double)), Qt::DirectConnection); + m_pEjectButton->connectValueChanged(this, + &SyncControl::slotEjectPushed, Qt::DirectConnection); m_pQuantize = new ControlProxy(group, "quantize", this); @@ -93,19 +93,19 @@ void SyncControl::setEngineControls(RateControl* pRateControl, m_pLocalBpm = new ControlProxy(getGroup(), "local_bpm", this); m_pFileBpm = new ControlProxy(getGroup(), "file_bpm", this); - m_pFileBpm->connectValueChanged(SLOT(slotFileBpmChanged()), + m_pFileBpm->connectValueChanged(this, &SyncControl::slotFileBpmChanged, Qt::DirectConnection); m_pRateSlider = new ControlProxy(getGroup(), "rate", this); - m_pRateSlider->connectValueChanged(SLOT(slotRateChanged()), + m_pRateSlider->connectValueChanged(this, &SyncControl::slotRateChanged, Qt::DirectConnection); m_pRateDirection = new ControlProxy(getGroup(), "rate_dir", this); - m_pRateDirection->connectValueChanged(SLOT(slotRateChanged()), + m_pRateDirection->connectValueChanged(this, &SyncControl::slotRateChanged, Qt::DirectConnection); m_pRateRange = new ControlProxy(getGroup(), "rateRange", this); - m_pRateRange->connectValueChanged(SLOT(slotRateChanged()), + m_pRateRange->connectValueChanged(this, &SyncControl::slotRateChanged, Qt::DirectConnection); m_pSyncPhaseButton = new ControlProxy(getGroup(), "beatsync_phase", this); @@ -118,7 +118,7 @@ void SyncControl::setEngineControls(RateControl* pRateControl, // control doesn't exist yet. This will blow up immediately, won't go unnoticed. DEBUG_ASSERT(m_pVCEnabled->valid()); - m_pVCEnabled->connectValueChanged(SLOT(slotVinylControlChanged(double)), + m_pVCEnabled->connectValueChanged(this, &SyncControl::slotVinylControlChanged, Qt::DirectConnection); #endif } diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index e9b3c642dd..10e4c9035c 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -31,8 +31,8 @@ DeckAttributes::DeckAttributes(int index, this, SLOT(slotLoadingTrack(TrackPointer, TrackPointer))); connect(m_pPlayer, SIGNAL(playerEmpty()), this, SLOT(slotPlayerEmpty())); - m_playPos.connectValueChanged(this, SLOT(slotPlayPosChanged(double))); - m_play.connectValueChanged(this, SLOT(slotPlayChanged(double))); + m_playPos.connectValueChanged(this, &DeckAttributes::slotPlayPosChanged); + m_play.connectValueChanged(this, &DeckAttributes::slotPlayChanged); } DeckAttributes::~DeckAttributes() { diff --git a/src/library/columncache.cpp b/src/library/columncache.cpp index f3d2b2d2b3..891fa306ad 100644 --- a/src/library/columncache.cpp +++ b/src/library/columncache.cpp @@ -6,7 +6,7 @@ ColumnCache::ColumnCache(const QStringList& columns) { m_pKeyNotationCP = new ControlProxy("[Library]", "key_notation", this); - m_pKeyNotationCP->connectValueChanged(SLOT(slotSetKeySortOrder(double))); + m_pKeyNotationCP->connectValueChanged(this, &ColumnCache::slotSetKeySortOrder); // ColumnCache is initialized before the preferences, so slotSetKeySortOrder is called // for again if DlgPrefKey sets the [Library]. key_notation CO to a value other than diff --git a/src/library/librarycontrol.cpp b/src/library/librarycontrol.cpp index 117273d6d7..76ebb89268 100644 --- a/src/library/librarycontrol.cpp +++ b/src/library/librarycontrol.cpp @@ -57,9 +57,9 @@ LibraryControl::LibraryControl(Library* pLibrary) slotNumDecksChanged(m_numDecks.get()); slotNumSamplersChanged(m_numSamplers.get()); slotNumPreviewDecksChanged(m_numPreviewDecks.get()); - m_numDecks.connectValueChanged(SLOT(slotNumDecksChanged(double))); - m_numSamplers.connectValueChanged(SLOT(slotNumSamplersChanged(double))); - m_numPreviewDecks.connectValueChanged(SLOT(slotNumPreviewDecksChanged(double))); + m_numDecks.connectValueChanged(this, &LibraryControl::slotNumDecksChanged); + m_numSamplers.connectValueChanged(this, &LibraryControl::slotNumSamplersChanged); + m_numPreviewDecks.connectValueChanged(this, &LibraryControl::slotNumPreviewDecksChanged); // Controls to navigate vertically within currently focused widget (up/down buttons) m_pMoveUp = std::make_unique(ConfigKey("[Library]", "MoveUp")); diff --git a/src/library/previewbuttondelegate.cpp b/src/library/previewbuttondelegate.cpp index e8417800ff..a43f04f624 100644 --- a/src/library/previewbuttondelegate.cpp +++ b/src/library/previewbuttondelegate.cpp @@ -16,7 +16,7 @@ PreviewButtonDelegate::PreviewButtonDelegate(QTableView* parent, int column) m_column(column) { m_pPreviewDeckPlay = new ControlProxy( PlayerManager::groupForPreviewDeck(0), "play", this); - m_pPreviewDeckPlay->connectValueChanged(SLOT(previewDeckPlayChanged(double))); + m_pPreviewDeckPlay->connectValueChanged(this, &PreviewButtonDelegate::previewDeckPlayChanged); m_pCueGotoAndPlay = new ControlProxy( PlayerManager::groupForPreviewDeck(0), "cue_gotoandplay", this); diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index a47dce3bd4..9025ca12e2 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -43,10 +43,10 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent, m_pInputConfigured = std::make_unique(group, "input_configured", this); m_pPassthroughEnabled = std::make_unique(group, "passthrough", this); - m_pPassthroughEnabled->connectValueChanged(SLOT(slotPassthroughEnabled(double))); + m_pPassthroughEnabled->connectValueChanged(this, &BaseTrackPlayerImpl::slotPassthroughEnabled); #ifdef __VINYLCONTROL__ m_pVinylControlEnabled = std::make_unique(group, "vinylcontrol_enabled", this); - m_pVinylControlEnabled->connectValueChanged(SLOT(slotVinylControlEnabled(double))); + m_pVinylControlEnabled->connectValueChanged(this, &BaseTrackPlayerImpl::slotVinylControlEnabled); m_pVinylControlStatus = std::make_unique(group, "vinylcontrol_status", this); #endif @@ -81,7 +81,7 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent, m_pWaveformZoom = std::make_unique( ConfigKey(group, "waveform_zoom")); m_pWaveformZoom->connectValueChangeRequest( - this, [=](double value){slotWaveformZoomValueChangeRequest(value);}, + this, &BaseTrackPlayerImpl::slotWaveformZoomValueChangeRequest, Qt::DirectConnection); m_pWaveformZoom->set(1.0); m_pWaveformZoomUp = std::make_unique( @@ -108,7 +108,7 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent, m_pReplayGain = std::make_unique(group, "replaygain", this); m_pPlay = std::make_unique(group, "play", this); - m_pPlay->connectValueChanged(SLOT(slotPlayToggled(double))); + m_pPlay->connectValueChanged(this, &BaseTrackPlayerImpl::slotPlayToggled); } BaseTrackPlayerImpl::~BaseTrackPlayerImpl() { diff --git a/src/mixer/microphone.cpp b/src/mixer/microphone.cpp index 9e0de15791..33e5f5c21b 100644 --- a/src/mixer/microphone.cpp +++ b/src/mixer/microphone.cpp @@ -19,7 +19,7 @@ Microphone::Microphone(QObject* pParent, const QString& group, int index, m_pInputConfigured.reset(new ControlProxy(group, "input_configured", this)); m_pTalkoverEnabled.reset(new ControlProxy(group, "talkover", this)); - m_pTalkoverEnabled->connectValueChanged(SLOT(slotTalkoverEnabled(double))); + m_pTalkoverEnabled->connectValueChanged(this, &Microphone::slotTalkoverEnabled); } Microphone::~Microphone() { diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index 71a19706a8..3adb345af6 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -64,15 +64,15 @@ PlayerManager::PlayerManager(UserSettingsPointer pConfig, ConfigKey("[Master]", "num_auxiliaries"), true, true)), m_pTrackAnalysisScheduler(TrackAnalysisScheduler::NullPointer()) { m_pCONumDecks->connectValueChangeRequest(this, - [=](double value){slotChangeNumDecks(value);}, Qt::DirectConnection); + &PlayerManager::slotChangeNumDecks, Qt::DirectConnection); m_pCONumSamplers->connectValueChangeRequest(this, - [=](double value){slotChangeNumSamplers(value);}, Qt::DirectConnection); + &PlayerManager::slotChangeNumSamplers, Qt::DirectConnection); m_pCONumPreviewDecks->connectValueChangeRequest(this, - [=](double value){slotChangeNumPreviewDecks(value);}, Qt::DirectConnection); + &PlayerManager::slotChangeNumPreviewDecks, Qt::DirectConnection); m_pCONumMicrophones->connectValueChangeRequest(this, - [=](double value){slotChangeNumMicrophones(value);}, Qt::DirectConnection); + &PlayerManager::slotChangeNumMicrophones, Qt::DirectConnection); m_pCONumAuxiliaries->connectValueChangeRequest(this, - [=](double value){slotChangeNumAuxiliaries(value);}, Qt::DirectConnection); + &PlayerManager::slotChangeNumAuxiliaries, Qt::DirectConnection); // This is parented to the PlayerManager so does not need to be deleted m_pSamplerBank = new SamplerBank(this); diff --git a/src/preferences/dialog/dlgprefbroadcast.cpp b/src/preferences/dialog/dlgprefbroadcast.cpp index bf4db034ce..9885108732 100644 --- a/src/preferences/dialog/dlgprefbroadcast.cpp +++ b/src/preferences/dialog/dlgprefbroadcast.cpp @@ -89,8 +89,8 @@ DlgPrefBroadcast::DlgPrefBroadcast(QWidget *parent, m_pBroadcastEnabled = new ControlProxy( BROADCAST_PREF_KEY, "enabled", this); - m_pBroadcastEnabled->connectValueChanged( - SLOT(broadcastEnabledChanged(double))); + m_pBroadcastEnabled->connectValueChanged(this, + &DlgPrefBroadcast::broadcastEnabledChanged); //Server type combobox comboBoxServerType->addItem(tr("Icecast 2"), BROADCAST_SERVER_ICECAST2); diff --git a/src/preferences/dialog/dlgprefdeck.cpp b/src/preferences/dialog/dlgprefdeck.cpp index 0f73b68f3c..fb2059eb47 100644 --- a/src/preferences/dialog/dlgprefdeck.cpp +++ b/src/preferences/dialog/dlgprefdeck.cpp @@ -43,11 +43,11 @@ DlgPrefDeck::DlgPrefDeck(QWidget * parent, MixxxMainWindow * mixxx, setupUi(this); m_pNumDecks = new ControlProxy("[Master]", "num_decks", this); - m_pNumDecks->connectValueChanged(SLOT(slotNumDecksChanged(double))); + m_pNumDecks->connectValueChanged(this, [=](double value){slotNumDecksChanged(value);}); slotNumDecksChanged(m_pNumDecks->get(), true); m_pNumSamplers = new ControlProxy("[Master]", "num_samplers", this); - m_pNumSamplers->connectValueChanged(SLOT(slotNumSamplersChanged(double))); + m_pNumSamplers->connectValueChanged(this, [=](double value){slotNumSamplersChanged(value);}); slotNumSamplersChanged(m_pNumSamplers->get(), true); // Set default value in config file and control objects, if not present diff --git a/src/preferences/dialog/dlgprefeq.cpp b/src/preferences/dialog/dlgprefeq.cpp index 2ea1dc9f21..90edfaac20 100644 --- a/src/preferences/dialog/dlgprefeq.cpp +++ b/src/preferences/dialog/dlgprefeq.cpp @@ -82,7 +82,7 @@ DlgPrefEQ::DlgPrefEQ(QWidget* pParent, EffectsManager* pEffectsManager, // Add drop down lists for current decks and connect num_decks control // to slotNumDecksChanged m_pNumDecks = new ControlProxy("[Master]", "num_decks", this); - m_pNumDecks->connectValueChanged(SLOT(slotNumDecksChanged(double))); + m_pNumDecks->connectValueChanged(this, &DlgPrefEQ::slotNumDecksChanged); slotNumDecksChanged(m_pNumDecks->get()); setUpMasterEQ(); diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index e20a567dc0..27771382de 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -152,10 +152,10 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, SoundManager* pSoundManager, m_pMasterAudioLatencyOverloadCount = new ControlProxy("[Master]", "audio_latency_overload_count", this); - m_pMasterAudioLatencyOverloadCount->connectValueChanged(SLOT(bufferUnderflow(double))); + m_pMasterAudioLatencyOverloadCount->connectValueChanged(this, &DlgPrefSound::bufferUnderflow); m_pMasterLatency = new ControlProxy("[Master]", "latency", this); - m_pMasterLatency->connectValueChanged(SLOT(masterLatencyChanged(double))); + m_pMasterLatency->connectValueChanged(this, &DlgPrefSound::masterLatencyChanged); // TODO: remove this option by automatically disabling/enabling the master mix // when recording, broadcasting, headphone, and master outputs are enabled/disabled @@ -165,7 +165,7 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, SoundManager* pSoundManager, masterMixComboBox->setCurrentIndex(m_pMasterEnabled->get() ? 1 : 0); connect(masterMixComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(masterMixChanged(int))); - m_pMasterEnabled->connectValueChanged(SLOT(masterEnabledChanged(double))); + m_pMasterEnabled->connectValueChanged(this, &DlgPrefSound::masterEnabledChanged); m_pMasterMonoMixdown = new ControlProxy("[Master]", "mono_mixdown", this); masterOutputModeComboBox->addItem(tr("Stereo")); @@ -173,7 +173,7 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, SoundManager* pSoundManager, masterOutputModeComboBox->setCurrentIndex(m_pMasterMonoMixdown->get() ? 1 : 0); connect(masterOutputModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(masterOutputModeComboBoxChanged(int))); - m_pMasterMonoMixdown->connectValueChanged(SLOT(masterMonoMixdownChanged(double))); + m_pMasterMonoMixdown->connectValueChanged(this, &DlgPrefSound::masterMonoMixdownChanged); m_pKeylockEngine = new ControlProxy("[Master]", "keylock_engine", this); diff --git a/src/preferences/dialog/dlgprefvinyl.cpp b/src/preferences/dialog/dlgprefvinyl.cpp index 333ddcbbf4..1dc828c958 100644 --- a/src/preferences/dialog/dlgprefvinyl.cpp +++ b/src/preferences/dialog/dlgprefvinyl.cpp @@ -35,7 +35,7 @@ DlgPrefVinyl::DlgPrefVinyl(QWidget * parent, VinylControlManager *pVCMan, m_pVCManager(pVCMan), config(_config) { m_pNumDecks = new ControlProxy("[Master]", "num_decks", this); - m_pNumDecks->connectValueChanged(SLOT(slotNumDecksChanged(double))); + m_pNumDecks->connectValueChanged(this, &DlgPrefVinyl::slotNumDecksChanged); setupUi(this); diff --git a/src/util/timer.cpp b/src/util/timer.cpp index e916065228..648a66198f 100644 --- a/src/util/timer.cpp +++ b/src/util/timer.cpp @@ -88,7 +88,7 @@ GuiTickTimer::GuiTickTimer(QObject* pParent) } void GuiTickTimer::start(mixxx::Duration duration) { - m_pGuiTick->connectValueChanged(SLOT(slotGuiTick(double))); + m_pGuiTick->connectValueChanged(this, &GuiTickTimer::slotGuiTick); m_interval = duration; m_lastUpdate = mixxx::Duration::fromSeconds(0); m_bActive = true; diff --git a/src/vinylcontrol/vinylcontrolmanager.cpp b/src/vinylcontrol/vinylcontrolmanager.cpp index b902e21a46..d438a510ef 100644 --- a/src/vinylcontrol/vinylcontrolmanager.cpp +++ b/src/vinylcontrol/vinylcontrolmanager.cpp @@ -55,7 +55,7 @@ VinylControlManager::~VinylControlManager() { void VinylControlManager::init() { m_pNumDecks = new ControlProxy("[Master]", "num_decks", this); - m_pNumDecks->connectValueChanged(SLOT(slotNumDecksChanged(double))); + m_pNumDecks->connectValueChanged(this, &VinylControlManager::slotNumDecksChanged); slotNumDecksChanged(m_pNumDecks->get()); } @@ -88,7 +88,7 @@ void VinylControlManager::slotNumDecksChanged(double dNumDecks) { QString group = PlayerManager::groupForDeck(i); ControlProxy* pEnabled = new ControlProxy(group, "vinylcontrol_enabled", this); m_pVcEnabled.push_back(pEnabled); - pEnabled->connectValueChanged(&m_vinylControlEnabledMapper, SLOT(map())); + pEnabled->connectValueChanged(&m_vinylControlEnabledMapper, QOverload::of(&QSignalMapper::mapped)); m_vinylControlEnabledMapper.setMapping(pEnabled, i); // Default cueing should be off. diff --git a/src/waveform/renderers/waveformmark.cpp b/src/waveform/renderers/waveformmark.cpp index afa057153d..1bebe75323 100644 --- a/src/waveform/renderers/waveformmark.cpp +++ b/src/waveform/renderers/waveformmark.cpp @@ -32,9 +32,3 @@ WaveformMark::WaveformMark(const QString& group, } m_properties = WaveformMarkProperties(node, context, signalColors, hotCue); } - - -void WaveformMark::connectSamplePositionChanged(const QObject *obj, const char *slt) const { - m_pPointCos->connectValueChanged(obj, slt, Qt::AutoConnection); -} - diff --git a/src/waveform/renderers/waveformmark.h b/src/waveform/renderers/waveformmark.h index 76f99d7d05..2ab5e3091e 100644 --- a/src/waveform/renderers/waveformmark.h +++ b/src/waveform/renderers/waveformmark.h @@ -47,7 +47,11 @@ class WaveformMark { //The m_pPointCos related function bool isValid() const { return m_pPointCos && m_pPointCos->valid(); } - void connectSamplePositionChanged(const QObject *, const char *) const; + + template + void connectSamplePositionChanged(Receiver receiver, Slot slot) const { + m_pPointCos->connectValueChanged(receiver, slot, Qt::AutoConnection); + }; double getSamplePosition() const { return m_pPointCos->get(); } QString getItem() const { return m_pPointCos->getKey().item; } diff --git a/src/waveform/visualplayposition.cpp b/src/waveform/visualplayposition.cpp index 73cf2d1554..e32ec84f42 100644 --- a/src/waveform/visualplayposition.cpp +++ b/src/waveform/visualplayposition.cpp @@ -26,8 +26,7 @@ VisualPlayPosition::VisualPlayPosition(const QString& key) m_key(key) { m_audioBufferSize = new ControlProxy( "[Master]", "audio_buffer_size", this); - m_audioBufferSize->connectValueChanged( - SLOT(slotAudioBufferSizeChanged(double))); + m_audioBufferSize->connectValueChanged(this, &VisualPlayPosition::slotAudioBufferSizeChanged); m_audioBufferMicros = static_cast(m_audioBufferSize->get() * kMicrosPerMillis); } diff --git a/src/widget/controlwidgetconnection.cpp b/src/widget/controlwidgetconnection.cpp index c2c486f820..9348492034 100644 --- a/src/widget/controlwidgetconnection.cpp +++ b/src/widget/controlwidgetconnection.cpp @@ -13,7 +13,7 @@ ControlWidgetConnection::ControlWidgetConnection( : m_pWidget(pBaseWidget), m_pValueTransformer(pTransformer) { m_pControl = new ControlProxy(key, this); - m_pControl->connectValueChanged(SLOT(slotControlValueChanged(double))); + m_pControl->connectValueChanged(this, &ControlWidgetConnection::slotControlValueChanged); } void ControlWidgetConnection::setControlParameter(double parameter) { diff --git a/src/widget/wbeatspinbox.cpp b/src/widget/wbeatspinbox.cpp index 90d213cee7..17b142311c 100644 --- a/src/widget/wbeatspinbox.cpp +++ b/src/widget/wbeatspinbox.cpp @@ -27,7 +27,7 @@ WBeatSpinBox::WBeatSpinBox(QWidget* parent, const ConfigKey& configKey, setValue(m_valueControl.get()); connect(this, SIGNAL(valueChanged(double)), this, SLOT(slotSpinboxValueChanged(double))); - m_valueControl.connectValueChanged(SLOT(slotControlValueChanged(double))); + m_valueControl.connectValueChanged(this, &WBeatSpinBox::slotControlValueChanged); } void WBeatSpinBox::setup(const QDomNode& node, const SkinContext& context) { diff --git a/src/widget/wkey.cpp b/src/widget/wkey.cpp index 1fabb15fd0..91b73710cd 100644 --- a/src/widget/wkey.cpp +++ b/src/widget/wkey.cpp @@ -8,8 +8,8 @@ WKey::WKey(const char* group, QWidget* pParent) m_preferencesUpdated("[Preferences]", "updated", this), m_engineKeyDistance(group, "visual_key_distance", this) { setValue(m_dOldValue); - m_preferencesUpdated.connectValueChanged(SLOT(preferencesUpdated(double))); - m_engineKeyDistance.connectValueChanged(SLOT(setCents())); + m_preferencesUpdated.connectValueChanged(this, &WKey::preferencesUpdated); + m_engineKeyDistance.connectValueChanged(this, &WKey::setCents); } void WKey::onConnectedControlChanged(double dParameter, double dValue) { diff --git a/src/widget/wmainmenubar.cpp b/src/widget/wmainmenubar.cpp index 992bdc8998..e959993758 100644 --- a/src/widget/wmainmenubar.cpp +++ b/src/widget/wmainmenubar.cpp @@ -697,7 +697,7 @@ void VisibilityControlConnection::slotClearControl() { void VisibilityControlConnection::slotReconnectControl() { m_pControl.reset(new ControlProxy(this)); m_pControl->initialize(m_key, false); - m_pControl->connectValueChanged(SLOT(slotControlChanged())); + m_pControl->connectValueChanged(this, &VisibilityControlConnection::slotControlChanged); m_pAction->setEnabled(m_pControl->valid()); slotControlChanged(); } diff --git a/src/widget/wnumberpos.cpp b/src/widget/wnumberpos.cpp index bf96024ec4..f7f833bcdf 100644 --- a/src/widget/wnumberpos.cpp +++ b/src/widget/wnumberpos.cpp @@ -12,14 +12,13 @@ WNumberPos::WNumberPos(const char* group, QWidget* parent) : WNumber(parent), m_dOldTimeElapsed(0.0) { m_pTimeElapsed = new ControlProxy(group, "time_elapsed", this); - m_pTimeElapsed->connectValueChanged(SLOT(slotSetTimeElapsed(double))); + m_pTimeElapsed->connectValueChanged(this, &WNumberPos::slotSetTimeElapsed); m_pTimeRemaining = new ControlProxy(group, "time_remaining", this); - m_pTimeRemaining->connectValueChanged(SLOT(slotTimeRemainingUpdated(double))); + m_pTimeRemaining->connectValueChanged(this, &WNumberPos::slotTimeRemainingUpdated); m_pShowTrackTimeRemaining = new ControlProxy( "[Controls]", "ShowDurationRemaining", this); - m_pShowTrackTimeRemaining->connectValueChanged( - SLOT(slotSetDisplayMode(double))); + m_pShowTrackTimeRemaining->connectValueChanged(this, &WNumberPos::slotSetDisplayMode); slotSetDisplayMode(m_pShowTrackTimeRemaining->get()); } diff --git a/src/widget/wnumberrate.cpp b/src/widget/wnumberrate.cpp index 34a65d159c..84dd888c34 100644 --- a/src/widget/wnumberrate.cpp +++ b/src/widget/wnumberrate.cpp @@ -19,11 +19,11 @@ WNumberRate::WNumberRate(const char * group, QWidget * parent) : WNumber(parent) { m_pRateRangeControl = new ControlProxy(group, "rateRange", this); - m_pRateRangeControl->connectValueChanged(SLOT(setValue(double))); + m_pRateRangeControl->connectValueChanged(this, &WNumberRate::setValue); m_pRateDirControl = new ControlProxy(group, "rate_dir", this); - m_pRateDirControl->connectValueChanged(SLOT(setValue(double))); + m_pRateDirControl->connectValueChanged(this, &WNumberRate::setValue); m_pRateControl = new ControlProxy(group, "rate", this); - m_pRateControl->connectValueChanged(SLOT(setValue(double))); + m_pRateControl->connectValueChanged(this, &WNumberRate::setValue); // Initialize the widget. setValue(0); } diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index c078d0c518..58abba5094 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -57,8 +57,7 @@ WOverview::WOverview( m_scaleFactor(1.0) { m_endOfTrackControl = new ControlProxy( m_group, "end_of_track", this); - m_endOfTrackControl->connectValueChanged( - SLOT(onEndOfTrackChange(double))); + m_endOfTrackControl->connectValueChanged(this, &WOverview::onEndOfTrackChange); m_trackSamplesControl = new ControlProxy(m_group, "track_samples", this); m_playControl = new ControlProxy(m_group, "play", this); @@ -96,7 +95,7 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) { for (const auto& pMark: m_marks) { if (pMark->isValid()) { pMark->connectSamplePositionChanged(this, - SLOT(onMarkChanged(double))); + &WOverview::onMarkChanged); } } @@ -109,15 +108,15 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) { if (markRange.m_markEnabledControl) { markRange.m_markEnabledControl->connectValueChanged( - this, SLOT(onMarkRangeChange(double))); + this, &WOverview::onMarkRangeChange); } if (markRange.m_markStartPointControl) { markRange.m_markStartPointControl->connectValueChanged( - this, SLOT(onMarkRangeChange(double))); + this, &WOverview::onMarkRangeChange); } if (markRange.m_markEndPointControl) { markRange.m_markEndPointControl->connectValueChanged( - this, SLOT(onMarkRangeChange(double))); + this, &WOverview::onMarkRangeChange); } } child = child.nextSibling(); diff --git a/src/widget/wspinny.cpp b/src/widget/wspinny.cpp index c59ad60597..1a5272d158 100644 --- a/src/widget/wspinny.cpp +++ b/src/widget/wspinny.cpp @@ -199,8 +199,7 @@ void WSpinny::setup(const QDomNode& node, const SkinContext& context) { m_pSlipEnabled = new ControlProxy( m_group, "slip_enabled", this); - m_pSlipEnabled->connectValueChanged( - SLOT(updateSlipEnabled(double))); + m_pSlipEnabled->connectValueChanged(this, &WSpinny::updateSlipEnabled); #ifdef __VINYLCONTROL__ m_pVinylControlSpeedType = new ControlProxy( @@ -210,18 +209,18 @@ void WSpinny::setup(const QDomNode& node, const SkinContext& context) { m_pVinylControlEnabled = new ControlProxy( m_group, "vinylcontrol_enabled", this); - m_pVinylControlEnabled->connectValueChanged( - SLOT(updateVinylControlEnabled(double))); + m_pVinylControlEnabled->connectValueChanged(this, + &WSpinny::updateVinylControlEnabled); m_pSignalEnabled = new ControlProxy( m_group, "vinylcontrol_signal_enabled", this); - m_pSignalEnabled->connectValueChanged( - SLOT(updateVinylControlSignalEnabled(double))); + m_pSignalEnabled->connectValueChanged(this, + &WSpinny::updateVinylControlSignalEnabled); // Match the vinyl control's set RPM so that the spinny widget rotates at // the same speed as your physical decks, if you're using vinyl control. - m_pVinylControlSpeedType->connectValueChanged( - SLOT(updateVinylControlSpeed(double))); + m_pVinylControlSpeedType->connectValueChanged(this, + &WSpinny::updateVinylControlSpeed); #else diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 402ce25c57..511b164762 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -122,7 +122,7 @@ WTrackTableView::WTrackTableView(QWidget * parent, this, SLOT(updateSelectionCrates(QWidget *))); m_pCOTGuiTick = new ControlProxy("[Master]", "guiTick50ms", this); - m_pCOTGuiTick->connectValueChanged(SLOT(slotGuiTick50ms(double))); + m_pCOTGuiTick->connectValueChanged(this, &WTrackTableView::slotGuiTick50ms); connect(this, SIGNAL(scrollValueChanged(int)), this, SLOT(slotScrollValueChanged(int))); diff --git a/src/widget/wwaveformviewer.cpp b/src/widget/wwaveformviewer.cpp index cb8e4b4dfb..5074825475 100644 --- a/src/widget/wwaveformviewer.cpp +++ b/src/widget/wwaveformviewer.cpp @@ -27,7 +27,7 @@ WWaveformViewer::WWaveformViewer(const char *group, UserSettingsPointer pConfig, setAcceptDrops(true); m_pZoom = new ControlProxy(group, "waveform_zoom", this); - m_pZoom->connectValueChanged(SLOT(onZoomChange(double))); + m_pZoom->connectValueChanged(this, &WWaveformViewer::onZoomChange); m_pScratchPositionEnable = new ControlProxy( group, "scratch_position_enable", this); diff --git a/src/widget/wwidgetstack.cpp b/src/widget/wwidgetstack.cpp index 9e6548f391..35f6d963a2 100644 --- a/src/widget/wwidgetstack.cpp +++ b/src/widget/wwidgetstack.cpp @@ -8,7 +8,7 @@ WidgetStackControlListener::WidgetStackControlListener(QObject* pParent, : QObject(pParent), m_control(pControl ? pControl->getKey() : ConfigKey(), this), m_index(index) { - m_control.connectValueChanged(SLOT(slotValueChanged(double))); + m_control.connectValueChanged(this, &WidgetStackControlListener::slotValueChanged); } void WidgetStackControlListener::slotValueChanged(double v) { @@ -34,10 +34,9 @@ WWidgetStack::WWidgetStack(QWidget* pParent, const ConfigKey& nextConfigKey, m_nextControl(nextConfigKey, this), m_prevControl(prevConfigKey, this), m_currentPageControl(currentPageConfigKey, this) { - m_nextControl.connectValueChanged(SLOT(onNextControlChanged(double))); - m_prevControl.connectValueChanged(SLOT(onPrevControlChanged(double))); - m_currentPageControl.connectValueChanged( - SLOT(onCurrentPageControlChanged(double))); + m_nextControl.connectValueChanged(this, &WWidgetStack::onNextControlChanged); + m_prevControl.connectValueChanged(this, &WWidgetStack::onPrevControlChanged); + m_currentPageControl.connectValueChanged(this, &WWidgetStack::onCurrentPageControlChanged); connect(&m_showMapper, SIGNAL(mapped(int)), this, SLOT(showIndex(int))); connect(&m_hideMapper, SIGNAL(mapped(int)), -- cgit v1.2.3