made effect-settings load again

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms-mv@668 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-01-18 17:08:25 +00:00
parent 1808379915
commit 157940921c
9 changed files with 54 additions and 34 deletions

View File

@@ -1,5 +1,21 @@
2008-01-18 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* 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

View File

@@ -54,7 +54,7 @@ public slots:
private slots:
void updateView( void );
virtual void update( void );
void addEffect( void );

View File

@@ -1,7 +1,7 @@
/*
* bass_booster.cpp - bass-booster-effect-plugin
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*

View File

@@ -1,7 +1,7 @@
/*
* bass_booster.h - bass-booster-effect-plugin
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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<effectLib::fastBassBoost<> > m_bbFX;

View File

@@ -69,11 +69,6 @@ public:
m_effName = _name;
}
inline virtual QString nodeName( void ) const
{
return( "ladspaeffect" );
}
private:
ladspaControls * m_controls;

View File

@@ -57,11 +57,6 @@ public:
this ) );
}
inline virtual QString nodeName( void ) const
{
return( "vsteffect" );
}
private:
void openPlugin( const QString & _plugin );

View File

@@ -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();
}

View File

@@ -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 );

View File

@@ -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<bool> 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();
}