Commit 0e3fcb22 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Adding a clear() method for the mainWorkflow.

It's called when a project is loaded.
parent 22217ee3
......@@ -400,6 +400,8 @@ void MainWorkflow::loadProject( const QDomElement& project )
return ;
}
clear();
QDomElement elem = project.firstChild().toElement();
while ( elem.isNull() == false )
......@@ -489,3 +491,12 @@ void MainWorkflow::saveProject( QDomDocument& doc )
}
doc.appendChild( project );
}
void MainWorkflow::clear()
{
for ( unsigned int i = 0; i < m_trackCount; ++i )
{
m_tracks[i]->clear();
}
m_length = 0;
}
......@@ -109,6 +109,8 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
*/
Clip* getClip( const QUuid& uuid, unsigned int trackId );
void clear();
private:
static MainWorkflow* m_instance;
......
......@@ -547,3 +547,18 @@ void TrackWorkflow::save( QDomDocument& doc, QDomElement& trackNode ) const
}
}
void TrackWorkflow::clear()
{
QWriteLocker lock( m_clipsLock );
QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
for ( ; it != end; ++it )
{
ClipWorkflow* cw = it.value();
delete cw->getClip();
delete cw;
}
m_clips.clear();
m_length = 0;
}
......@@ -70,6 +70,7 @@ class TrackWorkflow : public QObject
static const unsigned int nbFrameBeforePreload = 60;
void save( QDomDocument& doc, QDomElement& trackNode ) const;
void clear();
private:
void computeLength();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment