diff --git a/ChangeLog b/ChangeLog index 8ff886e48..22f6ba63f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2008-06-02 Paul Giblock + * include/automatable_model.h: * include/controller_connection.h: * src/core/automatable_model.cpp: * src/core/controller_connection.cpp: diff --git a/include/automatable_model.h b/include/automatable_model.h index f8022a24f..02e51a6ea 100644 --- a/include/automatable_model.h +++ b/include/automatable_model.h @@ -117,9 +117,12 @@ public: inline void setControllerConnection( controllerConnection * _c ) { m_controllerConnection = _c; - QObject::connect( m_controllerConnection, - SIGNAL( valueChanged() ), - this, SIGNAL( dataChanged() ) ); + if( _c ) + { + QObject::connect( m_controllerConnection, + SIGNAL( valueChanged() ), + this, SIGNAL( dataChanged() ) ); + } } diff --git a/include/controller_connection.h b/include/controller_connection.h index 66d5161ee..bb68f7b5c 100644 --- a/include/controller_connection.h +++ b/include/controller_connection.h @@ -56,7 +56,7 @@ public: return m_controller; } - inline void setController( controller * _controller ); + void setController( controller * _controller ); inline void setController( int _controllerId ); diff --git a/src/core/controller_connection.cpp b/src/core/controller_connection.cpp index 5eee18d33..cafca5da5 100644 --- a/src/core/controller_connection.cpp +++ b/src/core/controller_connection.cpp @@ -95,7 +95,14 @@ void controllerConnection::setController( controller * _controller ) delete m_controller; } - m_controller = _controller; + if( !_controller ) + { + m_controller = controller::create( controller::DummyController, NULL ); + } + else + { + m_controller = _controller; + } m_controllerId = -1; if( _controller->type() != controller::DummyController ) diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index 9e4591a08..de4720ca6 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -699,8 +699,21 @@ void knob::connectToController( void ) if (d->chosenController() != NULL ) { - model()->setControllerConnection( - new controllerConnection( d->chosenController() ) ); + if( model()->getControllerConnection() ) + { + model()->getControllerConnection()-> + setController( d->chosenController() ); + } + else + { + model()->setControllerConnection( + new controllerConnection( d->chosenController() ) ); + } + } + else if( model()->getControllerConnection() ) + { + delete model()->getControllerConnection(); + model()->setControllerConnection( NULL ); } delete d;