[vlmc-devel] commit: TracksView: Removing m_actionMoveExecuted flag. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sun Aug 29 17:07:06 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Aug 29 16:59:33 2010 +0200| [db5790885850b5e86b6fd6da3f65f8839b7d3313] | committer: Hugo Beauzée-Luyssen 

TracksView: Removing m_actionMoveExecuted flag.

Improving move detection, so that a clip that's moved to its old
position won't trigger a new (useless) action.

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

 src/Gui/timeline/TracksView.cpp |   13 +++++++------
 src/Gui/timeline/TracksView.h   |    1 -
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 76277b1..423b4d9 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -778,9 +778,7 @@ TracksView::mouseMoveEvent( QMouseEvent *event )
          event->buttons() == Qt::LeftButton &&
          m_actionMove == true )
     {
-        // The move action is obviously executed
-        m_actionMoveExecuted = true;
-
+        //Moving item.
         m_actionItem->setOpacity( 0.6 );
         if ( m_actionRelativeX < 0 )
             m_actionRelativeX = event->pos().x() - mapFromScene( m_actionItem->pos() ).x();
@@ -875,7 +873,6 @@ TracksView::mousePressEvent( QMouseEvent *event )
         else if ( item->moveable() )
         {
             m_actionMove = true;
-            m_actionMoveExecuted = false;
             m_actionItem = item;
         }
         scene()->clearSelection();
@@ -918,11 +915,16 @@ TracksView::mousePressEvent( QMouseEvent *event )
 void
 TracksView::mouseReleaseEvent( QMouseEvent *event )
 {
-    if ( m_actionMove && m_actionMoveExecuted )
+    if ( m_actionMove )
     {
         Q_ASSERT( m_actionItem );
         m_actionItem->setOpacity( 1.0 );
 
+        //Check if the clip moved.
+        if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() &&
+             m_actionItem->startPos() == m_actionItem->track()->trackWorkflow()->getClipPosition( m_actionItem->clipHelper()->uuid() ) )
+            return ;
+
         updateDuration();
 
         if ( getTrack( Workflow::VideoTrack, m_numVideoTrack - 1 )->childItems().count() > 0 )
@@ -979,7 +981,6 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
     }
 
     m_actionMove = false;
-    m_actionMoveExecuted = false;
     m_actionResize = false;
 
     //setDragMode( QGraphicsView::NoDrag );
diff --git a/src/Gui/timeline/TracksView.h b/src/Gui/timeline/TracksView.h
index 968f84e..c1ab22d 100644
--- a/src/Gui/timeline/TracksView.h
+++ b/src/Gui/timeline/TracksView.h
@@ -326,7 +326,6 @@ private:
 
     // Mouse actions on Medias
     bool                    m_actionMove;
-    bool                    m_actionMoveExecuted;
     bool                    m_actionResize;
     qint64                  m_actionResizeOldBegin;
     qint64                  m_actionResizeNewBegin;



More information about the Vlmc-devel mailing list