Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix clip resize

parent d5170bf7
......@@ -54,6 +54,8 @@ Rectangle {
property string hash: 'ccc' //TODO
property double speed: 1.0
property color borderColor: 'black'
x: modelStart * timeScale
width : clipDuration * timeScale;
signal clicked(var clip, int shiftClick)
signal moved(var clip)
......@@ -65,13 +67,10 @@ Rectangle {
signal trimmingOut(var clip, real newDuration, var mouse)
signal trimmedOut(var clip)
onModelStartChanged: {
console.log("MODEL START CHANGED !!!!!!", modelStart, clipId, x);
x = modelStart * timeScale;
onClipDurationChanged: {
width = clipDuration * timeScale;
}
onTimeScaleChanged: {
console.log("SCALE CHANGED !!!!!!", timeScale)
x = modelStart * timeScale;
width = clipDuration * timeScale;
}
......@@ -114,7 +113,8 @@ Rectangle {
}
function imagePath(time) {
if (isAudio || isBlank || mltService === 'color') {
console.log('get clip thumb for sercvie: ', mltService)
if (isAudio || mltService === 'color' || mltService === '') {
return ''
} else {
return 'image://thumbnail/' + binId + '/' + mltService + '/' + clipResource + '#' + time
......@@ -522,7 +522,6 @@ Rectangle {
Rectangle {
id: trimIn
enabled: !isBlank
anchors.left: parent.left
anchors.leftMargin: 0
height: parent.height
......@@ -542,7 +541,7 @@ Rectangle {
onPressed: {
root.stopScrolling = true
clipRoot.originalX = mapToItem(null, x, y).x
clipRoot.originalX = clipRoot.x
clipRoot.originalDuration = clipDuration
parent.anchors.left = undefined
}
......@@ -550,14 +549,12 @@ Rectangle {
root.stopScrolling = false
parent.anchors.left = clipRoot.left
clipRoot.trimmedIn(clipRoot)
parent.opacity = 0
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
clipRoot.draggedX = mapToItem(null, x, y).x
var delta = Math.round((draggedX - originalX) / timeScale)
var delta = Math.round((trimIn.x) / timeScale)
if (delta !== 0) {
var newDuration = clipRoot.clipDuration - delta
var newDuration = clipDuration - delta
clipRoot.trimmingIn(clipRoot, newDuration, mouse)
}
}
......
......@@ -69,17 +69,49 @@ Column{
value: trackRoot.selection.indexOf(loader.item.clipId) !== -1
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "mltService"
value: model.mlt_service
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "modelStart"
value: model.start
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "a_track"
value: loader.item.a_track
when: loader.item.isComposition && loader.status == Loader.Ready
value: model.a_track
when: loader.status == Loader.Ready && loader.item.isComposition
}
Binding {
target: loader.item
property: "trackHeight"
value: root.trackHeight
when: loader.item.isComposition && loader.status == Loader.Ready
when: loader.status == Loader.Ready && loader.item.isComposition
}
Binding {
target: loader.item
property: "clipDuration"
value: model.duration
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "inPoint"
value: model.in
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "outPoint"
value: model.out
when: loader.status == Loader.Ready
}
sourceComponent: {
if (model.isComposition) {
......@@ -89,13 +121,9 @@ Column{
}
}
onLoaded: {
console.log('loaded clip: ', model.start)
item.clipName= model.name
item.clipResource= model.resource
item.clipDuration= model.duration
item.mltService= model.mlt_service
item.inPoint= model.in
item.outPoint= model.out
item.isBlank= model.blank
item.clipId= model.item
item.binId= model.binId
item.isAudio= false //model.audio
......@@ -108,9 +136,6 @@ Column{
} else {
item.a_track = model.a_track
}
item.width= model.duration * timeScale
item.modelStart= model.start
item.x= model.start * timeScale
item.grouped= model.grouped
item.borderColor= (model.grouped ? 'yellow' : 'black')
item.trackIndex= trackRoot.DelegateModel.itemsIndex
......
......@@ -198,7 +198,7 @@ Rectangle {
var frame = controller.getClipPosition(clipBeingDroppedId)
var track = controller.getClipTrackId(clipBeingDroppedId)
// we simulate insertion at the final position so that stored undo has correct value
controller.requestClipDeletion(clipBeingDroppedId, false)
controller.requestItemDeletion(clipBeingDroppedId, false)
timeline.insertClip(track, frame, clipBeingDroppedData, true)
}
clipBeingDroppedId = -1
......@@ -385,7 +385,7 @@ Rectangle {
border.color: Qt.rgba(activePalette.windowText.r, activePalette.windowText.g, activePalette.windowText.b, 0.1)
//Layout.fillWidth: true
height: model.trackHeight
color: (index === currentTrack)? Qt.tint(getTrackColor(tracksRepeater.itemAt(index).isAudio, false), selectedTrackColor) : getTrackColor(tracksRepeater.itemAt(index).isAudio, false)
color: tracksRepeater.itemAt(index) ? ((index === currentTrack) ? Qt.tint(getTrackColor(tracksRepeater.itemAt(index).isAudio, false), selectedTrackColor) : getTrackColor(tracksRepeater.itemAt(index).isAudio, false)) : 'red'
}
}
}
......
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