Commit bf85fb10 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Automatically add empty video tracks

parent b4050874
......@@ -107,3 +107,8 @@ void GraphicsMovieItem::paintAudioSpectrum( QPainter* painter )
}
}
}
Media* GraphicsMovieItem::media() const
{
return m_media;
}
......@@ -44,6 +44,7 @@ public:
void setWidth( int width );
void setHeight( int height );
Media* media() const;
//void setAudioSpectrum( QVector<float*> spectrum );
void paintAudioSpectrum( QPainter* painter );
......
......@@ -87,6 +87,7 @@ void TracksView::createLayout()
addVideoTrack();
m_separator = new QGraphicsWidget();
m_separator->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
m_separator->setPreferredHeight( 20 );
m_layout->insertItem( 1, m_separator );
......@@ -98,21 +99,23 @@ void TracksView::createLayout()
void TracksView::addVideoTrack()
{
GraphicsTrack* track = new GraphicsTrack( GraphicsTrack::Video );
track->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
track->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
track->setPreferredHeight( m_tracksHeight );
track->setContentsMargins( 0, 0, 0, 0 );
m_layout->insertItem( 0, track );
m_numVideoTrack++;
m_scene->invalidate();
}
void TracksView::addAudioTrack()
{
GraphicsTrack* track = new GraphicsTrack( GraphicsTrack::Audio );
track->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
track->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
track->setPreferredHeight( m_tracksHeight );
track->setContentsMargins( 0, 0, 0, 0 );
m_layout->insertItem( 1000, track );
m_numAudioTrack++;
m_scene->invalidate();
}
void TracksView::dragEnterEvent( QDragEnterEvent* event )
......@@ -166,16 +169,14 @@ void TracksView::dropEvent( QDropEvent* event )
qDebug() << "Dropping is currently not implemented.";
if ( m_dragItem )
{
updateDuration();
/*QUuid uuid = QUuid( (const QString& )event->mimeData()->data( "vlmc/uuid" ) );
Media* media = Library::getInstance()->getMedia( uuid );
if ( !media )
return;
addClip( media, event->pos() );
event->acceptProposedAction();*/
if ( m_layout->itemAt( 0 )->graphicsItem()->childItems().count() > 0 )
addVideoTrack();
event->acceptProposedAction();
//addClip( media, event->pos() );
m_dragItem = NULL; // Temporary action
}
}
void TracksView::setDuration( int duration )
......
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