diff --git a/ChangeLog b/ChangeLog index fd6282dd0..5532c047b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-03-08 Tobias Doerffel + + * include/mv_base.h: + * src/widgets/combobox.cpp: + * src/widgets/knob.cpp: + * src/widgets/automatable_button.cpp: + * src/core/mv_base.cpp: + also connect model-signals with view when using default-constructed + model - fixes missing updates on things like button-groups when using + automation + 2008-03-07 Tobias Doerffel * plugins/vst_base/lvsl_server.cpp: diff --git a/include/mv_base.h b/include/mv_base.h index ee3ac4c90..58a620149 100644 --- a/include/mv_base.h +++ b/include/mv_base.h @@ -72,11 +72,7 @@ signals: class modelView { public: - modelView( model * _model ) : - m_model( _model ) - { - } - + modelView( model * _model ); virtual ~modelView() { } @@ -102,6 +98,8 @@ protected: { } + void doConnections( void ); + private: model * m_model; diff --git a/src/core/mv_base.cpp b/src/core/mv_base.cpp index b8185789c..10026acb9 100644 --- a/src/core/mv_base.cpp +++ b/src/core/mv_base.cpp @@ -1,7 +1,7 @@ /* * mv_base.cpp - base for M/V-architecture of LMMS * - * Copyright (c) 2007 Tobias Doerffel + * Copyright (c) 2007-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -30,12 +30,19 @@ #include "mv_base.h" +modelView::modelView( model * _model ) : + m_model( _model ) +{ +} + + + + void modelView::setModel( model * _model, bool _old_model_valid ) { QWidget * w = dynamic_cast( this ); assert( w != NULL ); -//printf("w: %x m_model:%x _model:%x\n", w, m_model, _model); if( _old_model_valid && m_model != NULL ) { if( m_model->defaultConstructed() ) @@ -48,10 +55,8 @@ void modelView::setModel( model * _model, bool _old_model_valid ) } } m_model = _model; - QObject::connect( _model, SIGNAL( dataChanged() ), - w, SLOT( update() ), Qt::QueuedConnection ); - QObject::connect( _model, SIGNAL( propertiesChanged() ), - w, SLOT( update() ), Qt::QueuedConnection ); + + doConnections(); w->update(); @@ -60,5 +65,21 @@ void modelView::setModel( model * _model, bool _old_model_valid ) + +void modelView::doConnections( void ) +{ + if( m_model != NULL ) + { + QWidget * w = dynamic_cast( this ); + QObject::connect( m_model, SIGNAL( dataChanged() ), + w, SLOT( update() ), Qt::QueuedConnection ); + QObject::connect( m_model, SIGNAL( propertiesChanged() ), + w, SLOT( update() ), Qt::QueuedConnection ); + } +} + + + + #include "mv_base.moc" diff --git a/src/widgets/automatable_button.cpp b/src/widgets/automatable_button.cpp index d27179c09..646b5eef8 100644 --- a/src/widgets/automatable_button.cpp +++ b/src/widgets/automatable_button.cpp @@ -46,6 +46,7 @@ automatableButton::automatableButton( QWidget * _parent, m_group( NULL ) { setAccessibleName( _name ); + doConnections(); } diff --git a/src/widgets/combobox.cpp b/src/widgets/combobox.cpp index 5ed91ab59..18f492f8c 100644 --- a/src/widgets/combobox.cpp +++ b/src/widgets/combobox.cpp @@ -80,6 +80,7 @@ comboBox::comboBox( QWidget * _parent, const QString & _name ) : this, SLOT( setItem( QAction * ) ) ); setAccessibleName( _name ); + doConnections(); } diff --git a/src/widgets/knob.cpp b/src/widgets/knob.cpp index f1a4be96d..d2a43fdf8 100644 --- a/src/widgets/knob.cpp +++ b/src/widgets/knob.cpp @@ -86,6 +86,7 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) : setFixedSize( m_knobPixmap->width(), m_knobPixmap->height() ); setTotalAngle( 270.0f ); + doConnections(); }