load given song
| 1011 | |
| 1012 | // load given song |
| 1013 | void 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() ); |
no test coverage detected