[vlmc-devel] Timeline: Show a thumbnail on a clip

Yikai Lu git at videolan.org
Tue Aug 16 03:37:10 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Aug 15 20:26:16 2016 -0500| [a6ba5a0e68d153ee44093585912ece0de041a7ff] | committer: Yikai Lu

Timeline: Show a thumbnail on a clip

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

 src/Gui/timeline/Clip.qml | 24 ++++++++++++++++++++++++
 src/Gui/timeline/main.qml |  8 ++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/Gui/timeline/Clip.qml b/src/Gui/timeline/Clip.qml
index c0ec19e..36c5850 100644
--- a/src/Gui/timeline/Clip.qml
+++ b/src/Gui/timeline/Clip.qml
@@ -22,6 +22,7 @@ Rectangle {
     border.width: 1
 
     property alias name: text.text
+    property alias thumbnailSource: thumbnailImage.source
     property int trackId
     // Usualy it is trackId, the clip will be moved to the new track immediately.
     property int newTrackId
@@ -76,6 +77,10 @@ Rectangle {
         effectsItem.text = str;
     }
 
+    function updateThumbnail( pos ) {
+        thumbnailSource = "image://thumbnail/" + uuid + "/" + pos;
+    }
+
     onXChanged: {
         if ( sView.width - initPosOfCursor < width )
             return;
@@ -180,6 +185,14 @@ Rectangle {
         allClips.push( clip );
 
         updateEffects( workflow.clipInfo( uuid ) );
+
+        if ( uuid === "videoUuid" || uuid === "audioUuid" )
+            return;
+
+        if ( thumbnailProvider.hasImage( uuid, 0 ) )
+            updateThumbnail( 0 );
+        else
+            workflow.takeThumbnail( uuid, 0 );
     }
 
     Component.onDestruction: {
@@ -219,6 +232,17 @@ Rectangle {
         wrapMode: Text.Wrap
     }
 
+    Image {
+        id: thumbnailImage
+        x: 4
+        anchors.top: text.bottom
+        anchors.bottom: effectsItem.visible ? effectsItem.top : clip.bottom
+        anchors.topMargin: 4
+        anchors.bottomMargin: 4
+        fillMode: Image.PreserveAspectFit
+        visible: width < clip.width
+    }
+
     MouseArea {
         id: dragArea
         anchors.fill: parent
diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index db30657..5861685 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -643,5 +643,13 @@ Rectangle {
             scale = scaleLevel;
         }
     }
+
+    Connections {
+        target: thumbnailProvider
+        onImageReady: {
+            var clipItem = findClipItem( uuid );
+            clipItem.updateThumbnail( 0 );
+        }
+    }
 }
 



More information about the Vlmc-devel mailing list