[vlmc-devel] Timeline: Link clips by a signal

Yikai Lu git at videolan.org
Sat Jul 23 12:06:31 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Jul 23 18:45:27 2016 +0900| [40ca098d4a3fbbd5d9316c95da9b52b5158b75af] | committer: Yikai Lu

Timeline: Link clips by a signal

> https://code.videolan.org/videolan/vlmc/commit/40ca098d4a3fbbd5d9316c95da9b52b5158b75af
---

 src/Gui/timeline/Clip.qml  | 8 ++++++--
 src/Gui/timeline/Track.qml | 2 --
 src/Gui/timeline/main.qml  | 5 +++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/Gui/timeline/Clip.qml b/src/Gui/timeline/Clip.qml
index db53fb3..be7d4b8 100644
--- a/src/Gui/timeline/Clip.qml
+++ b/src/Gui/timeline/Clip.qml
@@ -78,10 +78,14 @@ Rectangle {
         if ( !linkedClip )
             return;
 
+        var linkedClipItem = findClipItem( linkedClip );
+        if ( !linkedClipItem )
+            return;
+
         if ( linked === true )
-            findClipItem( linkedClip ).linked = true;
+            linkedClipItem.linked = true;
         else
-            findClipItem( linkedClip ).linked = false;
+            linkedClipItem.linked = false;
     }
 
     function setPixelPosition( pixels )
diff --git a/src/Gui/timeline/Track.qml b/src/Gui/timeline/Track.qml
index 7489b27..acc8fd9 100644
--- a/src/Gui/timeline/Track.qml
+++ b/src/Gui/timeline/Track.qml
@@ -182,8 +182,6 @@ Item {
                             removeClipFromTrack( "Video", trackId, "videoUuid" );
                         }
                         if ( audioClipUuid && videoClipUuid ) {
-                            findClipItem( audioClipUuid ).linkedClip = videoClipUuid;
-                            findClipItem( videoClipUuid ).linkedClip = audioClipUuid;
                             workflow.linkClips( audioClipUuid, videoClipUuid );
                         }
                         currentUuid = "";
diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index fd68cc5..d7a3144 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -530,6 +530,11 @@ Rectangle {
             clip.end = clipInfo["end"];
             clip.begin = clipInfo["begin"];
         }
+
+        onClipLinked: {
+            findClipItem( uuidA ).linkedClip = uuidB;
+            findClipItem( uuidB ).linkedClip = uuidA;
+        }
     }
 
     Connections {



More information about the Vlmc-devel mailing list