[vlmc-devel] Clip.qml: Reordering functions

Yikai Lu git at videolan.org
Tue Jul 26 16:12:49 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Jul 26 22:16:46 2016 +0900| [fb6eccec403ae3c041ddeaff1e1d92a0ee36235c] | committer: Yikai Lu

Clip.qml: Reordering functions

> https://code.videolan.org/videolan/vlmc/commit/fb6eccec403ae3c041ddeaff1e1d92a0ee36235c
---

 src/Gui/timeline/Clip.qml | 116 +++++++++++++++++++++++-----------------------
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/src/Gui/timeline/Clip.qml b/src/Gui/timeline/Clip.qml
index 19533f1..bc6b6fa 100644
--- a/src/Gui/timeline/Clip.qml
+++ b/src/Gui/timeline/Clip.qml
@@ -36,6 +36,45 @@ Rectangle {
 
     property var clipInfo
 
+    function setPixelPosition( pixels )
+    {
+        if ( pixels >= 0 )
+            position = ptof( pixels );
+        // FIXME: Binding can be lost because of dragging.
+        x = Qt.binding( function() { return ftop( position ); } );
+    }
+
+    function pixelPosition()
+    {
+        return ftop( position );
+    }
+
+    function move() {
+        moveClipTo( track.type, uuid, newTrackId, position );
+    }
+
+    function resize() {
+        // This function updates Backend
+        workflow.resizeClip( uuid, begin, end, position )
+    }
+
+    function selectLinkedClip() {
+        if ( selected === true && linked === true && linkedClip )
+            findClipItem( linkedClip ).selected = true;
+    }
+
+    onYChanged: {
+        y -= y % trackHeight;
+        // Don't move outside its TrackContainer
+        // For Top
+        var yToMoveUp = track.mapToItem( container, 0, 0 ).y + y;
+        if ( yToMoveUp < 0 )
+            y -= yToMoveUp;
+        // For Bottom
+        if ( yToMoveUp + height > container.height )
+            y -= yToMoveUp - container.height + height;
+    }
+
     onClipInfoChanged: {
         if ( !clipInfo )
             return;
@@ -88,31 +127,24 @@ Rectangle {
             linkedClipItem.linked = false;
     }
 
-    function setPixelPosition( pixels )
-    {
-        if ( pixels >= 0 )
-            position = ptof( pixels );
-        // FIXME: Binding can be lost because of dragging.
-        x = Qt.binding( function() { return ftop( position ); } );
-    }
-
-    function pixelPosition()
-    {
-        return ftop( position );
-    }
-
-    function move() {
-        moveClipTo( track.type, uuid, newTrackId, position );
-    }
+    onSelectedChanged: {
+        for ( var i = 0; i < selectedClips.length; ++i )
+            if ( !selectedClips[i] || selectedClips[i] === clip ) {
+                selectedClips.splice( i, 1 );
+                --i;
+            }
 
-    function resize() {
-        // This function updates Backend
-        workflow.resizeClip( uuid, begin, end, position )
-    }
+        if ( selected === true ) {
+            selectedClips.push( clip );
 
-    function selectLinkedClip() {
-        if ( selected === true && linked === true && linkedClip )
-            findClipItem( linkedClip ).selected = true;
+            var group = findGroup( uuid );
+            for ( i = 0; i < ( group ? group.length : 0 ); ++i ) {
+                var clipItem = findClipItem( group[i] );
+                if ( clipItem )
+                    clipItem.selected = true;
+            }
+            selectLinkedClip();
+        }
     }
 
     Component.onCompleted: {
@@ -139,6 +171,9 @@ Rectangle {
         }
     }
 
+    Drag.keys: ["Clip"]
+    Drag.active: dragArea.drag.active
+
     Text {
         id: text
         color: "white"
@@ -151,9 +186,6 @@ Rectangle {
         wrapMode: Text.Wrap
     }
 
-    Drag.keys: ["Clip"]
-    Drag.active: dragArea.drag.active
-
     MouseArea {
         id: dragArea
         anchors.fill: parent
@@ -249,38 +281,6 @@ Rectangle {
         clip: clip
     }
 
-    onYChanged: {
-        y -= y % trackHeight;
-        // Don't move outside its TrackContainer
-        // For Top
-        var yToMoveUp = track.mapToItem( container, 0, 0 ).y + y;
-        if ( yToMoveUp < 0 )
-            y -= yToMoveUp;
-        // For Bottom
-        if ( yToMoveUp + height > container.height )
-            y -= yToMoveUp - container.height + height;
-    }
-
-    onSelectedChanged: {
-        for ( var i = 0; i < selectedClips.length; ++i )
-            if ( !selectedClips[i] || selectedClips[i] === clip ) {
-                selectedClips.splice( i, 1 );
-                --i;
-            }
-
-        if ( selected === true ) {
-            selectedClips.push( clip );
-
-            var group = findGroup( uuid );
-            for ( i = 0; i < ( group ? group.length : 0 ); ++i ) {
-                var clipItem = findClipItem( group[i] );
-                if ( clipItem )
-                    clipItem.selected = true;
-            }
-            selectLinkedClip();
-        }
-    }
-
     states: [
         State {
             name: "Selected"



More information about the Vlmc-devel mailing list