mirror of
https://github.com/LMMS/lmms.git
synced 2026-04-24 07:58:51 -04:00
Prevent cycles in controller connections.
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1440 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -190,6 +190,36 @@ controller * controller::create( const QDomElement & _this, model * _parent )
|
||||
|
||||
|
||||
|
||||
bool controller::hasModel( const model * m )
|
||||
{
|
||||
QObjectList chldren = children();
|
||||
for( int i = 0; i < chldren.size(); ++i )
|
||||
{
|
||||
QObject * c = chldren.at(i);
|
||||
automatableModel * am = qobject_cast<automatableModel*>(c);
|
||||
if( am != NULL )
|
||||
{
|
||||
if( am == m )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
controllerConnection * cc = am->getControllerConnection();
|
||||
if( cc != NULL )
|
||||
{
|
||||
if( cc->getController()->hasModel( m ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void controller::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "type", type() );
|
||||
|
||||
Reference in New Issue
Block a user