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:
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user