diff --git a/include/config_mgr.h b/include/config_mgr.h index bbe16b09d..5199414c2 100644 --- a/include/config_mgr.h +++ b/include/config_mgr.h @@ -1,8 +1,8 @@ /* * config_mgr.h - class configManager, a class for managing LMMS-configuration * - * Copyright (c) 2005-2008 Tobias Doerffel - * + * Copyright (c) 2005-2009 Tobias Doerffel + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -22,7 +22,6 @@ * */ - #ifndef _CONFIG_MGR_H #define _CONFIG_MGR_H @@ -37,13 +36,12 @@ class engine; - +class ResourceItem; const QString PROJECTS_PATH = "projects/"; const QString PRESETS_PATH = "presets/"; const QString SAMPLES_PATH = "samples/"; const QString DEFAULT_THEME_PATH = "themes/default/"; -const QString TRACK_ICON_PATH = "track_icons/"; const QString LOCALE_PATH = "locale/"; @@ -56,111 +54,106 @@ public: { s_instanceOfMe = new configManager(); } - return( s_instanceOfMe ); + return s_instanceOfMe; } const QString & dataDir( void ) const { - return( m_dataDir ); + return m_dataDir; } const QString & workingDir( void ) const { - return( m_workingDir ); + return m_workingDir; } QString userProjectsDir( void ) const { - return( workingDir() + PROJECTS_PATH ); + return workingDir() + PROJECTS_PATH; } QString userPresetsDir( void ) const { - return( workingDir() + PRESETS_PATH ); + return workingDir() + PRESETS_PATH; } QString userSamplesDir( void ) const { - return( workingDir() + SAMPLES_PATH ); + return workingDir() + SAMPLES_PATH; } QString factoryProjectsDir( void ) const { - return( dataDir() + PROJECTS_PATH ); + return dataDir() + PROJECTS_PATH; } QString factoryPresetsDir( void ) const { - return( dataDir() + PRESETS_PATH ); + return dataDir() + PRESETS_PATH; } QString factorySamplesDir( void ) const { - return( dataDir() + SAMPLES_PATH ); + return dataDir() + SAMPLES_PATH; } QString defaultArtworkDir( void ) const { - return( m_dataDir + DEFAULT_THEME_PATH ); + return m_dataDir + DEFAULT_THEME_PATH; } QString artworkDir( void ) const { - return( m_artworkDir ); - } - - QString trackIconsDir( void ) const - { - return( m_dataDir + TRACK_ICON_PATH ); + return m_artworkDir; } QString localeDir( void ) const { - return( m_dataDir + LOCALE_PATH ); + return m_dataDir + LOCALE_PATH; } const QString & pluginDir( void ) const { - return( m_pluginDir ); + return m_pluginDir; } const QString & vstDir( void ) const { - return( m_vstDir ); + return m_vstDir; } const QString & flDir( void ) const { - return( m_flDir ); + return m_flDir; } const QString & ladspaDir( void ) const { - return( m_ladDir ); + return m_ladDir; } #ifdef LMMS_HAVE_STK const QString & stkDir( void ) const { - return( m_stkDir ); + return m_stkDir; } #endif #ifdef LMMS_HAVE_FLUIDSYNTH - const QString & defaultSoundfont( void ) const + const ResourceItem * defaultSoundfont( void ) const { - return( m_defaultSoundfont ); + return m_defaultSoundfont; } #endif const QString & backgroundArtwork( void ) const { - return( m_backgroundArtwork ); + return m_backgroundArtwork; } inline const QStringList & recentlyOpenedProjects( void ) const { - return( m_recentlyOpenedProjects ); + return m_recentlyOpenedProjects; } void addRecentlyOpenedProject( const QString & _file ); @@ -180,7 +173,7 @@ public: void setFLDir( const QString & _fd ); void setLADSPADir( const QString & _fd ); void setSTKDir( const QString & _fd ); - void setDefaultSoundfont( const QString & _sf ); + void setDefaultSoundfont( const ResourceItem * _sf ); void setBackgroundArtwork( const QString & _ba ); @@ -204,7 +197,7 @@ private: QString m_stkDir; #endif #ifdef LMMS_HAVE_FLUIDSYNTH - QString m_defaultSoundfont; + ResourceItem * m_defaultSoundfont; #endif QString m_backgroundArtwork; QStringList m_recentlyOpenedProjects; diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 7a7115c4f..7d8fed60f 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -1,9 +1,7 @@ -#ifndef SINGLE_SOURCE_COMPILE - /* * config_mgr.cpp - implementation of class configManager * - * Copyright (c) 2005-2008 Tobias Doerffel + * Copyright (c) 2005-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -31,18 +29,22 @@ #include #include +#include "ResourceItem.h" +#include "UnifiedResourceProvider.h" +#include "ResourceDB.h" #include "lmmsversion.h" #include "config_mgr.h" #include "main_window.h" #include "engine.h" + static inline QString ensureTrailingSlash( const QString & _s ) { if( _s.right( 1 ) != QDir::separator() ) { - return( _s + QDir::separator() ); + return _s + QDir::separator(); } - return( _s ); + return _s; } @@ -69,7 +71,8 @@ configManager::configManager( void ) : m_pluginDir( QString( PLUGIN_DIR ) ), #endif m_vstDir( m_workingDir + "vst" + QDir::separator() ), - m_flDir( QDir::home().absolutePath() ) + m_flDir( QDir::home().absolutePath() ), + m_defaultSoundfont( NULL ) { } @@ -78,6 +81,7 @@ configManager::configManager( void ) : configManager::~configManager() { + delete m_defaultSoundfont; } @@ -133,10 +137,11 @@ void configManager::setSTKDir( const QString & _fd ) -void configManager::setDefaultSoundfont( const QString & _sf ) +void configManager::setDefaultSoundfont( const ResourceItem * _sf ) { #ifdef LMMS_HAVE_FLUIDSYNTH - m_defaultSoundfont = _sf; + delete m_defaultSoundfont; + m_defaultSoundfont = new ResourceItem( *_sf ); #endif } @@ -177,12 +182,13 @@ const QString & configManager::value( const QString & _class, { if( ( *it ).first == _attribute ) { - return( ( *it ).second ); + return ( *it ).second; } } } + static QString empty; - return( empty ); + return empty; } @@ -287,7 +293,11 @@ void configManager::loadConfigFile( void ) setSTKDir( value( "paths", "stkdir" ) ); #endif #ifdef LMMS_HAVE_FLUIDSYNTH - setDefaultSoundfont( value( "paths", "defaultsf2" ) ); + /*setDefaultSoundfont( + engine::resourceProvider()-> + database()->itemByHash( + value( "paths", + "defaultsf2" ) ) );*/ #endif setBackgroundArtwork( value( "paths", "backgroundartwork" ) ); } @@ -364,7 +374,9 @@ void configManager::saveConfigFile( void ) setValue( "paths", "stkdir", m_stkDir ); #endif #ifdef LMMS_HAVE_FLUIDSYNTH - setValue( "paths", "defaultsf2", m_defaultSoundfont ); + setValue( "paths", "defaultsf2", + m_defaultSoundfont ? + m_defaultSoundfont->hash() : QString() ); #endif setValue( "paths", "backgroundartwork", m_backgroundArtwork ); @@ -420,5 +432,3 @@ void configManager::saveConfigFile( void ) } - -#endif diff --git a/src/gui/setup_dialog.cpp b/src/gui/setup_dialog.cpp index 598488236..dd3af4b19 100644 --- a/src/gui/setup_dialog.cpp +++ b/src/gui/setup_dialog.cpp @@ -1,9 +1,7 @@ -#ifndef SINGLE_SOURCE_COMPILE - /* * setup_dialog.cpp - dialog for setting up LMMS * - * Copyright (c) 2005-2008 Tobias Doerffel + * Copyright (c) 2005-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -112,7 +110,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) : m_flDir( configManager::inst()->flDir() ), m_ladDir( configManager::inst()->ladspaDir() ), #ifdef LMMS_HAVE_FLUIDSYNTH - m_defaultSoundfont( configManager::inst()->defaultSoundfont() ), +// m_defaultSoundfont( configManager::inst()->defaultSoundfont() ), #endif #ifdef LMMS_HAVE_STK m_stkDir( configManager::inst()->stkDir() ), @@ -909,7 +907,7 @@ void setupDialog::accept( void ) configManager::inst()->setFLDir( m_flDir ); configManager::inst()->setLADSPADir( m_ladDir ); #ifdef LMMS_HAVE_FLUIDSYNTH - configManager::inst()->setDefaultSoundfont( m_defaultSoundfont ); + //configManager::inst()->setDefaultSoundfont( m_defaultSoundfont ); #endif #ifdef LMMS_HAVE_STK configManager::inst()->setSTKDir( m_stkDir ); @@ -1434,5 +1432,3 @@ void setupDialog::displayMclHelp( void ) #include "moc_setup_dialog.cxx" - -#endif