[vlmc-devel] commit: TracksView: When adding a clip with effects, add these effects. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Tue Sep 21 17:17:38 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Sep 21 17:17:15 2010 +0200| [8063f855678a2917d5a667d2ba1f07d21c618e1b] | committer: Hugo Beauzée-Luyssen 

TracksView: When adding a clip with effects, add these effects.

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

 src/Gui/timeline/TracksView.cpp |   52 ++++++++++++++++++++++++---------------
 src/Gui/timeline/TracksView.h   |    3 ++
 2 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index d9a0cc9..e8ccf5c 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -287,33 +287,45 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
         item->setStartPos( start );
         item->m_oldTrack = tw;
         moveItem( item, track, start );
+        //If the item has some effects:
+        foreach ( EffectHelper *effectHelper, clipHelper->clipWorkflow()->effects( Effect::Filter ) )
+        {
+            addEffectItem( effectHelper, trackType, track, start );
+        }
     }
     else
     {
         EffectHelper    *effectHelper = qobject_cast<EffectHelper*>( helper );
-        Q_ASSERT( effectHelper != NULL );
-        GraphicsEffectItem *effectItem = new GraphicsEffectItem( effectHelper );
-        item = effectItem;
-        m_itemsLoaded.insert( helper->uuid() );
-        item->m_tracksView = this;
-        item->setHeight( item->itemHeight() );
-        item->setTrack( getTrack( trackType, track ) );
-        item->setStartPos( start );
-        item->m_oldTrack = tw;
-        moveItem( item, track, start );
-        QList<QGraphicsItem*>     collidingItems = item->collidingItems();
-        effectItem->setContainer( NULL );
-        foreach ( QGraphicsItem *collider, collidingItems )
+        addEffectItem( effectHelper, trackType, track, start );
+    }
+    updateDuration();
+}
+
+void
+TracksView::addEffectItem( EffectHelper *effectHelper, Workflow::TrackType trackType,
+                           qint32 trackId, qint64 start )
+{
+    Q_ASSERT( effectHelper != NULL );
+    GraphicsEffectItem *item = new GraphicsEffectItem( effectHelper );
+    m_itemsLoaded.insert( effectHelper->uuid() );
+    item->m_tracksView = this;
+    item->setHeight( item->itemHeight() );
+    GraphicsTrack   *track = getTrack( trackType, trackId );
+    item->setTrack( track );
+    item->setStartPos( start );
+    item->m_oldTrack = track->trackWorkflow();
+    moveItem( item, trackId, start );
+    QList<QGraphicsItem*>     collidingItems = item->collidingItems();
+    item->setContainer( NULL );
+    foreach ( QGraphicsItem *collider, collidingItems )
+    {
+        AbstractGraphicsMediaItem   *mediaItem = dynamic_cast<AbstractGraphicsMediaItem*>( collider );
+        if ( mediaItem != NULL )
         {
-            AbstractGraphicsMediaItem   *mediaItem = dynamic_cast<AbstractGraphicsMediaItem*>( collider );
-            if ( mediaItem != NULL )
-            {
-                effectItem->setContainer( mediaItem );
-                break ;
-            }
+            item->setContainer( mediaItem );
+            break ;
         }
     }
-    updateDuration();
 }
 
 void
diff --git a/src/Gui/timeline/TracksView.h b/src/Gui/timeline/TracksView.h
index e268c75..06310c3 100644
--- a/src/Gui/timeline/TracksView.h
+++ b/src/Gui/timeline/TracksView.h
@@ -325,6 +325,9 @@ private:
 
     ItemPosition            findPosition( AbstractGraphicsItem *item, qint32 track, qint64 time );
 
+    void                    addEffectItem(EffectHelper *effectHelper, Workflow::TrackType trackType,
+                                          qint32 trackId, qint64 start );
+
     /**
      * \brief Return a pointer to the specified track.
      * \param type The track's type.



More information about the Vlmc-devel mailing list