diff --git a/include/DummyEffect.h b/include/DummyEffect.h index 30d267cce..6c2f31a26 100644 --- a/include/DummyEffect.h +++ b/include/DummyEffect.h @@ -87,6 +87,7 @@ public: m_controls( this ), m_originalPluginData( originalPluginData ) { + setName(); } virtual ~DummyEffect() @@ -113,7 +114,28 @@ public: private: DummyEffectControls m_controls; const QDomElement m_originalPluginData; + + // Parse the display name from the dom + virtual void setName() + { + QDomNodeList keys = originalPluginData().elementsByTagName( "key" ); + for( int i = 0; !keys.item( i ).isNull(); ++i ) + { + QDomNodeList attributes = keys.item( i ).toElement().elementsByTagName( "attribute" ); + for( int j = 0; !attributes.item( j ).isNull(); ++j ) + { + QDomElement attribute = attributes.item( j ).toElement(); + if( attribute.hasAttribute( "value" ) ) + { + QString name = tr("NOT FOUND") + " (" + attribute.attribute( "value" ) + ")"; + setDisplayName(name); + return; + } + } + + } + } } ; diff --git a/src/gui/widgets/EffectView.cpp b/src/gui/widgets/EffectView.cpp index e4c01bed8..07de31ff9 100644 --- a/src/gui/widgets/EffectView.cpp +++ b/src/gui/widgets/EffectView.cpp @@ -31,6 +31,7 @@ #include #include "EffectView.h" +#include "DummyEffect.h" #include "caption_menu.h" #include "EffectControls.h" #include "EffectControlDialog.h" @@ -51,16 +52,21 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : m_controlView( NULL ) { setFixedSize( 210, 60 ); - - m_bypass = new ledCheckBox( "", this ); + + // Disable effects that are of type "DummyEffect" + bool isEnabled = !dynamic_cast( effect() ); + m_bypass = new ledCheckBox( this, "", isEnabled ? ledCheckBox::Green : ledCheckBox::Red ); m_bypass->move( 3, 3 ); + m_bypass->setEnabled( isEnabled ); m_bypass->setWhatsThis( tr( "Toggles the effect on or off." ) ); + toolTip::add( m_bypass, tr( "On/Off" ) ); m_wetDry = new knob( knobBright_26, this ); m_wetDry->setLabel( tr( "W/D" ) ); m_wetDry->move( 27, 5 ); + m_wetDry->setEnabled( isEnabled ); m_wetDry->setHintText( tr( "Wet Level:" ) + " ", "" ); m_wetDry->setWhatsThis( tr( "The Wet/Dry knob sets the ratio between " "the input signal and the effect signal that " @@ -70,6 +76,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : m_autoQuit = new TempoSyncKnob( knobBright_26, this ); m_autoQuit->setLabel( tr( "DECAY" ) ); m_autoQuit->move( 60, 5 ); + m_autoQuit->setEnabled( isEnabled ); m_autoQuit->setHintText( tr( "Time:" ) + " ", "ms" ); m_autoQuit->setWhatsThis( tr( "The Decay knob controls how many buffers of silence must pass before the " @@ -80,6 +87,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : m_gate = new knob( knobBright_26, this ); m_gate->setLabel( tr( "GATE" ) ); m_gate->move( 93, 5 ); + m_gate->setEnabled( isEnabled ); m_gate->setHintText( tr( "Gate:" ) + " ", "" ); m_gate->setWhatsThis( tr( "The Gate knob controls the signal level that is considered to be 'silence' "