Commit a6ba5a0e authored by luyikei's avatar luyikei

Timeline: Show a thumbnail on a clip

parent 67bf50e0
......@@ -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
......
......@@ -643,5 +643,13 @@ Rectangle {
scale = scaleLevel;
}
}
Connections {
target: thumbnailProvider
onImageReady: {
var clipItem = findClipItem( uuid );
clipItem.updateThumbnail( 0 );
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment