Commit ed59ed1e authored by Ludovic Fauvet's avatar Ludovic Fauvet

Project duration is updated to reflect the timeline content

parent 62561473
......@@ -50,8 +50,9 @@ Timeline::Timeline( QWidget *parent ) :
tracksRulerLayout->addWidget( m_tracksRuler );
changeZoom( 10 );
setDuration( 1500 );
setDuration( 1 );
connect( m_tracksView->horizontalScrollBar(), SIGNAL( valueChanged( int ) ), m_tracksRuler, SLOT( moveRuler( int ) ) );
connect( m_tracksView, SIGNAL( durationChanged(int) ), this, SLOT( setDuration(int) ) );
}
void Timeline::changeEvent( QEvent *e )
......
......@@ -49,8 +49,8 @@ TracksView::TracksView( QGraphicsScene* scene, QWidget* parent )
setSceneRect( 0, 0, sceneRect().width(), maxHeight );
m_cursorPos = 0;
m_cursorLine = m_scene->addLine(0, 0, 0, maxHeight);
m_cursorLine->setZValue(100);
m_cursorLine = m_scene->addLine( 0, 0, 0, maxHeight );
m_cursorLine->setZValue( 100 );
}
void TracksView::dragEnterEvent( QDragEnterEvent* event )
......@@ -180,7 +180,7 @@ void TracksView::wheelEvent( QWheelEvent* event )
void TracksView::setCursorPos(int pos)
{
m_cursorPos = pos;
m_cursorLine->setPos(m_cursorPos, 0);
m_cursorLine->setPos( m_cursorPos, 0 );
}
void TracksView::addClip( Media* clip, const QPoint& point )
......@@ -196,6 +196,12 @@ void TracksView::addClip( Media* clip, const QPoint& point )
item->setWidth( ( (double)clip->getLength() / 1000 ) * m_fps );
item->setHeight( tracksHeight() );
m_scene->addItem( item );
int duration = mappedXPos + ( (double)clip->getLength() / 1000 ) * m_fps;
if ( duration > m_projectDuration )
{
m_projectDuration = duration;
emit durationChanged( duration );
}
item->show();
}
......
......@@ -69,6 +69,7 @@ private:
signals:
void zoomIn();
void zoomOut();
void durationChanged( int duration );
};
#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