Skip to content

Commit

Permalink
Responsive "Effects chain" & "User controller" LEDs (#4297)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hussam Eddin Alhomsi authored Apr 24, 2018
1 parent 418bcce commit f7a0553
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions include/ControllerConnectionDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public slots:
void selectController();
void midiToggled();
void userToggled();
void userSelected();
void autoDetectToggled();
void enableAutoDetect( QAction * _a );

Expand Down
5 changes: 0 additions & 5 deletions include/EffectChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ class EXPORT EffectChain : public Model, public SerializingObject

void clear();

void setEnabled( bool _on )
{
m_enabledModel.setValue( _on );
}


private:
typedef QVector<Effect *> EffectList;
Expand Down
11 changes: 10 additions & 1 deletion src/core/EffectChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ void EffectChain::appendEffect( Effect * _effect )
m_effects.append( _effect );
Engine::mixer()->doneChangeInModel();

m_enabledModel.setValue( true );

emit dataChanged();
}

Expand All @@ -144,6 +146,12 @@ void EffectChain::removeEffect( Effect * _effect )
m_effects.erase( found );

Engine::mixer()->doneChangeInModel();

if( m_effects.isEmpty() )
{
m_enabledModel.setValue( false );
}

emit dataChanged();
}

Expand Down Expand Up @@ -250,7 +258,6 @@ void EffectChain::clear()

Engine::mixer()->requestChangeInModel();

m_enabledModel.setValue( false );
while( m_effects.count() )
{
Effect * e = m_effects[m_effects.count() - 1];
Expand All @@ -259,4 +266,6 @@ void EffectChain::clear()
}

Engine::mixer()->doneChangeInModel();

m_enabledModel.setValue( false );
}
14 changes: 12 additions & 2 deletions src/gui/ControllerConnectionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,14 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent,

m_userController = new ComboBox( m_userGroupBox, "Controller" );
m_userController->setGeometry( 10, 24, 200, 22 );

for (Controller * c : Engine::getSong()->controllers())
{
m_userController->model()->addItem( c->name() );
}
connect( m_userController->model(), SIGNAL( dataUnchanged() ),
this, SLOT( userSelected() ) );
connect( m_userController->model(), SIGNAL( dataChanged() ),
this, SLOT( userSelected() ) );


// Mapping functions
Expand Down Expand Up @@ -389,8 +392,15 @@ void ControllerConnectionDialog::userToggled()
{
m_midiGroupBox->model()->setValue( 0 );
}
}


m_userController->setEnabled( enabled );


void ControllerConnectionDialog::userSelected()
{
m_userGroupBox->model()->setValue( 1 );
userToggled();
}


Expand Down
1 change: 0 additions & 1 deletion src/gui/widgets/EffectRackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ void EffectRackView::addEffect()

Effect * fx = esd.instantiateSelectedPlugin( fxChain() );

fxChain()->m_enabledModel.setValue( true );
fxChain()->appendEffect( fx );
update();

Expand Down

0 comments on commit f7a0553

Please sign in to comment.