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:
@@ -180,6 +180,8 @@ public:
|
||||
static void unlinkModels( AutomatableModel * _m1,
|
||||
AutomatableModel * _m2 );
|
||||
|
||||
void unlinkAllModels();
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this,
|
||||
const QString & _name = QString( "value" ) );
|
||||
@@ -208,6 +210,11 @@ public:
|
||||
return "0";
|
||||
}
|
||||
|
||||
bool hasLinkedModels() const
|
||||
{
|
||||
return m_hasLinkedModels;
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void reset();
|
||||
|
||||
@@ -92,6 +92,7 @@ public slots:
|
||||
void execConnectionDialog();
|
||||
void removeConnection();
|
||||
void editSongGlobalAutomation();
|
||||
void unlinkAllModels();
|
||||
void removeSongGlobalAutomation();
|
||||
|
||||
|
||||
|
||||
@@ -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