Commit 1c2432ff authored by Ludovic Fauvet's avatar Ludovic Fauvet

Update the global duration of the timeline on undo/redo actions

parent 45a5a195
...@@ -59,7 +59,7 @@ Timeline::Timeline( QWidget *parent ) : ...@@ -59,7 +59,7 @@ Timeline::Timeline( QWidget *parent ) :
setDuration( 0 ); setDuration( 0 );
connect( m_tracksView->horizontalScrollBar(), SIGNAL( valueChanged( int ) ), m_tracksRuler, SLOT( moveRuler( int ) ) ); connect( m_tracksView->horizontalScrollBar(), SIGNAL( valueChanged( int ) ), m_tracksRuler, SLOT( moveRuler( int ) ) );
connect( m_tracksView, SIGNAL( durationChanged(int) ), this, SLOT( setDuration(int) ) ); connect( m_tracksView, SIGNAL( durationChanged(int) ), this, SLOT( setDuration(int) ) );
connect( m_mainWorkflow, SIGNAL( clipMoved(QUuid, uint, qint64 ) ), m_tracksView, SLOT( moveMediaItem(QUuid, uint, qint64 ) ) ); connect( m_mainWorkflow, SIGNAL( clipMoved(QUuid, uint, qint64 ) ), this, SLOT( actionMoveClip(QUuid,uint,qint64) ) );
} }
Timeline::~Timeline() Timeline::~Timeline()
...@@ -91,3 +91,10 @@ void Timeline::setDuration( int duration ) ...@@ -91,3 +91,10 @@ void Timeline::setDuration( int duration )
m_tracksView->setDuration( duration ); m_tracksView->setDuration( duration );
m_tracksRuler->setDuration( duration ); m_tracksRuler->setDuration( duration );
} }
void Timeline::actionMoveClip( const QUuid& uuid, unsigned int track, qint64 time )
{
tracksView()->moveMediaItem( uuid, track, time );
tracksView()->updateDuration();
tracksRuler()->update();
}
...@@ -39,12 +39,14 @@ public: ...@@ -39,12 +39,14 @@ public:
virtual ~Timeline(); virtual ~Timeline();
TracksView* tracksView() { return m_tracksView; } TracksView* tracksView() { return m_tracksView; }
TracksScene* tracksScene() { return m_tracksScene; } TracksScene* tracksScene() { return m_tracksScene; }
TracksRuler* tracksRuler() { return m_tracksRuler; }
MainWorkflow* getMainWorkflow() { return m_mainWorkflow; } MainWorkflow* getMainWorkflow() { return m_mainWorkflow; }
static Timeline* getInstance() { return m_instance; } static Timeline* getInstance() { return m_instance; }
public slots: public slots:
void changeZoom( int factor ); void changeZoom( int factor );
void setDuration( int duration ); void setDuration( int duration );
void actionMoveClip( const QUuid& uuid, unsigned int track, qint64 time );
protected: protected:
virtual void changeEvent( QEvent *e ); virtual void changeEvent( QEvent *e );
......
...@@ -144,6 +144,8 @@ signals: ...@@ -144,6 +144,8 @@ signals:
void zoomIn(); void zoomIn();
void zoomOut(); void zoomOut();
void durationChanged( int duration ); void durationChanged( int duration );
friend class Timeline;
}; };
#endif // TRACKSVIEW_H #endif // TRACKSVIEW_H
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