[vlmc-devel] Don't create a subclip in AbstractGraphicsMediaItem

Yikai Lu git at videolan.org
Wed Jun 1 18:15:11 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue May 10 18:13:20 2016 +0900| [4eff3c1bf311bef45f6b5c5d12389976f90cddad] | committer: Hugo Beauzée-Luyssen

Don't create a subclip in AbstractGraphicsMediaItem

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/4eff3c1bf311bef45f6b5c5d12389976f90cddad
---

 src/Gui/timeline/AbstractGraphicsMediaItem.cpp | 2 +-
 src/Gui/timeline/TracksView.cpp                | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
index dcfd1b4..5285c3b 100644
--- a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
+++ b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
@@ -37,9 +37,9 @@
 #include <QCoreApplication>
 
 AbstractGraphicsMediaItem::AbstractGraphicsMediaItem( Clip* clip ) :
+        m_clip( clip ),
         m_muted( false )
 {
-    m_clip = new Clip( clip );
     // Adjust the width
     setWidth( clip->length() );
     // Automatically adjust future changes
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 9b39461..aa59288 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -383,7 +383,7 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
     {
         if ( m_dragAudioItem )
             delete m_dragAudioItem;
-        m_dragAudioItem = new GraphicsAudioItem( clip );
+        m_dragAudioItem = new GraphicsAudioItem( Core::instance()->workflow()->createClip( clip->uuid() ) );
         m_dragAudioItem->m_tracksView = this;
         m_dragAudioItem->setHeight( m_dragAudioItem->itemHeight() );
         m_dragAudioItem->setTrack( getTrack( m_dragAudioItem->trackType(), 0 ) );
@@ -394,7 +394,7 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
     {
         if ( m_dragVideoItem )
             delete m_dragVideoItem;
-        m_dragVideoItem = new GraphicsMovieItem( clip );
+        m_dragVideoItem = new GraphicsMovieItem( Core::instance()->workflow()->createClip( clip->uuid() ) );
         m_dragVideoItem->m_tracksView = this;
         m_dragVideoItem->setHeight( m_dragVideoItem->itemHeight() );
         m_dragVideoItem->setTrack( getTrack( m_dragVideoItem->trackType(), 0 ) );
@@ -780,6 +780,9 @@ TracksView::dragLeaveEvent( QDragLeaveEvent *event )
     if ( m_dragAudioItem || m_dragVideoItem )
         updateDurationNeeded = true;
 
+    Core::instance()->workflow()->deleteClip( m_dragAudioItem->clip()->uuid() );
+    Core::instance()->workflow()->deleteClip( m_dragVideoItem->clip()->uuid() );
+
     delete m_dragAudioItem;
     delete m_dragVideoItem;
     delete m_dragEffectItem;



More information about the Vlmc-devel mailing list