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

Method loadSettings

src/core/Track.cpp:2122–2186  ·  view source on GitHub ↗

! \brief Load the settings from a file * * We load the track's type and muted state and solo state, then clear out our * current TrackContentObject. * * Then we step through the QDomElement's children and load the * track-specific settings and trackContentObjects states from it * one at a time. * * \param element the QDomElement to load track settings from * \todo Load the track h

Source from the content-addressed store, hash-verified

2120 * \todo Load the track height.
2121 */
2122void Track::loadSettings( const QDomElement & element )
2123{
2124 if( element.attribute( "type" ).toInt() != type() )
2125 {
2126 qWarning( "Current track-type does not match track-type of "
2127 "settings-node!\n" );
2128 }
2129
2130 setName( element.hasAttribute( "name" ) ? element.attribute( "name" ) :
2131 element.firstChild().toElement().attribute( "name" ) );
2132
2133 m_mutedModel.loadSettings( element, "muted" );
2134 m_soloModel.loadSettings( element, "solo" );
2135
2136 if( m_simpleSerializingMode )
2137 {
2138 QDomNode node = element.firstChild();
2139 while( !node.isNull() )
2140 {
2141 if( node.isElement() && node.nodeName() == nodeName() )
2142 {
2143 loadTrackSpecificSettings( node.toElement() );
2144 break;
2145 }
2146 node = node.nextSibling();
2147 }
2148 m_simpleSerializingMode = false;
2149 return;
2150 }
2151
2152 while( !m_trackContentObjects.empty() )
2153 {
2154 delete m_trackContentObjects.front();
2155// m_trackContentObjects.erase( m_trackContentObjects.begin() );
2156 }
2157
2158 QDomNode node = element.firstChild();
2159 while( !node.isNull() )
2160 {
2161 if( node.isElement() )
2162 {
2163 if( node.nodeName() == nodeName() )
2164 {
2165 loadTrackSpecificSettings( node.toElement() );
2166 }
2167 else if( node.nodeName() != "muted"
2168 && node.nodeName() != "solo"
2169 && !node.toElement().attribute( "metadata" ).toInt() )
2170 {
2171 TrackContentObject * tco = createTCO(
2172 MidiTime( 0 ) );
2173 tco->restoreState( node.toElement() );
2174 saveJournallingState( false );
2175 restoreJournallingState();
2176 }
2177 }
2178 node = node.nextSibling();
2179 }

Callers

nothing calls this directly

Calls 10

MidiTimeClass · 0.85
saveJournallingStateFunction · 0.85
restoreJournallingStateFunction · 0.85
isNullMethod · 0.80
typeFunction · 0.50
setNameFunction · 0.50
nodeNameFunction · 0.50
nodeNameMethod · 0.45
emptyMethod · 0.45
restoreStateMethod · 0.45

Tested by

no test coverage detected