Commit 5e121841 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Timeline: Take advantage of projectLoading signal to inintialize Renderer related components

parent 90970a4d
...@@ -847,7 +847,6 @@ MainWindow::onProjectLoading(Project* project) ...@@ -847,7 +847,6 @@ MainWindow::onProjectLoading(Project* project)
const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() ); const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
connect( project->library(), SIGNAL( clipRemoved( const QUuid& ) ), clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) ); connect( project->library(), SIGNAL( clipRemoved( const QUuid& ) ), clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
m_timeline->setRenderer( project->workflowRenderer() );
m_projectPreview->setRenderer( project->workflowRenderer() ); m_projectPreview->setRenderer( project->workflowRenderer() );
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "Timeline.h" #include "Timeline.h"
#include "Project/Project.h" #include "Project/Project.h"
#include "Main/Core.h"
#include "Media/Clip.h" #include "Media/Clip.h"
#include "Workflow/ClipHelper.h" #include "Workflow/ClipHelper.h"
#include "TracksView.h" #include "TracksView.h"
...@@ -98,20 +99,14 @@ Timeline::Timeline( QWidget *parent ) ...@@ -98,20 +99,14 @@ Timeline::Timeline( QWidget *parent )
connect( m_tracksView, SIGNAL( audioTrackRemoved() ), connect( m_tracksView, SIGNAL( audioTrackRemoved() ),
m_tracksControls, SLOT( removeAudioTrack() ) ); 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 // Cursor position updates
connect( m_tracksView->tracksCursor(), SIGNAL( cursorPositionChanged( qint64 ) ), connect( m_tracksView->tracksCursor(), SIGNAL( cursorPositionChanged( qint64 ) ),
m_renderer, SLOT( timelineCursorChanged(qint64) ) ); m_renderer, SLOT( timelineCursorChanged(qint64) ) );
m_tracksView->createLayout(); m_tracksView->createLayout();
connect( Core::getInstance(), SIGNAL( projectLoading( Project* ) ),
this, SLOT( projectLoading( Project* ) ), Qt::DirectConnection );
} }
Timeline::~Timeline() Timeline::~Timeline()
...@@ -159,6 +154,20 @@ Timeline::setTool( ToolButtons button ) ...@@ -159,6 +154,20 @@ Timeline::setTool( ToolButtons button )
tracksView()->setTool( button ); tracksView()->setTool( 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 void
Timeline::save( QXmlStreamWriter &project ) const Timeline::save( QXmlStreamWriter &project ) const
{ {
...@@ -229,9 +238,3 @@ Timeline::load( const QDomElement &root ) ...@@ -229,9 +238,3 @@ Timeline::load( const QDomElement &root )
elem = elem.nextSiblingElement(); elem = elem.nextSiblingElement();
} }
} }
void
Timeline::setRenderer( WorkflowRenderer* renderer )
{
m_renderer = renderer;
}
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
class MainWorkflow; class MainWorkflow;
class Project;
class TracksScene; class TracksScene;
class TracksView; class TracksView;
class TracksControls; class TracksControls;
...@@ -62,7 +63,6 @@ public: ...@@ -62,7 +63,6 @@ public:
void save( QXmlStreamWriter& project ) const; void save( QXmlStreamWriter& project ) const;
void load( const QDomElement &root ); void load( const QDomElement &root );
void setRenderer( WorkflowRenderer* renderer );
public slots: public slots:
/** /**
...@@ -84,6 +84,8 @@ public slots: ...@@ -84,6 +84,8 @@ public slots:
*/ */
void setTool( ToolButtons button ); void setTool( ToolButtons button );
void projectLoading( Project* project );
protected: protected:
virtual void changeEvent( QEvent *e ); virtual void changeEvent( QEvent *e );
......
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