[vlmc-devel] Don't trigger actions to linked clips from the UI

Hugo Beauzée-Luyssen git at videolan.org
Sun Oct 30 22:36:45 CET 2016


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Oct 30 21:36:14 2016 +0100| [4ef621b934fd510e87e90f2804d30a31deb35178] | committer: Hugo Beauzée-Luyssen

Don't trigger actions to linked clips from the UI

> https://code.videolan.org/videolan/vlmc/commit/4ef621b934fd510e87e90f2804d30a31deb35178
---

 src/Gui/timeline/Clip.qml     |  9 +--------
 src/Gui/timeline/main.qml     | 10 ++--------
 src/Workflow/MainWorkflow.cpp |  9 +++++++++
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/src/Gui/timeline/Clip.qml b/src/Gui/timeline/Clip.qml
index 3a87b6a..b6a76d5 100644
--- a/src/Gui/timeline/Clip.qml
+++ b/src/Gui/timeline/Clip.qml
@@ -57,12 +57,7 @@ Rectangle {
 
     function resize() {
         // This function updates Backend
-        var _length = selectedClips.length;
-        for ( var i = _length - 1; i >= 0; --i ) {
-            if ( selectedClips[i] ) {
-                workflow.resizeClip( selectedClips[i].uuid, begin, end, position );
-            }
-        }
+        workflow.resizeClip( uuid, begin, end, position );
     }
 
     function selectLinkedClip() {
@@ -347,9 +342,7 @@ Rectangle {
             if ( resizing === true && isCutMode === false )
                 resize();
             else if ( dragArea.drag.active )
-            {
                 dragFinished();
-            }
         }
 
         states: [
diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index 98050f7..db2bbab 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -293,12 +293,7 @@ Rectangle {
     }
 
     function dragFinished() {
-        var _length = selectedClips.length;
-        for ( var i = _length - 1; i >= 0; --i ) {
-            if ( selectedClips[i] ) {
-                selectedClips[i].move();
-            }
-        }
+        selectedClips[0].move();
         adjustTracks( "Audio" );
         adjustTracks( "Video" );
     }
@@ -544,8 +539,7 @@ Rectangle {
         icon: StandardIcon.Question
         standardButtons: StandardButton.Yes | StandardButton.No
         onYes: {
-            while ( selectedClips.length )
-                workflow.removeClip( selectedClips[0].uuid );
+            workflow.removeClip( selectedClips[0].uuid );
         }
     }
 
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 8868b36..899d9f4 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -241,19 +241,28 @@ MainWorkflow::libraryClipInfo( const QString& uuid )
 void
 MainWorkflow::moveClip( const QString& uuid, quint32 trackId, qint64 startFrame )
 {
+    auto clip = m_sequenceWorkflow->clip( uuid );
     trigger( new Commands::Clip::Move( m_sequenceWorkflow, uuid, trackId, startFrame ) );
+    for ( const auto& lcUuid : clip->linkedClips )
+        trigger( new Commands::Clip::Move( m_sequenceWorkflow, lcUuid.toString(), trackId, startFrame ) );
 }
 
 void
 MainWorkflow::resizeClip( const QString& uuid, qint64 newBegin, qint64 newEnd, qint64 newPos )
 {
+    auto clip = m_sequenceWorkflow->clip( uuid );
     trigger( new Commands::Clip::Resize( m_sequenceWorkflow, uuid, newBegin, newEnd, newPos ) );
+    for ( const auto& lcUuid : clip->linkedClips )
+        trigger( new Commands::Clip::Resize( m_sequenceWorkflow, lcUuid, newBegin, newEnd, newPos ) );
 }
 
 void
 MainWorkflow::removeClip( const QString& uuid )
 {
+    auto clip = m_sequenceWorkflow->clip( uuid );
     trigger( new Commands::Clip::Remove( m_sequenceWorkflow, uuid ) );
+    for ( const auto& lcUuid : clip->linkedClips )
+        trigger( new Commands::Clip::Remove( m_sequenceWorkflow, lcUuid ) );
 }
 
 void



More information about the Vlmc-devel mailing list