Commit 520451f5 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Timeline: Fix project loading.

Connect TracksView and TrackWorkflow when the timeline is created, not
when a track is added.
Otherwise, the addItem slot would not be triggered when adding
an item to a track that has no visual representation.
parent cc58d69b
......@@ -86,6 +86,29 @@ TracksView::TracksView( QGraphicsScene *scene, MainWorkflow *mainWorkflow,
connect( m_cursorLine, SIGNAL( cursorMoved(qint64) ),
this, SLOT( ensureCursorVisible() ) );
for ( quint32 type = Workflow::VideoTrack; type < Workflow::NbTrackType; ++type )
{
for ( quint32 i = 0; i < m_mainWorkflow->trackCount(); ++i )
{
TrackWorkflow *tw = m_mainWorkflow->track( static_cast<Workflow::TrackType>( type ), i );
//Clips part:
connect( tw, SIGNAL( clipAdded( TrackWorkflow*, Workflow::Helper*, qint64 ) ),
this, SLOT( addItem( TrackWorkflow*, Workflow::Helper*, qint64 ) ) );
connect( tw, SIGNAL( clipRemoved( TrackWorkflow*, const QUuid& ) ),
this, SLOT( removeItem( TrackWorkflow*, const QUuid& ) ) );
connect( tw, SIGNAL( clipMoved( TrackWorkflow*, const QUuid&, qint64 ) ),
this, SLOT( moveItem( TrackWorkflow*, const QUuid&, qint64 ) ) );
//Effect part:
connect( tw, SIGNAL( effectAdded( TrackWorkflow*, Workflow::Helper*, qint64 ) ),
this, SLOT(addItem( TrackWorkflow*, Workflow::Helper*, qint64 ) ), Qt::QueuedConnection );
connect( tw, SIGNAL( effectRemoved( TrackWorkflow*, QUuid ) ),
this, SLOT( removeItem( TrackWorkflow*, QUuid ) ), Qt::QueuedConnection );
connect( tw, SIGNAL( effectMoved( TrackWorkflow*, QUuid, qint64 ) ),
this, SLOT( moveItem( TrackWorkflow*, QUuid, qint64 ) ), Qt::QueuedConnection );
}
}
}
void
......@@ -130,20 +153,6 @@ TracksView::addTrack( Workflow::TrackType type )
m_layout->activate();
m_cursorLine->setHeight( m_layout->contentsRect().height() );
m_scene->invalidate(); // Redraw the background
//Clips part:
connect( track->trackWorkflow(), SIGNAL( clipAdded( TrackWorkflow*, Workflow::Helper*, qint64 ) ),
this, SLOT( addItem( TrackWorkflow*, Workflow::Helper*, qint64 ) ) );
connect( track->trackWorkflow(), SIGNAL( clipRemoved( TrackWorkflow*, const QUuid& ) ),
this, SLOT( removeItem( TrackWorkflow*, const QUuid& ) ) );
connect( track->trackWorkflow(), SIGNAL( clipMoved( TrackWorkflow*, const QUuid&, qint64 ) ),
this, SLOT( moveItem( TrackWorkflow*, const QUuid&, qint64 ) ) );
//Effect part:
connect( track->trackWorkflow(), SIGNAL( effectAdded( TrackWorkflow*, Workflow::Helper*, qint64 ) ),
this, SLOT(addItem( TrackWorkflow*, Workflow::Helper*, qint64 ) ), Qt::QueuedConnection );
connect( track->trackWorkflow(), SIGNAL( effectRemoved( TrackWorkflow*, QUuid ) ),
this, SLOT( removeItem( TrackWorkflow*, QUuid ) ), Qt::QueuedConnection );
connect( track->trackWorkflow(), SIGNAL( effectMoved( TrackWorkflow*, QUuid, qint64 ) ),
this, SLOT( moveItem( TrackWorkflow*, QUuid, qint64 ) ), Qt::QueuedConnection );
if ( type == Workflow::VideoTrack )
{
......
......@@ -42,7 +42,8 @@ MainWorkflow::MainWorkflow( int trackCount ) :
m_lengthFrame( 0 ),
m_renderStarted( false ),
m_width( 0 ),
m_height( 0 )
m_height( 0 ),
m_trackCount( trackCount )
{
m_currentFrameLock = new QReadWriteLock;
m_renderStartedMutex = new QMutex;
......@@ -400,6 +401,12 @@ MainWorkflow::blackOutput() const
return m_blackOutput;
}
quint32
MainWorkflow::trackCount() const
{
return m_trackCount;
}
void
MainWorkflow::lengthUpdated( qint64 )
{
......
......@@ -253,6 +253,11 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
const Workflow::Frame *blackOutput() const;
/**
* \brief Return the number of track for each track type.
*/
quint32 trackCount() const;
private:
MainWorkflow( int trackCount = 64 );
~MainWorkflow();
......@@ -304,6 +309,8 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
quint32 m_width;
/// Height used for the render
quint32 m_height;
/// Store the number of track for each track type.
const quint32 m_trackCount;
friend class Singleton<MainWorkflow>;
......
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