AutomatableModelView/ContextMenu: option for unlinking all controls

Integrated patch by Rodrigo Rodrigues da Silva which adds an option
to all AutomatableModelView's context menu allowing to unlink all
linked controls.
This commit is contained in:
Tobias Doerffel
2014-01-15 23:50:13 +01:00
parent 17babf6abc
commit 17c1ede50c
4 changed files with 35 additions and 0 deletions

View File

@@ -418,6 +418,19 @@ void AutomatableModel::unlinkModels( AutomatableModel * _model1,
void AutomatableModel::unlinkAllModels()
{
foreach( AutomatableModel* model, m_linkedModels )
{
unlinkModels( this, model );
}
m_hasLinkedModels = false;
}
void AutomatableModel::setControllerConnection( ControllerConnection * _c )
{
m_controllerConnection = _c;

View File

@@ -68,6 +68,7 @@ void AutomatableModelView::addDefaultActions( QMenu * _menu )
_model->initValue<float>() ) ).
arg( m_unit ),
_model, SLOT( reset() ) );
_menu->addSeparator();
_menu->addAction( embed::getIconPixmap( "edit_copy" ),
AutomatableModel::tr( "&Copy value (%1%2)" ).
@@ -96,6 +97,14 @@ void AutomatableModelView::addDefaultActions( QMenu * _menu )
_menu->addSeparator();
if( _model->hasLinkedModels() )
{
_menu->addAction( embed::getIconPixmap( "edit-delete" ),
AutomatableModel::tr( "Remove all linked controls" ),
amvSlots, SLOT( unlinkAllModels() ) );
_menu->addSeparator();
}
QString controllerTxt;
if( _model->getControllerConnection() )
{
@@ -253,5 +262,10 @@ void AutomatableModelViewSlots::removeSongGlobalAutomation()
}
void AutomatableModelViewSlots::unlinkAllModels()
{
amv->modelUntyped()->unlinkAllModels();
}
#include "moc_AutomatableModelView.cxx"