[vlmc-devel] Timeline: Fix project loading.

Hugo Beauzée-Luyssen git at videolan.org
Tue Sep 4 23:13:45 CEST 2012


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Sep  4 23:09:45 2012 +0300| [520451f51c08a7474db1ab88f3933cee5893a234] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=520451f51c08a7474db1ab88f3933cee5893a234
---

 src/Gui/timeline/TracksView.cpp |   37 +++++++++++++++++++++++--------------
 src/Workflow/MainWorkflow.cpp   |    9 ++++++++-
 src/Workflow/MainWorkflow.h     |    7 +++++++
 3 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 3b676a8..dcec9f6 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -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 )
     {
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 4bd4de4..00c81cb 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -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 )
 {
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index cd4252e..5994ece 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -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>;
 



More information about the Vlmc-devel mailing list