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