[vlmc-devel] Timeline: Take advantage of projectLoading signal to inintialize Renderer related components
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 22:30:59 2014 +0300| [5e121841fb20cb77cf05a199372afd8afeef32cc] | committer: Hugo Beauzée-Luyssen
Timeline: Take advantage of projectLoading signal to inintialize Renderer related components
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=5e121841fb20cb77cf05a199372afd8afeef32cc
---
src/Gui/MainWindow.cpp | 1 -
src/Gui/timeline/Timeline.cpp | 33 ++++++++++++++++++---------------
src/Gui/timeline/Timeline.h | 4 +++-
3 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 4efd23a..beeddff 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -847,7 +847,6 @@ MainWindow::onProjectLoading(Project* project)
const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
connect( project->library(), SIGNAL( clipRemoved( const QUuid& ) ), clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
- m_timeline->setRenderer( project->workflowRenderer() );
m_projectPreview->setRenderer( project->workflowRenderer() );
}
diff --git a/src/Gui/timeline/Timeline.cpp b/src/Gui/timeline/Timeline.cpp
index 2eba749..2d92beb 100644
--- a/src/Gui/timeline/Timeline.cpp
+++ b/src/Gui/timeline/Timeline.cpp
@@ -23,6 +23,7 @@
#include "Timeline.h"
#include "Project/Project.h"
+#include "Main/Core.h"
#include "Media/Clip.h"
#include "Workflow/ClipHelper.h"
#include "TracksView.h"
@@ -98,20 +99,14 @@ Timeline::Timeline( QWidget *parent )
connect( m_tracksView, SIGNAL( audioTrackRemoved() ),
m_tracksControls, SLOT( removeAudioTrack() ) );
- // Frames updates
- connect( m_renderer, SIGNAL( frameChanged(qint64, Vlmc::FrameChangedReason) ),
- m_tracksView->tracksCursor(), SLOT( frameChanged( qint64, Vlmc::FrameChangedReason ) ),
- Qt::QueuedConnection );
- connect( m_renderer, SIGNAL( frameChanged(qint64,Vlmc::FrameChangedReason) ),
- m_tracksRuler, SLOT( update() ) );
- connect( m_tracksRuler, SIGNAL( frameChanged(qint64,Vlmc::FrameChangedReason) ),
- m_renderer, SLOT( rulerCursorChanged(qint64)) );
-
// Cursor position updates
connect( m_tracksView->tracksCursor(), SIGNAL( cursorPositionChanged( qint64 ) ),
m_renderer, SLOT( timelineCursorChanged(qint64) ) );
m_tracksView->createLayout();
+
+ connect( Core::getInstance(), SIGNAL( projectLoading( Project* ) ),
+ this, SLOT( projectLoading( Project* ) ), Qt::DirectConnection );
}
Timeline::~Timeline()
@@ -160,6 +155,20 @@ Timeline::setTool( ToolButtons button )
}
void
+Timeline::projectLoading( Project* project )
+{
+ m_renderer = project->workflowRenderer();
+ // Frames updates
+ connect( m_renderer, SIGNAL( frameChanged(qint64, Vlmc::FrameChangedReason) ),
+ m_tracksView->tracksCursor(), SLOT( frameChanged( qint64, Vlmc::FrameChangedReason ) ),
+ Qt::QueuedConnection );
+ connect( m_renderer, SIGNAL( frameChanged(qint64,Vlmc::FrameChangedReason) ),
+ m_tracksRuler, SLOT( update() ) );
+ connect( m_tracksRuler, SIGNAL( frameChanged(qint64,Vlmc::FrameChangedReason) ),
+ m_renderer, SLOT( rulerCursorChanged(qint64)) );
+}
+
+void
Timeline::save( QXmlStreamWriter &project ) const
{
project.writeStartElement( "timeline" );
@@ -229,9 +238,3 @@ Timeline::load( const QDomElement &root )
elem = elem.nextSiblingElement();
}
}
-
-void
-Timeline::setRenderer( WorkflowRenderer* renderer )
-{
- m_renderer = renderer;
-}
diff --git a/src/Gui/timeline/Timeline.h b/src/Gui/timeline/Timeline.h
index 53c3988..e7c8e16 100644
--- a/src/Gui/timeline/Timeline.h
+++ b/src/Gui/timeline/Timeline.h
@@ -32,6 +32,7 @@
#include <QXmlStreamWriter>
class MainWorkflow;
+class Project;
class TracksScene;
class TracksView;
class TracksControls;
@@ -62,7 +63,6 @@ public:
void save( QXmlStreamWriter& project ) const;
void load( const QDomElement &root );
- void setRenderer( WorkflowRenderer* renderer );
public slots:
/**
@@ -84,6 +84,8 @@ public slots:
*/
void setTool( ToolButtons button );
+ void projectLoading( Project* project );
+
protected:
virtual void changeEvent( QEvent *e );
More information about the Vlmc-devel
mailing list