Commit 6b0da608 authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

Support clear in the timeline controls.

Avoid duplicates item when loading a project.
parent 2f18ed60
......@@ -74,6 +74,7 @@ Timeline::Timeline( WorkflowRenderer* renderer, QWidget *parent ) :
connect( m_mainWorkflow, SIGNAL( clipMoved(QUuid, uint, qint64,MainWorkflow::TrackType ) ), this, SLOT( actionMoveClip(QUuid,uint,qint64,MainWorkflow::TrackType ) ) );
connect( m_mainWorkflow, SIGNAL( clipRemoved(Clip*,uint,MainWorkflow::TrackType ) ), this, SLOT( actionRemoveClip(Clip*,uint,MainWorkflow::TrackType )) );
connect( m_mainWorkflow, SIGNAL( cleared() ), tracksView(), SLOT( clear() ) );
connect( m_mainWorkflow, SIGNAL( cleared() ), m_tracksControls, SLOT( clear() ) );
connect( m_tracksView, SIGNAL( videoTrackAdded(GraphicsTrack*) ),
m_tracksControls, SLOT( addVideoTrack(GraphicsTrack*) ) );
......
......@@ -41,11 +41,11 @@ TracksControls::TracksControls( QWidget* parent )
m_layout->setContentsMargins( 0, 0, 0, 0 );
m_layout->setSpacing( 0 );
QWidget* separator = new QWidget;
separator->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
separator->setMinimumHeight( 20 );
separator->setMaximumHeight( 20 );
m_layout->addWidget( separator );
m_separator = new QWidget;
m_separator->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
m_separator->setMinimumHeight( 20 );
m_separator->setMaximumHeight( 20 );
m_layout->addWidget( m_separator );
m_centralWidget->setLayout( m_layout );
setWidget( m_centralWidget );
......@@ -68,3 +68,16 @@ void TracksControls::addAudioTrack( GraphicsTrack* track )
item->setContentsMargins( 0, 0, 0, 0 );
m_layout->insertWidget( -1, item );
}
void TracksControls::clear()
{
m_layout->removeWidget( m_separator );
QLayoutItem* child;
while ( ( child = m_layout->takeAt( 0 ) ) != 0 )
{
if ( child->widget() )
delete child->widget();
delete child;
}
m_layout->addWidget( m_separator );
}
......@@ -37,9 +37,11 @@ public:
public slots:
void addVideoTrack( GraphicsTrack* track );
void addAudioTrack( GraphicsTrack* track );
void clear();
private:
QWidget* m_centralWidget;
QWidget* m_separator;
QVBoxLayout* m_layout;
};
......
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