fixed paths when starting with no configuration file

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1636 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-19 15:42:32 +00:00
parent 002e8edd0e
commit a170f7209a
4 changed files with 92 additions and 76 deletions

View File

@@ -1,3 +1,25 @@
2008-09-19 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/config_mgr.h:
* src/core/config_mgr.cpp:
* src/core/main.cpp:
fixed paths when starting with no configuration file
* src/core/timeline.cpp:
* src/core/track.cpp:
* data/themes/default/playpos_marker.png:
* data/themes/default/loop_points_on.png:
* data/themes/default/style.css:
* data/themes/default/loop_point_disabled.png:
* data/themes/default/autoscroll_off.png:
* data/themes/default/loop_point.png:
* data/themes/default/autoscroll_on.png:
* data/themes/default/loop_points_off.png:
improved visual appearence of timeline
* CMakeLists.txt:
improved detection of Qt4 translation directory
2008-09-18 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/gui/fx_mixer_view.cpp:

View File

@@ -165,7 +165,7 @@ public:
void setValue( const QString & _class, const QString & _attribute,
const QString & _value );
bool loadConfigFile( void );
void loadConfigFile( void );
void saveConfigFile( void );

View File

@@ -202,7 +202,7 @@ void configManager::setValue( const QString & _class,
bool configManager::loadConfigFile( void )
void configManager::loadConfigFile( void )
{
// read the XML file and create DOM tree
QFile cfg_file( m_lmmsRcFile );
@@ -210,79 +210,78 @@ bool configManager::loadConfigFile( void )
if( cfg_file.open( QIODevice::ReadOnly ) )
{
if( !dom_tree.setContent( &cfg_file ) )
if( dom_tree.setContent( &cfg_file ) )
{
// return( FALSE );
// get the head information from the DOM
QDomElement root = dom_tree.documentElement();
QDomNode node = root.firstChild();
// create the settings-map out of the DOM
while( !node.isNull() )
{
if( node.isElement() &&
node.toElement().hasAttributes () )
{
stringPairVector attr;
QDomNamedNodeMap node_attr =
node.toElement().attributes();
for( int i = 0; i < node_attr.count();
++i )
{
QDomNode n = node_attr.item( i );
if( n.isAttr() )
{
attr.push_back( qMakePair( n.toAttr().name(),
n.toAttr().value() ) );
}
}
m_settings[node.nodeName()] = attr;
}
else if( node.nodeName() == "recentfiles" )
{
m_recentlyOpenedProjects.clear();
QDomNode n = node.firstChild();
while( !n.isNull() )
{
if( n.isElement() && n.toElement().hasAttributes() )
{
m_recentlyOpenedProjects <<
n.toElement().attribute( "path" );
}
n = n.nextSibling();
}
}
node = node.nextSibling();
}
if( value( "paths", "artwork" ) != "" )
{
m_artworkDir = value( "paths", "artwork" );
if( !QDir( m_artworkDir ).exists() )
{
m_artworkDir = defaultArtworkDir();
}
if( m_artworkDir.right( 1 ) !=
QDir::separator() )
{
m_artworkDir += QDir::separator();
}
}
setWorkingDir( value( "paths", "workingdir" ) );
setVSTDir( value( "paths", "vstdir" ) );
setFLDir( value( "paths", "fldir" ) );
setLADSPADir( value( "paths", "laddir" ) );
#ifdef LMMS_HAVE_STK
setSTKDir( value( "paths", "stkdir" ) );
#endif
#ifdef LMMS_HAVE_FLUIDSYNTH
setDefaultSoundfont( value( "paths", "defaultsf2" ) );
#endif
}
cfg_file.close();
}
// get the head information from the DOM
QDomElement root = dom_tree.documentElement();
QDomNode node = root.firstChild();
// create the settings-map out of the DOM
while( !node.isNull() )
{
if( node.isElement() && node.toElement().hasAttributes () )
{
stringPairVector attr;
QDomNamedNodeMap node_attr =
node.toElement().attributes();
for( int i = 0; i < node_attr.count(); ++i )
{
QDomNode n = node_attr.item( i );
if( n.isAttr() )
{
attr.push_back( qMakePair(
n.toAttr().name(),
n.toAttr().value() ) );
}
}
m_settings[node.nodeName()] = attr;
}
else if( node.nodeName() == "recentfiles" )
{
m_recentlyOpenedProjects.clear();
QDomNode n = node.firstChild();
while( !n.isNull() )
{
if( n.isElement() &&
n.toElement().hasAttributes() )
{
m_recentlyOpenedProjects <<
n.toElement().
attribute( "path" );
}
n = n.nextSibling();
}
}
node = node.nextSibling();
}
if( value( "paths", "artwork" ) != "" )
{
m_artworkDir = value( "paths", "artwork" );
if( QDir( m_artworkDir ).exists() == FALSE )
{
m_artworkDir = defaultArtworkDir();
}
if( m_artworkDir.right( 1 ) != QDir::separator() )
{
m_artworkDir += QDir::separator();
}
}
setWorkingDir( value( "paths", "workingdir" ) );
setVSTDir( value( "paths", "vstdir" ) );
setFLDir( value( "paths", "fldir" ) );
setLADSPADir( value( "paths", "laddir" ) );
#ifdef LMMS_HAVE_STK
setSTKDir( value( "paths", "stkdir" ) );
#endif
#ifdef LMMS_HAVE_FLUIDSYNTH
setDefaultSoundfont( value( "paths", "defaultsf2" ) );
#endif
if( m_vstDir == "" )
{
@@ -333,7 +332,6 @@ bool configManager::loadConfigFile( void )
QDir().mkpath( userSamplesDir() );
QDir().mkpath( userPresetsDir() );
}
return( TRUE );
}

View File

@@ -335,11 +335,7 @@ int main( int argc, char * * argv )
#endif
#endif
if( !configManager::inst()->loadConfigFile() )
{
printf( "could not load config file!\n" );
return( EXIT_FAILURE );
}
configManager::inst()->loadConfigFile();
if( render_out.isEmpty() && file_to_save.isEmpty() )
{