diff --git a/include/Model.h b/include/Model.h index 55e735a05a3..7071bb86762 100644 --- a/include/Model.h +++ b/include/Model.h @@ -41,6 +41,10 @@ class EXPORT Model : public QObject m_displayName( _display_name ), m_defaultConstructed( _default_constructed ) { +#if QT_VERSION < 0x050000 + connect( this, SIGNAL( dataChanged() ), this, + SLOT( thisDataChanged() ), Qt::DirectConnection ); +#endif } virtual ~Model() @@ -85,6 +89,19 @@ class EXPORT Model : public QObject // emitted if properties of the model (e.g. ranges) have changed void propertiesChanged(); +#if QT_VERSION < 0x050000 + // emitted along with dataChanged(), but with this model as an argument + // workaround for when QObject::sender() and Qt5 are unavailable + void dataChanged( Model * ); + +private slots: + void thisDataChanged() + { + emit dataChanged( this ); + } + +signals: +#endif } ; diff --git a/plugins/VstEffect/VstEffectControls.cpp b/plugins/VstEffect/VstEffectControls.cpp index e5261d62587..2d89e20bbc4 100644 --- a/plugins/VstEffect/VstEffectControls.cpp +++ b/plugins/VstEffect/VstEffectControls.cpp @@ -90,7 +90,13 @@ void VstEffectControls::loadSettings( const QDomElement & _this ) knobFModel[ i ]->setInitValue(LocaleHelper::toFloat(s_dumpValues.at(2))); } - connect( knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) ); +#if QT_VERSION < 0x050000 + connect( knobFModel[i], SIGNAL( dataChanged( Model * ) ), + this, SLOT( setParameter( Model * ) ), Qt::DirectConnection ); +#else + connect( knobFModel[i], &FloatModel::dataChanged, this, + [this, i]() { setParameter( knobFModel[i] ); }, Qt::DirectConnection); +#endif } } @@ -100,10 +106,8 @@ void VstEffectControls::loadSettings( const QDomElement & _this ) -void VstEffectControls::setParameter( void ) +void VstEffectControls::setParameter( Model * action ) { - - Model *action = qobject_cast(sender()); int knobUNID = action->displayName().toInt(); if ( m_effect->m_plugin != NULL ) { @@ -385,9 +389,16 @@ manageVSTEffectView::manageVSTEffectView( VstEffect * _eff, VstEffectControls * m_vi->knobFModel[ i ] = new FloatModel( LocaleHelper::toFloat(s_dumpValues.at(2)), 0.0f, 1.0f, 0.01f, _eff, tr( paramStr ) ); } - connect( m_vi->knobFModel[ i ], SIGNAL( dataChanged() ), this, - SLOT( setParameter() ) ); - vstKnobs[ i ] ->setModel( m_vi->knobFModel[ i ] ); + + FloatModel * model = m_vi->knobFModel[i]; +#if QT_VERSION < 0x050000 + connect( model, SIGNAL( dataChanged( Model * ) ), this, + SLOT( setParameter( Model * ) ), Qt::DirectConnection ); +#else + connect( model, &FloatModel::dataChanged, this, + [this, model]() { setParameter( model ); }, Qt::DirectConnection); +#endif + vstKnobs[ i ] ->setModel( model ); } int i = 0; @@ -480,10 +491,8 @@ void manageVSTEffectView::displayAutomatedOnly( void ) -void manageVSTEffectView::setParameter( void ) +void manageVSTEffectView::setParameter( Model * action ) { - - Model *action = qobject_cast(sender()); int knobUNID = action->displayName().toInt(); if ( m_effect->m_plugin != NULL ) { diff --git a/plugins/VstEffect/VstEffectControls.h b/plugins/VstEffect/VstEffectControls.h index e4f099fd1af..092669f949f 100644 --- a/plugins/VstEffect/VstEffectControls.h +++ b/plugins/VstEffect/VstEffectControls.h @@ -70,7 +70,7 @@ protected slots: void rollPreset( void ); void rolrPreset( void ); void selPreset( void ); - void setParameter( void ); + void setParameter( Model * action ); protected: virtual void paintEvent( QPaintEvent * _pe ); @@ -110,7 +110,7 @@ class manageVSTEffectView : public QObject protected slots: void syncPlugin( void ); void displayAutomatedOnly( void ); - void setParameter( void ); + void setParameter( Model * action ); void closeWindow(); private: diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index c31611626c4..0d985a10877 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -209,7 +209,13 @@ void vestigeInstrument::loadSettings( const QDomElement & _this ) knobFModel[ i ]->setInitValue(LocaleHelper::toFloat(s_dumpValues.at(2))); } - connect( knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) ); +#if QT_VERSION < 0x050000 + connect( knobFModel[i], SIGNAL( dataChanged( Model * ) ), + this, SLOT( setParameter( Model * ) ), Qt::DirectConnection ); +#else + connect( knobFModel[i], &FloatModel::dataChanged, this, + [this, i]() { setParameter( knobFModel[i] ); }, Qt::DirectConnection); +#endif } } m_pluginMutex.unlock(); @@ -218,10 +224,8 @@ void vestigeInstrument::loadSettings( const QDomElement & _this ) -void vestigeInstrument::setParameter( void ) +void vestigeInstrument::setParameter( Model * action ) { - - Model *action = qobject_cast(sender()); int knobUNID = action->displayName().toInt(); if ( m_plugin != NULL ) { @@ -996,8 +1000,16 @@ manageVestigeInstrumentView::manageVestigeInstrumentView( Instrument * _instrume m_vi->knobFModel[ i ] = new FloatModel( LocaleHelper::toFloat(s_dumpValues.at(2)), 0.0f, 1.0f, 0.01f, castModel(), tr( paramStr ) ); } - connect( m_vi->knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) ); - vstKnobs[i] ->setModel( m_vi->knobFModel[i] ); + + FloatModel * model = m_vi->knobFModel[i]; +#if QT_VERSION < 0x050000 + connect( model, SIGNAL( dataChanged( Model * ) ), this, + SLOT( setParameter( Model * ) ), Qt::DirectConnection ); +#else + connect( model, &FloatModel::dataChanged, this, + [this, model]() { setParameter( model ); }, Qt::DirectConnection); +#endif + vstKnobs[i] ->setModel( model ); } int i = 0; @@ -1128,10 +1140,8 @@ manageVestigeInstrumentView::~manageVestigeInstrumentView() -void manageVestigeInstrumentView::setParameter( void ) +void manageVestigeInstrumentView::setParameter( Model * action ) { - - Model *action = qobject_cast(sender()); int knobUNID = action->displayName().toInt(); if ( m_vi->m_plugin != NULL ) { diff --git a/plugins/vestige/vestige.h b/plugins/vestige/vestige.h index 2c007efc0c4..3b92eea8ffc 100644 --- a/plugins/vestige/vestige.h +++ b/plugins/vestige/vestige.h @@ -73,7 +73,7 @@ class vestigeInstrument : public Instrument virtual PluginView * instantiateView( QWidget * _parent ); protected slots: - void setParameter( void ); + void setParameter( Model * action ); void handleConfigChange( QString cls, QString attr, QString value ); void reloadPlugin(); @@ -109,7 +109,7 @@ class manageVestigeInstrumentView : public InstrumentView protected slots: void syncPlugin( void ); void displayAutomatedOnly( void ); - void setParameter( void ); + void setParameter( Model * action ); void closeWindow(); diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 219a153f527..4a41aea0ca4 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -1936,7 +1936,9 @@ DWORD WINAPI RemoteVstPlugin::processingThread( LPVOID _param ) RemotePluginClient::message m; while( ( m = _this->receiveMessage() ).id != IdQuit ) { - if( m.id == IdStartProcessing || m.id == IdMidiEvent ) + if( m.id == IdStartProcessing + || m.id == IdMidiEvent + || m.id == IdVstSetParameter ) { _this->processMessage( m ); } diff --git a/plugins/zynaddsubfx/ZynAddSubFx.cpp b/plugins/zynaddsubfx/ZynAddSubFx.cpp index a0f381971a7..fff13c62dc7 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/ZynAddSubFx.cpp @@ -122,13 +122,20 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument( { initPlugin(); - connect( &m_portamentoModel, SIGNAL( dataChanged() ), this, SLOT( updatePortamento() ) ); - connect( &m_filterFreqModel, SIGNAL( dataChanged() ), this, SLOT( updateFilterFreq() ) ); - connect( &m_filterQModel, SIGNAL( dataChanged() ), this, SLOT( updateFilterQ() ) ); - connect( &m_bandwidthModel, SIGNAL( dataChanged() ), this, SLOT( updateBandwidth() ) ); - connect( &m_fmGainModel, SIGNAL( dataChanged() ), this, SLOT( updateFmGain() ) ); - connect( &m_resCenterFreqModel, SIGNAL( dataChanged() ), this, SLOT( updateResCenterFreq() ) ); - connect( &m_resBandwidthModel, SIGNAL( dataChanged() ), this, SLOT( updateResBandwidth() ) ); + connect( &m_portamentoModel, SIGNAL( dataChanged() ), + this, SLOT( updatePortamento() ), Qt::DirectConnection ); + connect( &m_filterFreqModel, SIGNAL( dataChanged() ), + this, SLOT( updateFilterFreq() ), Qt::DirectConnection ); + connect( &m_filterQModel, SIGNAL( dataChanged() ), + this, SLOT( updateFilterQ() ), Qt::DirectConnection ); + connect( &m_bandwidthModel, SIGNAL( dataChanged() ), + this, SLOT( updateBandwidth() ), Qt::DirectConnection ); + connect( &m_fmGainModel, SIGNAL( dataChanged() ), + this, SLOT( updateFmGain() ), Qt::DirectConnection ); + connect( &m_resCenterFreqModel, SIGNAL( dataChanged() ), + this, SLOT( updateResCenterFreq() ), Qt::DirectConnection ); + connect( &m_resBandwidthModel, SIGNAL( dataChanged() ), + this, SLOT( updateResBandwidth() ), Qt::DirectConnection ); // now we need a play-handle which cares for calling play() InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrumentTrack ); @@ -138,7 +145,7 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument( this, SLOT( reloadPlugin() ) ); connect( instrumentTrack()->pitchRangeModel(), SIGNAL( dataChanged() ), - this, SLOT( updatePitchRange() ) ); + this, SLOT( updatePitchRange() ), Qt::DirectConnection ); } diff --git a/src/core/AutomatableModel.cpp b/src/core/AutomatableModel.cpp index ba81a589310..5a97c328075 100644 --- a/src/core/AutomatableModel.cpp +++ b/src/core/AutomatableModel.cpp @@ -417,7 +417,8 @@ void AutomatableModel::linkModel( AutomatableModel* model ) if( !model->hasLinkedModels() ) { - QObject::connect( this, SIGNAL( dataChanged() ), model, SIGNAL( dataChanged() ) ); + QObject::connect( this, SIGNAL( dataChanged() ), + model, SIGNAL( dataChanged() ), Qt::DirectConnection ); } } } @@ -476,7 +477,8 @@ void AutomatableModel::setControllerConnection( ControllerConnection* c ) m_controllerConnection = c; if( c ) { - QObject::connect( m_controllerConnection, SIGNAL( valueChanged() ), this, SIGNAL( dataChanged() ) ); + QObject::connect( m_controllerConnection, SIGNAL( valueChanged() ), + this, SIGNAL( dataChanged() ), Qt::DirectConnection ); QObject::connect( m_controllerConnection, SIGNAL( destroyed() ), this, SLOT( unlinkControllerConnection() ) ); m_valueChanged = true; emit dataChanged(); diff --git a/src/core/ControllerConnection.cpp b/src/core/ControllerConnection.cpp index af398d389f4..45e36e12fc0 100644 --- a/src/core/ControllerConnection.cpp +++ b/src/core/ControllerConnection.cpp @@ -117,7 +117,7 @@ void ControllerConnection::setController( Controller * _controller ) { _controller->addConnection( this ); QObject::connect( _controller, SIGNAL( valueChanged() ), - this, SIGNAL( valueChanged() ) ); + this, SIGNAL( valueChanged() ), Qt::DirectConnection ); } m_ownsController = diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index d5ded0c7057..98a691a9a42 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -126,10 +126,14 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) : setName( tr( "Default preset" ) ); - connect( &m_baseNoteModel, SIGNAL( dataChanged() ), this, SLOT( updateBaseNote() ) ); - connect( &m_pitchModel, SIGNAL( dataChanged() ), this, SLOT( updatePitch() ) ); - connect( &m_pitchRangeModel, SIGNAL( dataChanged() ), this, SLOT( updatePitchRange() ) ); - connect( &m_effectChannelModel, SIGNAL( dataChanged() ), this, SLOT( updateEffectChannel() ) ); + connect( &m_baseNoteModel, SIGNAL( dataChanged() ), + this, SLOT( updateBaseNote() ), Qt::DirectConnection ); + connect( &m_pitchModel, SIGNAL( dataChanged() ), + this, SLOT( updatePitch() ), Qt::DirectConnection ); + connect( &m_pitchRangeModel, SIGNAL( dataChanged() ), + this, SLOT( updatePitchRange() ), Qt::DirectConnection ); + connect( &m_effectChannelModel, SIGNAL( dataChanged() ), + this, SLOT( updateEffectChannel() ), Qt::DirectConnection ); }