diff --git a/ChangeLog b/ChangeLog index ab897f428..5669407f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2008-01-18 Tobias Doerffel + * src/core/effect_chain.cpp: + * src/lib/mmp.cpp: + added upgrade-path in order to properly load projects not using the + new effect-data-structure + + * plugins/bass_booster/bass_booster.h: + * plugins/ladspa_effect/ladspa_effect.h: + * plugins/vst_effect/vst_effect.h: + removed nodeName()-function as effects must not overload it (they have + descriptors with they unique name in it) + + * include/effect_rack_view.h: + * src/widgets/effect_rack_view.cpp: + renamed updateView() to update() in order to also track + dataChanged()-signals of model without an additional connection + * src/widgets/combobox.cpp: fixed painting diff --git a/include/effect_rack_view.h b/include/effect_rack_view.h index ea98a68c4..434ea598c 100644 --- a/include/effect_rack_view.h +++ b/include/effect_rack_view.h @@ -54,7 +54,7 @@ public slots: private slots: - void updateView( void ); + virtual void update( void ); void addEffect( void ); diff --git a/plugins/bass_booster/bass_booster.cpp b/plugins/bass_booster/bass_booster.cpp index 1d4ddc22a..6a9865801 100644 --- a/plugins/bass_booster/bass_booster.cpp +++ b/plugins/bass_booster/bass_booster.cpp @@ -1,7 +1,7 @@ /* * bass_booster.cpp - bass-booster-effect-plugin * - * Copyright (c) 2006-2007 Tobias Doerffel + * Copyright (c) 2006-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * diff --git a/plugins/bass_booster/bass_booster.h b/plugins/bass_booster/bass_booster.h index 4f71820ea..2ec5b15af 100644 --- a/plugins/bass_booster/bass_booster.h +++ b/plugins/bass_booster/bass_booster.h @@ -1,7 +1,7 @@ /* * bass_booster.h - bass-booster-effect-plugin * - * Copyright (c) 2006-2007 Tobias Doerffel + * Copyright (c) 2006-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -51,11 +51,6 @@ public: return( &m_bbControls ); } -/* inline virtual QString nodeName( void ) const - { - return( "bassboostereffect" ); - }*/ - private: effectLib::monoToStereoAdaptor > m_bbFX; diff --git a/plugins/ladspa_effect/ladspa_effect.h b/plugins/ladspa_effect/ladspa_effect.h index 3913bee4c..9ea8aa22d 100644 --- a/plugins/ladspa_effect/ladspa_effect.h +++ b/plugins/ladspa_effect/ladspa_effect.h @@ -69,11 +69,6 @@ public: m_effName = _name; } - inline virtual QString nodeName( void ) const - { - return( "ladspaeffect" ); - } - private: ladspaControls * m_controls; diff --git a/plugins/vst_effect/vst_effect.h b/plugins/vst_effect/vst_effect.h index 404d47a23..25ee7cef2 100644 --- a/plugins/vst_effect/vst_effect.h +++ b/plugins/vst_effect/vst_effect.h @@ -57,11 +57,6 @@ public: this ) ); } - inline virtual QString nodeName( void ) const - { - return( "vsteffect" ); - } - private: void openPlugin( const QString & _plugin ); diff --git a/src/core/effect_chain.cpp b/src/core/effect_chain.cpp index 085dab678..31d2c27b4 100644 --- a/src/core/effect_chain.cpp +++ b/src/core/effect_chain.cpp @@ -53,7 +53,7 @@ effectChain::~effectChain() void effectChain::saveSettings( QDomDocument & _doc, QDomElement & _this ) { - _this.setAttribute( "fxenabled", m_enabledModel.value() ); + _this.setAttribute( "enabled", m_enabledModel.value() ); _this.setAttribute( "numofeffects", m_effects.count() ); for( effectList::iterator it = m_effects.begin(); it != m_effects.end(); it++ ) @@ -69,19 +69,15 @@ void effectChain::saveSettings( QDomDocument & _doc, QDomElement & _this ) void effectChain::loadSettings( const QDomElement & _this ) { -// deleteAllPlugins(); - for( int i = 0; i < m_effects.count(); ++i ) - { - delete m_effects[i]; - } - m_effects.clear(); + deleteAllPlugins(); - m_enabledModel.setValue( _this.attribute( "fxenabled" ).toInt() ); + m_enabledModel.setValue( _this.attribute( "enabled" ).toInt() ); const int plugin_cnt = _this.attribute( "numofeffects" ).toInt(); QDomNode node = _this.firstChild(); - for( int i = 0; i < plugin_cnt; i++ ) + int fx_loaded = 0; + while( !node.isNull() && fx_loaded < plugin_cnt ) { if( node.isElement() && node.nodeName() == "effect" ) { @@ -102,6 +98,7 @@ void effectChain::loadSettings( const QDomElement & _this ) e->restoreState( node.toElement() ); } } + ++fx_loaded; } node = node.nextSibling(); } diff --git a/src/lib/mmp.cpp b/src/lib/mmp.cpp index b41aa4f40..395bd8400 100644 --- a/src/lib/mmp.cpp +++ b/src/lib/mmp.cpp @@ -580,11 +580,31 @@ void multimediaProject::upgrade( void ) if( el.hasAttribute( "fxdisabled" ) && el.attribute( "fxdisabled" ).toInt() == 0 ) { - el.setAttribute( "fxenabled", 1 ); + el.setAttribute( "enabled", 1 ); } } } + if( version < "0.4.0-svn20080118" ) + { + QDomNodeList list = elementsByTagName( "fx" ); + for( int i = 0; !list.item( i ).isNull(); ++i ) + { + QDomElement fxchain = list.item( i ).toElement(); + fxchain.setTagName( "fxchain" ); + QDomNode rack = list.item( i ).firstChild(); + QDomNodeList effects = rack.childNodes(); + // move items one level up + while( effects.count() ) + { + fxchain.appendChild( effects.at( 0 ) ); + } + fxchain.setAttribute( "numofeffects", + rack.toElement().attribute( "numofeffects" ) ); + fxchain.removeChild( rack ); + } + } + if( !m_head.hasAttribute( "mastervol" ) ) { m_head.setAttribute( "mastervol", 100 ); diff --git a/src/widgets/effect_rack_view.cpp b/src/widgets/effect_rack_view.cpp index bbf4d6feb..a10ceddb7 100644 --- a/src/widgets/effect_rack_view.cpp +++ b/src/widgets/effect_rack_view.cpp @@ -56,7 +56,7 @@ effectRackView::effectRackView( effectChain * _model, QWidget * _parent ) : m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); m_scrollArea->setPalette( QApplication::palette( m_scrollArea ) ); m_scrollArea->move( 6, 22 ); - + m_addButton = new QPushButton( m_effectsGroupBox/*, "Add Effect"*/ ); m_addButton->setText( tr( "Add" ) ); m_addButton->move( 75, 210 ); @@ -119,7 +119,7 @@ void effectRackView::moveUp( effectView * _view ) m_effectViews[i - 1] = _view; m_effectViews[i] = temp; - updateView(); + update(); } } @@ -171,13 +171,13 @@ void effectRackView::deletePlugin( effectView * _view ) fxChain()->m_effects.end(), e ) ); delete e; - updateView(); + update(); } -void effectRackView::updateView( void ) +void effectRackView::update( void ) { QWidget * w = m_scrollArea->widget(); QVector view_map( fxChain()->m_effects.size(), FALSE ); @@ -230,6 +230,8 @@ void effectRackView::updateView( void ) } } w->setFixedSize( 210, m_lastY ); + + QWidget::update(); } @@ -246,7 +248,7 @@ void effectRackView::addEffect( void ) } fxChain()->appendEffect( esd.instantiateSelectedPlugin( fxChain() ) ); - updateView(); + update(); } @@ -255,7 +257,7 @@ void effectRackView::addEffect( void ) void effectRackView::modelChanged( void ) { m_effectsGroupBox->setModel( &fxChain()->m_enabledModel ); - updateView(); + update(); }