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 track qml confusion and crash on selection deletion

parent 464a31c8
......@@ -725,6 +725,9 @@ bool TimelineModel::requestGroupDeletion(int clipId, bool logUndo)
return false;
}
}
if (m_temporarySelectionGroup == clipId) {
m_temporarySelectionGroup = -1;
}
if (logUndo) {
PUSH_UNDO(undo, redo, i18n("Remove group"));
}
......
......@@ -45,6 +45,7 @@ Rectangle {
property int fadeIn: 0
property int fadeOut: 0
property int binId: 0
property var parentTrack: trackRoot
property int trackIndex //Index in track repeater
property int trackId: -42 //Id in the model
property int clipId //Id of the clip in the model
......@@ -127,6 +128,7 @@ Rectangle {
function reparent(track) {
parent = track
height = track.height
parentTrack = track
generateWaveform()
}
......@@ -197,7 +199,7 @@ Rectangle {
onPositionChanged: {
if (pressed) {
if (mouse.y < 0 || mouse.y > height) {
var mapped = trackRoot.mapFromItem(clipRoot, mouse.x, mouse.y).x
var mapped = parentTrack.mapFromItem(clipRoot, mouse.x, mouse.y).x
parent.draggedToTrack(clipRoot, mapToItem(null, 0, mouse.y).y, mapped)
} else {
parent.dragged(clipRoot, mouse)
......@@ -250,7 +252,7 @@ Rectangle {
Image {
id: outThumbnail
visible: timeline.showThumbnails && mltService != 'color' && !isAudio && clipStatus < 2
opacity: trackRoot.isAudio || trackRoot.isHidden ? 0.2 : 1
opacity: parentTrack.isAudio || parentTrack.isHidden ? 0.2 : 1
anchors.top: container.top
anchors.right: container.right
anchors.bottom: container.bottom
......@@ -263,7 +265,7 @@ Rectangle {
Image {
id: inThumbnail
visible: timeline.showThumbnails && mltService != 'color' && !isAudio && clipStatus < 2
opacity: trackRoot.isAudio || trackRoot.isHidden ? 0.2 : 1
opacity: parentTrack.isAudio || parentTrack.isHidden ? 0.2 : 1
anchors.left: container.left
anchors.bottom: container.bottom
anchors.top: container.top
......@@ -275,8 +277,8 @@ Rectangle {
Row {
id: waveform
visible: hasAudio && timeline.showAudioThumbnails && !trackRoot.isMute && (clipStatus == 0 || clipStatus == 2)
height: isAudio || trackRoot.isAudio || clipStatus == 2 ? container.height - 1 : (container.height - 1) / 2
visible: hasAudio && timeline.showAudioThumbnails && !parentTrack.isMute && (clipStatus == 0 || clipStatus == 2)
height: isAudio || parentTrack.isAudio || clipStatus == 2 ? container.height - 1 : (container.height - 1) / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: container.bottom
......@@ -446,7 +448,7 @@ Rectangle {
parent.anchors.horizontalCenter = undefined
parent.opacity = 1
fadeInTriangle.opacity = 0.5
// trackRoot.clipSelected(clipRoot, trackRoot) TODO
// parentTrack.clipSelected(clipRoot, parentTrack) TODO
}
onReleased: {
root.stopScrolling = false
......@@ -467,7 +469,7 @@ Rectangle {
// Show fade duration as time in a "bubble" help.
var s = timeline.timecode(Math.max(duration, 0))
bubbleHelp.show(clipRoot.x, trackRoot.y + clipRoot.height, s.substring(6))
bubbleHelp.show(clipRoot.x, parentTrack.y + clipRoot.height, s.substring(6))
}
}
}
......@@ -557,7 +559,7 @@ Rectangle {
// Show fade duration as time in a "bubble" help.
var s = timeline.timecode(Math.max(duration, 0))
bubbleHelp.show(clipRoot.x + clipRoot.width, trackRoot.y + clipRoot.height, s.substring(6))
bubbleHelp.show(clipRoot.x + clipRoot.width, parentTrack.y + clipRoot.height, s.substring(6))
}
}
}
......@@ -689,7 +691,7 @@ Rectangle {
text: i18n('Cut')
onTriggered: {
console.log('cutting clip:', clipRoot.clipId)
if (!trackRoot.isLocked) {
if (!parentTrack.isLocked) {
timeline.requestClipCut(clipRoot.clipId, timeline.position)
} else {
root.pulseLockButtonOnTrack(currentTrack)
......@@ -697,7 +699,7 @@ Rectangle {
}
}
MenuItem {
visible: !grouped && trackRoot.selection.length > 1
visible: !grouped && parentTrack.selection.length > 1
text: i18n('Group')
onTriggered: timeline.triggerAction('group_clip')
}
......
......@@ -35,6 +35,7 @@ Item {
property string mltService: ''
property int modelStart: x
property int displayHeight: 0
property var parentTrack: trackRoot
property int inPoint: 0
property int outPoint: 0
property int clipDuration: 0
......@@ -93,6 +94,7 @@ Item {
function reparent(track) {
parent = track
isAudio = track.isAudio
parentTrack = track
displayHeight = track.height / 2
}
......@@ -183,7 +185,7 @@ Item {
}
onPositionChanged: {
if (mouse.y < -height || mouse.y > height) {
var mapped = trackRoot.mapFromItem(compositionRoot, mouse.x, mouse.y).x
var mapped = parentTrack.mapFromItem(compositionRoot, mouse.x, mouse.y).x
compositionRoot.draggedToTrack(compositionRoot, mapToItem(null, 0, mouse.y).y, mapped)
} else {
compositionRoot.dragged(compositionRoot, mouse)
......@@ -316,7 +318,7 @@ Item {
GradientStop { position: 1.0; color: "#00000000" }
}
visible: compositionRoot.aTrack > 0
y: root.getTrackYFromMltIndex(compositionRoot.aTrack) - trackRoot.mapToItem(null, 0, 0).y + ruler.height
y: root.getTrackYFromMltIndex(compositionRoot.aTrack) - parentTrack.mapToItem(null, 0, 0).y + ruler.height
height: clabel.height + 4
Text {
id: clabel
......@@ -339,7 +341,7 @@ Item {
MenuItem {
text: i18n('Cut')
onTriggered: {
if (!trackRoot.isLocked) {
if (!parentTrack.isLocked) {
timeline.copyClip(trackIndex, index)
timeline.remove(trackIndex, index)
} else {
......@@ -348,7 +350,7 @@ Item {
}
}
MenuItem {
visible: !grouped && trackRoot.selection.length > 1
visible: !grouped && parentTrack.selection.length > 1
text: i18n('Group')
onTriggered: timeline.groupSelection()
}
......
......@@ -72,6 +72,18 @@ Column{
value: trackRoot.selection.indexOf(loader.item.clipId) !== -1
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "trackIndex"
value: trackRoot.DelegateModel.itemsIndex
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "trackId"
value: trackRoot.trackId
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "mltService"
......@@ -180,6 +192,12 @@ Column{
value: model.item
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "isComposition"
value: model.isComposition
when: loader.status == Loader.Ready
}
Binding {
target: loader.item
property: "binId"
......@@ -197,7 +215,7 @@ Column{
console.log('loaded clip: ', model.start)
//item.clipId= model.item
//item.binId= model.binId
item.isComposition= model.isComposition
//item.isComposition= model.isComposition
if (!model.isComposition) {
item.audioLevels= model.audioLevels
item.isAudio= model.audio
......@@ -206,13 +224,13 @@ Column{
item.fadeOut = model.fadeOut
item.hasAudio = model.hasAudio
} else {
item.aTrack = model.a_track
//item.aTrack = model.a_track
}
item.trackIndex= trackRoot.DelegateModel.itemsIndex
item.trackId= trackRoot.trackId
//item.trackIndex= trackRoot.DelegateModel.itemsIndex
//item.trackId= trackRoot.trackId
//hash= model.hash
item.speed= 1 //model.speed
item.selected= trackRoot.selection.indexOf(item.clipId) !== -1
//item.selected= trackRoot.selection.indexOf(item.clipId) !== -1
console.log(width, height);
}
}
......
......@@ -299,8 +299,13 @@ void TimelineController::deleteSelectedClips()
if (m_selection.selectedClips.isEmpty()) {
return;
}
for (int cid : m_selection.selectedClips) {
m_model->requestItemDeletion(cid);
if (m_model->m_temporarySelectionGroup != -1) {
// selection is grouped, delete group only
m_model->requestGroupDeletion(m_model->m_temporarySelectionGroup);
} else {
for (int cid : m_selection.selectedClips) {
m_model->requestItemDeletion(cid);
}
}
m_selection.selectedClips.clear();
}
......
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