[vlmc-devel] commit: timeline: Warn (and return) if a clip with the same UUID already exists. (Ludovic Fauvet )

git at videolan.org git at videolan.org
Tue Mar 30 03:34:20 CEST 2010


vlmc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Tue Mar 30 03:34:49 2010 +0200| [64ed8cfe7833ba291794f7f55d6fd18281d7ebd0] | committer: Ludovic Fauvet 

timeline: Warn (and return) if a clip with the same UUID already exists.

Looks like each clip is added twice.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=64ed8cfe7833ba291794f7f55d6fd18281d7ebd0
---

 src/Gui/timeline/TracksView.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index e607731..d4ac146 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -243,6 +243,18 @@ TracksView::addMediaItem( Clip *clip, unsigned int track, MainWorkflow::TrackTyp
         }
     }
 
+    // Is the clip already existing in the timeline ?
+    QList<QGraphicsItem*> trackItems = getTrack( trackType, track )->childItems();
+    for ( int i = 0; i < trackItems.size(); ++i )
+    {
+        AbstractGraphicsMediaItem *item =
+                dynamic_cast<AbstractGraphicsMediaItem*>( trackItems.at( i ) );
+        if ( !item || item->uuid() != clip->uuid() ) continue;
+        // Item already exists in the timeline, exit now.
+        qWarning() << QString( "A clip with the same UUID (%1) already exists in the timeline!").arg( item->uuid() );
+        return;
+    }
+
     AbstractGraphicsMediaItem *item = 0;
     if ( trackType == MainWorkflow::VideoTrack )
     {



More information about the Vlmc-devel mailing list