[vlmc-devel] Timeline: Build the actual timeline when the project is loading

Hugo Beauzée-Luyssen git at videolan.org
Mon Mar 31 22:42:31 CEST 2014


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Mar 31 23:12:09 2014 +0300| [c3a7efa8d490d2e0575e514bdf2a8cf68a518c67] | committer: Hugo Beauzée-Luyssen

Timeline: Build the actual timeline when the project is loading

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

 src/Gui/timeline/Timeline.cpp |   58 ++++++++++++++++++++++++++---------------
 src/Gui/timeline/Timeline.h   |    3 +++
 2 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/src/Gui/timeline/Timeline.cpp b/src/Gui/timeline/Timeline.cpp
index 2d92beb..26a533e 100644
--- a/src/Gui/timeline/Timeline.cpp
+++ b/src/Gui/timeline/Timeline.cpp
@@ -41,13 +41,44 @@ Timeline*   Timeline::m_instance = NULL;
 
 Timeline::Timeline( QWidget *parent )
     : QWidget( parent )
+    , m_tracksView( NULL )
+    , m_tracksScene( NULL )
+    , m_tracksRuler( NULL )
+    , m_tracksControls( NULL )
     , m_scale( 1.0 )
 {
     Q_ASSERT( m_instance == NULL );
     m_instance = this;
     m_ui.setupUi( this );
 
-    m_mainWorkflow = Project::getInstance()->workflow();
+    connect( Core::getInstance(), SIGNAL( projectLoading( Project* ) ),
+             this, SLOT( projectLoading( Project* ) ), Qt::DirectConnection );
+}
+
+Timeline::~Timeline()
+{
+}
+
+void
+Timeline::changeEvent( QEvent *e )
+{
+    switch ( e->type() )
+    {
+    case QEvent::LanguageChange:
+        m_ui.retranslateUi( this );
+        break;
+    default:
+        break;
+    }
+}
+
+void
+Timeline::initialize()
+{
+    delete m_tracksControls;
+    delete m_tracksRuler;
+    delete m_tracksView;
+    delete m_tracksScene;
 
     m_tracksScene = new TracksScene( this );
     m_tracksView = new TracksView( m_tracksScene, m_mainWorkflow, m_renderer, m_ui.tracksFrame );
@@ -104,26 +135,6 @@ Timeline::Timeline( QWidget *parent )
              m_renderer, SLOT( timelineCursorChanged(qint64) ) );
 
     m_tracksView->createLayout();
-
-    connect( Core::getInstance(), SIGNAL( projectLoading( Project* ) ),
-             this, SLOT( projectLoading( Project* ) ), Qt::DirectConnection );
-}
-
-Timeline::~Timeline()
-{
-}
-
-void
-Timeline::changeEvent( QEvent *e )
-{
-    switch ( e->type() )
-    {
-    case QEvent::LanguageChange:
-        m_ui.retranslateUi( this );
-        break;
-    default:
-        break;
-    }
 }
 
 void
@@ -158,6 +169,11 @@ void
 Timeline::projectLoading( Project* project )
 {
     m_renderer = project->workflowRenderer();
+    m_mainWorkflow = project->workflow();
+
+    // Initialize child components:
+    initialize();
+
     // Frames updates
     connect( m_renderer, SIGNAL( frameChanged(qint64, Vlmc::FrameChangedReason) ),
              m_tracksView->tracksCursor(), SLOT( frameChanged( qint64, Vlmc::FrameChangedReason ) ),
diff --git a/src/Gui/timeline/Timeline.h b/src/Gui/timeline/Timeline.h
index e7c8e16..f435c8b 100644
--- a/src/Gui/timeline/Timeline.h
+++ b/src/Gui/timeline/Timeline.h
@@ -90,6 +90,9 @@ protected:
     virtual void changeEvent( QEvent *e );
 
 private:
+    void    initialize();
+
+private:
     Ui::Timeline        m_ui;
     TracksView*         m_tracksView;
     TracksScene*        m_tracksScene;



More information about the Vlmc-devel mailing list