[vlmc-devel] commit: TracksView: Fix auto track addition. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Thu Sep 9 01:18:11 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Sep  9 01:13:38 2010 +0200| [9118145edfc880c429b2ef98f54cef76fcebb894] | committer: Hugo Beauzée-Luyssen 

TracksView: Fix auto track addition.

Replacing some AbstractGraphicsMediaItem with AbstractGraphicsItem when
appropriate.

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

 src/Gui/timeline/GraphicsTrack.cpp |    8 ++++----
 src/Gui/timeline/GraphicsTrack.h   |    3 ++-
 src/Gui/timeline/TracksView.cpp    |   16 +++++++++-------
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/Gui/timeline/GraphicsTrack.cpp b/src/Gui/timeline/GraphicsTrack.cpp
index 5071ead..9a86fad 100644
--- a/src/Gui/timeline/GraphicsTrack.cpp
+++ b/src/Gui/timeline/GraphicsTrack.cpp
@@ -87,16 +87,16 @@ GraphicsTrack::mediaType()
     return m_type;
 }
 
-QList<AbstractGraphicsMediaItem*>
+QList<AbstractGraphicsItem*>
 GraphicsTrack::childs()
 {
-    QList<AbstractGraphicsMediaItem*> list;
+    QList<AbstractGraphicsItem*> list;
     QList<QGraphicsItem*> items = childItems();
-    AbstractGraphicsMediaItem* item;
+    AbstractGraphicsItem* item;
 
     for ( int i = 0; i < items.count(); ++i )
     {
-        item = dynamic_cast<AbstractGraphicsMediaItem*>( items.at( i ) );
+        item = dynamic_cast<AbstractGraphicsItem*>( items.at( i ) );
         if ( !item )
             continue;
         list.append( item );
diff --git a/src/Gui/timeline/GraphicsTrack.h b/src/Gui/timeline/GraphicsTrack.h
index 61e0cb7..acddbb6 100644
--- a/src/Gui/timeline/GraphicsTrack.h
+++ b/src/Gui/timeline/GraphicsTrack.h
@@ -27,6 +27,7 @@
 #include <QList>
 #include "Types.h"
 
+class   AbstractGraphicsItem;
 class   AbstractGraphicsMediaItem;
 class   TrackWorkflow;
 
@@ -50,7 +51,7 @@ public:
     TrackWorkflow       *trackWorkflow();
     void                setEmphasized( bool value );
 
-    QList<AbstractGraphicsMediaItem*> childs();
+    QList<AbstractGraphicsItem*> childs();
 
 private:
     Workflow::TrackType m_type;
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index e0a3366..ccb1dbb 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -779,12 +779,14 @@ TracksView::dropEvent( QDropEvent *event )
                 if ( track != NULL )
                 {
                     m_itemsLoaded.insert( m_dragEffectItem->helper()->uuid() );
+                    updateDuration();
+                    if ( getTrack( Workflow::VideoTrack, m_numVideoTrack - 1 )->childItems().count() > 0 )
+                        addTrack( Workflow::VideoTrack );
+                    m_dragEffectItem->m_oldTrack = track->trackWorkflow();
                     Commands::trigger( new Commands::Effect::Add( m_dragEffectItem->effectHelper(),
                                                                   track->trackWorkflow() ) );
-                    m_dragEffectItem->m_oldTrack = track->trackWorkflow();
+
                     event->acceptProposedAction();
-                    if ( getTrack( Workflow::VideoTrack, m_numVideoTrack - 1 )->childItems().count() > 0 )
-                        addTrack( Workflow::VideoTrack );
                     break ;
                 }
             }
@@ -953,9 +955,9 @@ TracksView::mousePressEvent( QMouseEvent *event )
         if ( clickPos.x() < RESIZE_ZONE || clickPos.x() > ( itemSize.x() - RESIZE_ZONE ) )
         {
             if ( clickPos.x() < RESIZE_ZONE )
-                m_actionResizeType = AbstractGraphicsMediaItem::END;
+                m_actionResizeType = AbstractGraphicsItem::END;
             else
-                m_actionResizeType = AbstractGraphicsMediaItem::BEGINNING;
+                m_actionResizeType = AbstractGraphicsItem::BEGINNING;
             m_action = TracksView::Resize;
             m_actionItem = item;
         }
@@ -1047,7 +1049,7 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
     {
         qint64  newBegin;
         qint64  newEnd;
-        if ( m_actionResizeType == AbstractGraphicsMediaItem::END )
+        if ( m_actionResizeType == AbstractGraphicsItem::END )
         {
             newEnd = m_actionItem->helper()->end();
             newBegin = newEnd - m_actionItem->width();
@@ -1207,7 +1209,7 @@ TracksView::cleanTracks( Workflow::TrackType type )
         if ( !track )
             continue;
 
-        QList<AbstractGraphicsMediaItem*> items = track->childs();
+        QList<AbstractGraphicsItem*> items = track->childs();
 
         if ( items.count() == 0 )
             tracksToRemove++;



More information about the Vlmc-devel mailing list