Commit 5016b1fa authored by Geoffroy Lacarriere's avatar Geoffroy Lacarriere
Browse files

Bug fix of the drag and drop of a media in the timeline

parent d9a68b93
......@@ -64,6 +64,13 @@ Library::temporaryMedia( const QUuid& uuid )
Clip*
Library::clip( const QUuid& uuid )
{
if ( m_medias.contains( uuid ) )
{
Media* media = m_medias.value( uuid );
Clip* clip = new Clip( media->baseClip() );
return clip;
}
QUuid mediaUuid;
foreach( mediaUuid, m_medias.keys() )
{
......@@ -77,10 +84,14 @@ Library::clip( const QUuid& uuid )
Clip*
Library::clip( const QUuid& mediaUuid, const QUuid& clipUuid )
{
Media* media = m_medias.value( mediaUuid );
if ( media == NULL )
return NULL;
return dynamic_cast<Clip*>( getElementByUuid( *media->clips(), clipUuid ) );
if ( m_medias.contains( mediaUuid ) )
{
if ( m_medias.value( mediaUuid )->clips()->contains( clipUuid ) )
return m_medias.value( mediaUuid )->clip( clipUuid );
else
return new Clip( m_medias.value( mediaUuid )->baseClip() );
}
return NULL;
}
void
......
......@@ -72,7 +72,7 @@ Clip::Clip( Media* parent, qint64 begin, qint64 end /*= -1*/ ) :
computeLength();
}
Clip::Clip( Clip* clip ) :
Clip::Clip( const Clip* clip ) :
m_parent( clip->m_parent ),
m_begin( clip->m_begin ),
m_end( clip->m_end ),
......
......@@ -45,7 +45,7 @@ class Clip : public QObject
Clip( Media* parent );
Clip( Media* parent, qint64 begin, qint64 end = -1 );
Clip( Clip* creator, qint64 begin, qint64 end );
Clip( Clip* clip );
Clip( const Clip* clip );
Clip( const QUuid& uuid, qint64 begin = 0, qint64 end = -1 );
virtual ~Clip();
......
......@@ -74,7 +74,6 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ )
m_audioValueList = new QList<int>();
m_vlcMedia = new LibVLCpp::Media( m_mrl );
m_baseClip = new Clip( this );
}
Media::~Media()
......@@ -195,7 +194,10 @@ Media::FileType Media::getFileType() const
void Media::emitMetaDataComputed( bool hasMetadata )
{
if ( hasMetadata == true )
{
m_baseClip = new Clip( this );
m_metadataState = ParsedWithoutSnapshot;
}
emit metaDataComputed( this );
}
......
Supports Markdown
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