MCPcopy Create free account
hub / github.com/LMMS/lmms / loadConfigFile

Method loadConfigFile

src/core/ConfigManager.cpp:418–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416
417
418void ConfigManager::loadConfigFile( const QString & configFile )
419{
420 // read the XML file and create DOM tree
421 // Allow configuration file override through --config commandline option
422 if ( !configFile.isEmpty() )
423 {
424 m_lmmsRcFile = configFile;
425 }
426
427 QFile cfg_file( m_lmmsRcFile );
428 QDomDocument dom_tree;
429
430 if( cfg_file.open( QIODevice::ReadOnly ) )
431 {
432 QString errorString;
433 int errorLine, errorCol;
434 if( dom_tree.setContent( &cfg_file, false, &errorString, &errorLine, &errorCol ) )
435 {
436 // get the head information from the DOM
437 QDomElement root = dom_tree.documentElement();
438
439 QDomNode node = root.firstChild();
440
441 // Cache the config version for upgrade()
442 if ( !root.attribute( "version" ).isNull() ) {
443 m_version = root.attribute( "version" );
444 }
445
446 // create the settings-map out of the DOM
447 while( !node.isNull() )
448 {
449 if( node.isElement() &&
450 node.toElement().hasAttributes () )
451 {
452 stringPairVector attr;
453 QDomNamedNodeMap node_attr =
454 node.toElement().attributes();
455 for( int i = 0; i < node_attr.count();
456 ++i )
457 {
458 QDomNode n = node_attr.item( i );
459 if( n.isAttr() )
460 {
461 attr.push_back( qMakePair( n.toAttr().name(),
462 n.toAttr().value() ) );
463 }
464 }
465 m_settings[node.nodeName()] = attr;
466 }
467 else if( node.nodeName() == "recentfiles" )
468 {
469 m_recentlyOpenedProjects.clear();
470 QDomNode n = node.firstChild();
471 while( !n.isNull() )
472 {
473 if( n.isElement() && n.toElement().hasAttributes() )
474 {
475 m_recentlyOpenedProjects <<

Callers 1

main.cppFile · 0.80

Calls 15

defaultArtworkDirFunction · 0.85
ensureTrailingSlashFunction · 0.85
userLadspaDirFunction · 0.85
artworkDirFunction · 0.85
openMethod · 0.80
isNullMethod · 0.80
countMethod · 0.80
existsMethod · 0.80
valueFunction · 0.50
isEmptyMethod · 0.45
nameMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected