Commit 9711575e authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Workflow length is now updated everywhere, for every case.

This fixes issue #30.
parent 7f0a978e
......@@ -72,22 +72,28 @@ void MainWorkflow::addClip( Clip* clip, unsigned int trackId, qint64 start )
m_length = m_tracks[trackId]->getLength();
}
void MainWorkflow::startRender()
void MainWorkflow::computeLength()
{
qint64 maxLength = 0;
m_renderStarted = true;
m_currentFrame = 0;
emit frameChanged( 0 );
for ( unsigned int i = 0; i < m_trackCount; ++i )
{
m_tracks[i].activate();
if ( m_tracks[i]->getLength() > maxLength )
maxLength = m_tracks[i]->getLength();
}
m_length = maxLength;
}
void MainWorkflow::startRender()
{
m_renderStarted = true;
m_currentFrame = 0;
emit frameChanged( 0 );
for ( unsigned int i = 0; i < m_trackCount; ++i )
m_tracks[i].activate();
computeLength();
}
unsigned char* MainWorkflow::getOutput()
{
QReadLocker lock( m_renderStartedLock );
......@@ -217,6 +223,7 @@ void MainWorkflow::clipMoved( QUuid clipUuid, int oldTrack, int newTra
m_tracks[oldTrack].activate();
m_tracks[newTrack].activate();
}
computeLength();
}
void MainWorkflow::activateOneFrameOnly()
......
......@@ -80,6 +80,10 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
private:
static MainWorkflow* m_instance;
private:
void computeLength();
private:
Toggleable<TrackWorkflow*>* m_tracks;
qint64 m_currentFrame;
......
......@@ -52,10 +52,8 @@ TrackWorkflow::~TrackWorkflow()
void TrackWorkflow::addClip( Clip* clip, qint64 start )
{
QWriteLocker lock( m_clipsLock );
ClipWorkflow* cw = new ClipWorkflow( clip );
m_clips.insert( start, cw );
computeLength();
addClip( cw, start );
}
void TrackWorkflow::addClip( ClipWorkflow* cw, qint64 start )
......@@ -410,6 +408,7 @@ void TrackWorkflow::moveClip( const QUuid& id, qint64 startingFrame )
m_clips[startingFrame] = cw;
QMutexLocker lock( m_forceRepositionningMutex );
m_forceRepositionning = true;
computeLength();
return ;
}
++it;
......@@ -434,6 +433,7 @@ Clip* TrackWorkflow::removeClip( const QUuid& id )
m_clips.erase( it );
// stopClipWorkflow( cw );
// delete cw;
computeLength();
return clip;
}
++it;
......
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