[vlmc-devel] commit: Fixing signal/slot stuff when moving clip. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Thu Aug 26 23:03:10 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Aug 26 20:45:38 2010 +0200| [54c2f9efead923ad88b2b1eb497edf9819a500bf] | committer: Hugo Beauzée-Luyssen 

Fixing signal/slot stuff when moving clip.

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

 src/Gui/timeline/Timeline.cpp   |    4 ----
 src/Gui/timeline/TracksView.cpp |   18 +++++++++++++++---
 src/Gui/timeline/TracksView.h   |    8 ++++----
 src/Workflow/TrackWorkflow.h    |    1 +
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/src/Gui/timeline/Timeline.cpp b/src/Gui/timeline/Timeline.cpp
index b6222f5..ff4e87f 100644
--- a/src/Gui/timeline/Timeline.cpp
+++ b/src/Gui/timeline/Timeline.cpp
@@ -84,10 +84,6 @@ Timeline::Timeline( WorkflowRenderer* renderer, QWidget *parent ) :
     // Project duration change
     connect( m_tracksView, SIGNAL( durationChanged(int) ), this, SLOT( setDuration(int) ) );
 
-    // Clip actions
-    connect( m_mainWorkflow, SIGNAL( clipMoved( QUuid, uint, qint64, Workflow::TrackType ) ),
-             this, SLOT( actionMoveClip(QUuid, uint, qint64, Workflow::TrackType ) ) );
-
     // Clear / reset
     connect( m_mainWorkflow, SIGNAL( cleared() ), m_tracksControls, SLOT( clear() ) );
     connect( m_mainWorkflow, SIGNAL( cleared() ), tracksView(), SLOT( clear() ) );
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 4fbae96..c83f1da 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -30,6 +30,10 @@
 #include "GraphicsCursorItem.h"
 #include "GraphicsTrack.h"
 #include "Media.h"
+//Ugly part {
+#include "Timeline.h"
+#include "TracksRuler.h"
+//} this should be fixed, it brokes the design
 #include "TrackWorkflow.h"
 #include "UndoStack.h"
 #include "WorkflowRenderer.h"
@@ -125,7 +129,11 @@ TracksView::addVideoTrack()
              this, SLOT( addMediaItem( TrackWorkflow*, ClipHelper*, qint64 ) ) );
     connect( track->trackWorkflow(), SIGNAL( clipRemoved( TrackWorkflow*, ClipHelper* ) ),
              this, SLOT( removeMediaItem( TrackWorkflow*, ClipHelper* ) ) );
+    connect( track->trackWorkflow(), SIGNAL( clipMoved( TrackWorkflow*, ClipHelper*, qint64 ) ),
+             this, SLOT( moveMediaItem( TrackWorkflow*, ClipHelper*, qint64 ) ) );
+
     emit videoTrackAdded( track );
+
 }
 
 void
@@ -142,6 +150,8 @@ TracksView::addAudioTrack()
              this, SLOT( addMediaItem( TrackWorkflow*, ClipHelper*, qint64 ) ) );
     connect( track->trackWorkflow(), SIGNAL( clipRemoved( TrackWorkflow*, ClipHelper* ) ),
              this, SLOT( removeMediaItem( TrackWorkflow*, ClipHelper* ) ) );
+    connect( track->trackWorkflow(), SIGNAL( clipMoved( TrackWorkflow*, ClipHelper*, qint64 ) ),
+             this, SLOT( moveMediaItem( TrackWorkflow*, ClipHelper*, qint64 ) ) );
     emit audioTrackAdded( track );
 }
 
@@ -340,7 +350,7 @@ TracksView::dragMoveEvent( QDragMoveEvent *event )
 }
 
 void
-TracksView::moveMediaItem( const QUuid &uuid, unsigned int track, qint64 time )
+TracksView::moveMediaItem( TrackWorkflow *tw, ClipHelper *ch, qint64 time )
 {
     QList<QGraphicsItem*> sceneItems = m_scene->items();
 
@@ -348,9 +358,11 @@ TracksView::moveMediaItem( const QUuid &uuid, unsigned int track, qint64 time )
     {
         AbstractGraphicsMediaItem* item =
                 dynamic_cast<AbstractGraphicsMediaItem*>( sceneItems.at( i ) );
-        if ( !item || item->uuid() != uuid ) continue;
-        moveMediaItem( item, track, time );
+        if ( !item || item->uuid() != ch->uuid() ) continue;
+        moveMediaItem( item, tw->trackId(), time );
     }
+    updateDuration();
+    Timeline::getInstance()->tracksRuler()->update();
 }
 
 void
diff --git a/src/Gui/timeline/TracksView.h b/src/Gui/timeline/TracksView.h
index b25cc57..f9f237f 100644
--- a/src/Gui/timeline/TracksView.h
+++ b/src/Gui/timeline/TracksView.h
@@ -202,11 +202,11 @@ public slots:
     void                    addMediaItem( TrackWorkflow* tw, ClipHelper *clipHelper, qint64 start );
     /**
      * \brief Move an item in the timeline.
-     * \param uuid The Universally Unique Identifier of the item.
-     * \param track The new track of the item.
-     * \param time The new position (in frames) of the item.
+     * \param tw    The TrackWorkflow in which the track was moved
+     * \param ch    The clip that was moved.
+     * \param time  The new position (in frames) of the item.
      */
-    void                    moveMediaItem( const QUuid &uuid, unsigned int track, qint64 time );
+    void                    moveMediaItem( TrackWorkflow *tw, ClipHelper *ch, qint64 time );
     /**
      * \brief Remove an item from the timeline.
      * \param uuid The Universally Unique Identifier of the item.
diff --git a/src/Workflow/TrackWorkflow.h b/src/Workflow/TrackWorkflow.h
index e660419..3554ba4 100644
--- a/src/Workflow/TrackWorkflow.h
+++ b/src/Workflow/TrackWorkflow.h
@@ -129,6 +129,7 @@ class   TrackWorkflow : public QObject
         void                lengthChanged( qint64 newLength );
         void                clipAdded( TrackWorkflow*, ClipHelper*, qint64 );
         void                clipRemoved( TrackWorkflow*, ClipHelper* );
+        void                clipMoved( TrackWorkflow*, ClipHelper*, qint64 );
 };
 
 #endif // TRACKWORKFLOW_H



More information about the Vlmc-devel mailing list