Commit 55b9c518 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MainWorkflow: Check for TrackHandler length changes.

parent 63d3f687
......@@ -55,6 +55,8 @@ MainWorkflow::MainWorkflow( int trackCount ) :
m_tracks[i] = new TrackHandler( trackCount, trackType );
connect( m_tracks[i], SIGNAL( tracksEndReached() ),
this, SLOT( tracksEndReached() ) );
connect( m_tracks[i], SIGNAL( lengthChanged(qint64) ),
this, SLOT( lengthUpdated( qint64 ) ) );
m_currentFrame[i] = 0;
}
}
......@@ -488,3 +490,20 @@ MainWorkflow::blackOutput() const
{
return m_blackOutput;
}
void
MainWorkflow::lengthUpdated( qint64 )
{
qint64 maxLength = 0;
for ( unsigned int i = 0; i < Workflow::NbTrackType; ++i )
{
if ( m_tracks[i]->getLength() > maxLength )
maxLength = m_tracks[i]->getLength();
}
if ( m_lengthFrame != maxLength )
{
m_lengthFrame = maxLength;
emit lengthChanged( m_lengthFrame );
}
}
......@@ -414,6 +414,8 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
*/
void clear();
void lengthUpdated( qint64 lengthUpdated );
signals:
/**
* \brief Used to notify a change to the timeline and preview widget cursor
......
......@@ -278,20 +278,18 @@ TrackHandler::stopFrameComputing()
}
void
TrackHandler::lengthUpdated( qint64 newLength )
TrackHandler::lengthUpdated( qint64 )
{
//If the new length is bigger, or if the track that has been resized was the
if ( newLength > m_length )
m_length = newLength;
else
{
qint64 maxLength = 0;
qint64 maxLength = 0;
for ( unsigned int i = 0; i < m_trackCount; ++i )
{
if ( m_tracks[i]->getLength() > maxLength )
maxLength = m_tracks[i]->getLength();
}
for ( unsigned int i = 0; i < m_trackCount; ++i )
{
if ( m_tracks[i]->getLength() > maxLength )
maxLength = m_tracks[i]->getLength();
}
if ( maxLength != m_length )
{
m_length = maxLength;
emit lengthChanged( m_length );
}
}
......@@ -120,6 +120,7 @@ class TrackHandler : public QObject
signals:
void tracksEndReached();
void lengthChanged( qint64 );
};
#endif // TRACKHANDLER_H
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