[vlmc-devel] Add ClipLibraryView.qml

Yikai Lu git at videolan.org
Mon Dec 12 04:20:00 CET 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Dec 11 21:13:24 2016 -0600| [02ac60149be85e90068306db1dda2f92257438e2] | committer: Yikai Lu

Add ClipLibraryView.qml

> https://code.videolan.org/videolan/vlmc/commit/02ac60149be85e90068306db1dda2f92257438e2
---

 src/Gui/library/ui/ClipLibraryView.qml | 86 ++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/src/Gui/library/ui/ClipLibraryView.qml b/src/Gui/library/ui/ClipLibraryView.qml
new file mode 100644
index 0000000..c42d2c0
--- /dev/null
+++ b/src/Gui/library/ui/ClipLibraryView.qml
@@ -0,0 +1,86 @@
+import QtQuick 2.0
+import QtQuick.Controls 1.4
+
+Rectangle {
+    id: clipLibraryView
+    anchors.fill: parent
+    color: "#999999"
+
+    property var clipItems: []
+    property int currentMediaId: -1
+
+    ListModel {
+        id: clips
+    }
+
+    ListModel {
+        id: subClips
+    }
+
+    ScrollView {
+        id: sView
+        height: parent.height
+        width: parent.width
+
+        ListView {
+            id: clipListView
+            width: sView.viewport.width
+            model: clips
+            focus: true
+            delegate: ClipItem {
+                uuid: model.uuid
+                isBaseClip: model.isBaseClip
+                duration: model.duration
+                thumbnailPath: model.thumbnailPath
+                mediaId: model.mediaId
+                onTimeline: model.onTimeline
+                title: model.title
+                width: parent.width
+            }
+        }
+    }
+
+    Connections {
+        target: view
+
+        onClipAdded: {
+            var clip = view.clip( uuid );
+            clips.append( clip );
+            if ( !clip.isBaseClip ) {
+                for ( var i = 0; i < clipItems.length; ++i ) {
+                    if ( clipItems[i].mediaId === clip.mediaId && clipItems[i].isBaseClip ) {
+                        clipItems[i].addSubClip( uuid );
+                        break;
+                    }
+                }
+            }
+        }
+
+        onClipOnTimelineChanged: {
+            for ( var i = 0; i < clipItems.length; ++i ) {
+                if ( clipItems[i].uuid === uuid ) {
+                    clipItems[i].onTimeline = onTimeline;
+                    break;
+                }
+            }
+        }
+
+        onClipRemoved: {
+            var clip = view.clip( uuid );
+            if ( clip.isBaseClip === false ) {
+                for ( var i = 0; i < clipItems.length; ++i ) {
+                    if ( clipItems[i].mediaId === clip.mediaId && clipItems[i].isBaseClip ) {
+                        clipItems[i].removeSubClip( uuid );
+                        break;
+                    }
+                }
+            }
+            for ( var i = 0; i < clips.count; ++i ) {
+                if ( clips[i].uuid === uuid ) {
+                    clips.remove( i );
+                    break;
+                }
+            }
+        }
+    }
+}



More information about the Vlmc-devel mailing list