Commit 519ced8a authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

Code simplification (again)

parent b5885655
......@@ -37,6 +37,7 @@ public:
Video,
Audio
};
GraphicsTrack( MediaType type, quint32 trackNumber, QGraphicsItem* parent = 0 ) : QGraphicsWidget( parent )
{
m_type = type;
......@@ -46,10 +47,23 @@ public:
setContentsMargins( 0, 0, 0, 0 );
setZValue( 1 );
}
void setHeight( int height )
{
setPreferredHeight( height );
updateGeometry();
}
int height()
{
return preferredHeight();
}
quint32 trackNumber()
{
return m_trackNumber;
}
virtual int type() const { return Type; }
protected:
......
......@@ -100,23 +100,23 @@ void TracksView::createLayout()
void TracksView::addVideoTrack()
{
GraphicsTrack* track = new GraphicsTrack( GraphicsTrack::Video, m_numVideoTrack );
track->setPreferredHeight( m_tracksHeight );
track->setHeight( m_tracksHeight );
m_layout->insertItem( 0, track );
m_numVideoTrack++;
m_scene->invalidate();
setSceneRect( m_layout->contentsRect().adjusted( 0, 0, 100, 100 ) );
m_cursorLine->setHeight( m_layout->contentsRect().height() );
m_scene->invalidate(); // Redraw the background
m_numVideoTrack++;
}
void TracksView::addAudioTrack()
{
GraphicsTrack* track = new GraphicsTrack( GraphicsTrack::Audio, 0 );
track->setPreferredHeight( m_tracksHeight );
track->setHeight( m_tracksHeight );
m_layout->insertItem( 1000, track );
m_numAudioTrack++;
m_scene->invalidate();
setSceneRect( m_layout->contentsRect().adjusted( 0, 0, 100, 100 ) );
m_cursorLine->setHeight( m_layout->contentsRect().height() );
m_scene->invalidate(); // Redraw the background
m_numAudioTrack++;
}
void TracksView::clear()
......
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