[vlmc-devel] Timeline: Implement markers

Yikai Lu git at videolan.org
Mon Jul 18 15:40:02 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Jul 18 22:17:14 2016 +0900| [0f24121aaed933f98790917c08e784a530180c29] | committer: Yikai Lu

Timeline: Implement markers

> https://code.videolan.org/videolan/vlmc/commit/0f24121aaed933f98790917c08e784a530180c29
---

 src/Gui/timeline/Ruler.qml | 23 ++++++++++++++++++++++-
 src/Gui/timeline/main.qml  | 18 ++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/src/Gui/timeline/Ruler.qml b/src/Gui/timeline/Ruler.qml
index 4df195b..ce4beeb 100644
--- a/src/Gui/timeline/Ruler.qml
+++ b/src/Gui/timeline/Ruler.qml
@@ -4,11 +4,11 @@ Rectangle {
     id: ruler
     height: 52
     width: parent.width - initPosOfCursor
-    x: initPosOfCursor
     color: "#333333"
 
     Column {
         Rectangle {
+            id: markersArea
             height: 9
             width: ruler.width
             color: "#666666"
@@ -120,6 +120,27 @@ Rectangle {
         }
     }
 
+    DropArea {
+        id: markersDropArea
+        width: parent.width
+        height: markersArea.height
+        keys: ["Marker"]
+
+        onPositionChanged: {
+            drag.source.position = ptof( drag.x );
+        }
+    }
+
+    MouseArea {
+        id: markersMouseArea
+        width: parent.width
+        height: markersArea.height
+
+        onClicked: {
+            addMarker( ptof( mouseX ) );
+        }
+    }
+
     Connections {
         target: workflow
         onFrameChanged: {
diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index 78b69de..0d7793a 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -178,7 +178,13 @@ Rectangle {
 
         if ( tracks.get( tracks.count - 1 )["clips"].count > 0 )
             addTrack( trackType );
+    }
 
+    function addMarker( pos )
+    {
+        markers.append( {
+                           "position": pos
+                       } );
     }
 
     function zoomIn( ratio ) {
@@ -254,6 +260,10 @@ Rectangle {
         }
     }
 
+    ListModel {
+        id: markers
+    }
+
     MouseArea {
         id: selectionArea
         width: parent.width - initPosOfCursor
@@ -387,6 +397,14 @@ Rectangle {
                 height: page.height
                 x: initPosOfCursor
             }
+
+            Repeater {
+                model: markers
+                delegate: Marker {
+                    position: model.position
+                    markerModel: model
+                }
+            }
         }
     }
 



More information about the Vlmc-devel mailing list