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

Method loadProject

src/core/Song.cpp:1013–1192  ·  view source on GitHub ↗

load given song

Source from the content-addressed store, hash-verified

1011
1012// load given song
1013void Song::loadProject( const QString & fileName )
1014{
1015 QDomNode node;
1016
1017 m_loadingProject = true;
1018
1019 Engine::projectJournal()->setJournalling( false );
1020
1021 m_oldFileName = m_fileName;
1022 m_fileName = fileName;
1023
1024 DataFile dataFile( m_fileName );
1025 // if file could not be opened, head-node is null and we create
1026 // new project
1027 if( dataFile.head().isNull() )
1028 {
1029 if( m_loadOnLaunch )
1030 {
1031 createNewProject();
1032 }
1033 m_fileName = m_oldFileName;
1034 return;
1035 }
1036
1037 m_oldFileName = m_fileName;
1038
1039 clearProject();
1040
1041 clearErrors();
1042
1043 Engine::mixer()->requestChangeInModel();
1044
1045 // get the header information from the DOM
1046 m_tempoModel.loadSettings( dataFile.head(), "bpm" );
1047 m_timeSigModel.loadSettings( dataFile.head(), "timesig" );
1048 m_masterVolumeModel.loadSettings( dataFile.head(), "mastervol" );
1049 m_masterPitchModel.loadSettings( dataFile.head(), "masterpitch" );
1050
1051 if( m_playPos[Mode_PlaySong].m_timeLine )
1052 {
1053 // reset loop-point-state
1054 m_playPos[Mode_PlaySong].m_timeLine->toggleLoopPoints( 0 );
1055 }
1056
1057 if( !dataFile.content().firstChildElement( "track" ).isNull() )
1058 {
1059 m_globalAutomationTrack->restoreState( dataFile.content().
1060 firstChildElement( "track" ) );
1061 }
1062
1063 //Backward compatibility for LMMS <= 0.4.15
1064 PeakController::initGetControllerBySetting();
1065
1066 // Load mixer first to be able to set the correct range for FX channels
1067 node = dataFile.content().firstChildElement( Engine::fxMixer()->nodeName() );
1068 if( !node.isNull() )
1069 {
1070 Engine::fxMixer()->restoreState( node.toElement() );

Callers 6

main.cppFile · 0.80
openProjectMethod · 0.80
dropEventMethod · 0.80
eventMethod · 0.80
handleFileMethod · 0.80

Calls 15

projectJournalFunction · 0.85
mixerFunction · 0.85
fxMixerFunction · 0.85
isCancelledFunction · 0.85
getBBTrackContainerFunction · 0.85
QTextStreamClass · 0.85
getSongFunction · 0.85
setJournallingMethod · 0.80
isNullMethod · 0.80
requestChangeInModelMethod · 0.80
toggleLoopPointsMethod · 0.80
refreshDisplayMethod · 0.80

Tested by

no test coverage detected