diff --git a/include/lv2_manager.h b/include/lv2_manager.h index f6b879fd0..ae7271f8e 100644 --- a/include/lv2_manager.h +++ b/include/lv2_manager.h @@ -26,12 +26,18 @@ #ifndef _LV2_MANAGER_H #define _LV2_MANAGER_H +#include "lmmsconfig.h" + #ifdef LMMS_HAVE_LV2 #include #include #include +#ifdef LMMS_HAVE_SLV2_SCALEPOINTS_H +#include +#endif + #include #include #include diff --git a/include/resources_db.h b/include/resources_db.h index cfb94797a..5c25daeea 100644 --- a/include/resources_db.h +++ b/include/resources_db.h @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -81,6 +82,48 @@ private: QDomElement & _de ); void loadTreeItem( ResourcesTreeItem * _i, QDomElement & _de ); + static inline QString typeName( ResourcesItem::Type _t ) + { + return s_typeNames[_t]; + } + + static inline QString baseDirName( ResourcesItem::BaseDirectory _bd ) + { + return s_baseDirNames[_bd]; + } + + static inline ResourcesItem::Type typeFromName( const QString & _n ) + { + for( TypeStringMap::ConstIterator it = s_typeNames.begin(); + it != s_typeNames.end(); ++it ) + { + if( it.value() == _n ) + { + return it.key(); + } + } + return ResourcesItem::TypeUnknown; + } + + static inline ResourcesItem::BaseDirectory baseDirFromName( + const QString & _n ) + { + for( BaseDirStringMap::ConstIterator it = + s_baseDirNames.begin(); + it != s_baseDirNames.end(); ++it ) + { + if( it.value() == _n ) + { + return it.key(); + } + } + return ResourcesItem::BaseRoot; + } + + typedef QMap TypeStringMap; + typedef QMap BaseDirStringMap; + static TypeStringMap s_typeNames; + static BaseDirStringMap s_baseDirNames; ResourcesProvider * m_provider; ItemList m_items; diff --git a/lmms.rc.in b/lmms.rc.in index cff42ec8e..c8065017a 100644 --- a/lmms.rc.in +++ b/lmms.rc.in @@ -17,7 +17,7 @@ BEGIN VALUE "CompanyName", "LMMS Developers\0" VALUE "FileDescription", "Linux MultiMedia Studio\0" VALUE "FileVersion", "@VERSION@\0" - VALUE "LegalCopyright", "Copyright (c) 2004-2008 LMMS Developers\0" + VALUE "LegalCopyright", "Copyright (c) 2004-2009 LMMS Developers\0" VALUE "OriginalFilename", "lmms.exe\0" VALUE "ProductName", "LMMS\0" VALUE "ProductVersion", "@VERSION@\0" diff --git a/src/core/controller_connection.cpp b/src/core/controller_connection.cpp index dc6a2c781..3a0683157 100644 --- a/src/core/controller_connection.cpp +++ b/src/core/controller_connection.cpp @@ -41,17 +41,18 @@ controllerConnectionVector controllerConnection::s_connections; controllerConnection::controllerConnection( controller * _controller ) : - m_controllerId( -1 ), + m_controllerId( -1 ), m_ownsController( FALSE ) { - if( _controller != NULL ) - { - setController( _controller ); - } - else - { - m_controller = controller::create( controller::DummyController, NULL ); - } + if( _controller != NULL ) + { + setController( _controller ); + } + else + { + m_controller = controller::create( controller::DummyController, + NULL ); + } s_connections.append( this ); } @@ -60,7 +61,7 @@ controllerConnection::controllerConnection( controller * _controller ) : controllerConnection::controllerConnection( int _controllerId ) : m_controller( controller::create( controller::DummyController, NULL ) ), - m_controllerId( _controllerId ), + m_controllerId( _controllerId ), m_ownsController( FALSE ) { s_connections.append( this ); @@ -145,13 +146,15 @@ inline void controllerConnection::setTargetName( const QString & _name ) void controllerConnection::finalizeConnections( void ) { for( int i = 0; i < s_connections.size(); ++i ) - { - controllerConnection * c = s_connections[i]; - if ( !c->isFinalized() ) - { - c->setController( engine::getSong()->controllers().at( c->m_controllerId ) ); - } - } + { + controllerConnection * c = s_connections[i]; + if ( !c->isFinalized() && c->m_controllerId < + engine::getSong()->controllers().size() ) + { + c->setController( engine::getSong()-> + controllers().at( c->m_controllerId ) ); + } + } } @@ -159,7 +162,8 @@ void controllerConnection::finalizeConnections( void ) void controllerConnection::saveSettings( QDomDocument & _doc, QDomElement & _this ) { - if( engine::getSong() ) { + if( engine::getSong() ) + { if( m_ownsController ) { m_controller->saveState( _doc, _this ); @@ -167,12 +171,12 @@ void controllerConnection::saveSettings( QDomDocument & _doc, QDomElement & _thi else { int id = engine::getSong()->controllers().indexOf( m_controller ); - if(id >= 0 ) + if( id >= 0 ) { _this.setAttribute( "id", id ); } } - } + } } diff --git a/src/core/engine.cpp b/src/core/engine.cpp index 30bdef596..0ac6108bf 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -160,8 +160,6 @@ void engine::destroy( void ) s_pianoRoll = NULL; delete s_automationEditor; s_automationEditor = NULL; - delete s_automationRecorder; - s_automationRecorder = NULL; delete s_fxMixerView; s_fxMixerView = NULL; @@ -190,6 +188,9 @@ void engine::destroy( void ) delete s_song; s_song = NULL; + delete s_automationRecorder; + s_automationRecorder = NULL; + delete s_resourcesProvider; s_resourcesProvider = NULL; diff --git a/src/core/lv2_manager.cpp b/src/core/lv2_manager.cpp index b80af46ff..5cfc9fcdb 100644 --- a/src/core/lv2_manager.cpp +++ b/src/core/lv2_manager.cpp @@ -36,10 +36,6 @@ #ifdef LMMS_HAVE_LV2 -#ifdef LMMS_HAVE_SLV2_SCALEPOINTS_H -#include "slv2/scalepoints.h" -#endif - lv2Manager * static_lv2_manager=(lv2Manager *)NULL; // There is only one of these... diff --git a/src/core/resources_db.cpp b/src/core/resources_db.cpp index ea83d8b2f..aa4cab6c6 100644 --- a/src/core/resources_db.cpp +++ b/src/core/resources_db.cpp @@ -30,6 +30,10 @@ #include "mmp.h" +QMap ResourcesDB::s_typeNames; +QMap ResourcesDB::s_baseDirNames; + + ResourcesDB::ResourcesDB( ResourcesProvider * _provider ) : m_provider( _provider ) @@ -37,6 +41,30 @@ ResourcesDB::ResourcesDB( ResourcesProvider * _provider ) : connect( m_provider, SIGNAL( itemsChanged() ), this, SIGNAL( itemsChanged() ) ); + if( s_typeNames.isEmpty() ) + { + s_typeNames[ResourcesItem::TypeUnknown] = "Unknown"; + s_typeNames[ResourcesItem::TypeDirectory] = "Directory"; + s_typeNames[ResourcesItem::TypeSample] = "Sample"; + s_typeNames[ResourcesItem::TypeSoundFont] = "SoundFont"; + s_typeNames[ResourcesItem::TypePreset] = "Preset"; + s_typeNames[ResourcesItem::TypeProject] = "Project"; + s_typeNames[ResourcesItem::TypeMidiFile] = "MidiFile"; + s_typeNames[ResourcesItem::TypeForeignProject] = "ForeignProject"; + s_typeNames[ResourcesItem::TypePlugin] = "Plugin"; + s_typeNames[ResourcesItem::TypeImage] = "Image"; + } + + if( s_baseDirNames.isEmpty() ) + { + s_baseDirNames[ResourcesItem::BaseRoot] = "Root"; + s_baseDirNames[ResourcesItem::BaseWorkingDir] = "WorkingDir"; + s_baseDirNames[ResourcesItem::BaseDataDir] = "DataDir"; + s_baseDirNames[ResourcesItem::BaseHome] = "Home"; + s_baseDirNames[ResourcesItem::BaseURL] = "URL"; + } + + } @@ -107,8 +135,8 @@ void ResourcesDB::saveTreeItem( const ResourcesTreeItem * _i, { const ResourcesItem * it = _i->item(); e.setAttribute( "name", it->name() ); - e.setAttribute( "type", it->type() ); - e.setAttribute( "basedir", it->baseDir() ); + e.setAttribute( "type", typeName( it->type() ) ); + e.setAttribute( "basedir", baseDirName( it->baseDir() ) ); e.setAttribute( "path", it->path() ); e.setAttribute( "hash", it->hash() ); e.setAttribute( "size", it->size() ); @@ -135,9 +163,8 @@ void ResourcesDB::loadTreeItem( ResourcesTreeItem * _i, QDomElement & _de ) { ResourcesItem * item = new ResourcesItem( m_provider, e.attribute( "name" ), - static_cast( e.attribute( "type" ).toInt() ), - static_cast( - e.attribute( "basedir" ).toInt() ), + typeFromName( e.attribute( "type" ) ), + baseDirFromName( e.attribute( "basedir" ) ), e.attribute( "path" ), h, e.attribute( "tags" ), diff --git a/src/core/track.cpp b/src/core/track.cpp index ed6503adb..aa14b7de3 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -1175,16 +1175,16 @@ void trackContentWidget::updateBackground( void ) // Assume even-pixels-per-tact. Makes sense, should be like this anyways int ppt = static_cast( tcv->pixelsPerTact() ); - int width = ppt * tactsPerBar; + int width = ppt * tactsPerBar; - m_background = QPixmap( width * 2, height() ); - QPainter pmp; - pmp.begin( &m_background ); + m_background = QPixmap( width * 2, height() ); + QPainter pmp; + pmp.begin( &m_background ); - engine::getLmmsStyle()->drawTrackContentBackground( &pmp, - QSize( width, height() ), ppt ); + engine::getLmmsStyle()->drawTrackContentBackground( &pmp, + QSize( width, height() ), ppt ); - pmp.end(); + pmp.end(); } @@ -1425,7 +1425,7 @@ void trackOperationsWidget::mousePressEvent( QMouseEvent * _me ) void trackOperationsWidget::paintEvent( QPaintEvent * _pe ) { QPainter p( this ); - p.fillRect( rect(), palette().brush(QPalette::Background) ); + p.fillRect( rect(), palette().brush( QPalette::Background ) ); if( m_trackView->isMovingTrack() == false ) { @@ -2085,7 +2085,6 @@ trackView::trackView( track * _track, trackContainerView * _tcv ) : setAcceptDrops( true ); setAttribute( Qt::WA_DeleteOnClose, true ); - setAttribute( Qt::WA_OpaquePaintEvent, true ); connect( m_track, SIGNAL( destroyedTrack() ), this, SLOT( close() ) ); diff --git a/src/gui/track_container_view.cpp b/src/gui/track_container_view.cpp index 43bf73fcf..c2e1e2c75 100644 --- a/src/gui/track_container_view.cpp +++ b/src/gui/track_container_view.cpp @@ -223,7 +223,7 @@ void trackContainerView::realignTracks( void ) { ( *it )->show(); ( *it )->update(); - ( *it )->getTrackContentWidget()->updateBackground(); + ( *it )->getTrackContentWidget()->updateBackground(); } }