Commit c07a55f7 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Various display adjustments for compositions and clips.

Fixes #842 and !149
parent 8222199e
Pipeline #45930 passed with stage
in 10 minutes and 29 seconds
......@@ -174,7 +174,7 @@ Rectangle {
function updateLabelOffset()
{
labelRect.x = scrollX > modelStart * timeScale ? scrollX - modelStart * timeScale : clipRoot.border.width
labelRect.x = scrollX > modelStart * timeScale ? scrollX - modelStart * timeScale : 0
}
border.color: (clipStatus == ClipStatus.StatusMissing || ClipStatus == ClipStatus.StatusWaiting || clipStatus == ClipStatus.StatusDeleting) ? "#ff0000" : selected ? root.selectionColor : grouped ? root.groupColor : borderColor
......@@ -760,9 +760,7 @@ Rectangle {
// Clip name background
id: labelRect
color: clipRoot.selected ? 'darkred' : '#66000000'
x: clipRoot.border.width
y: 0
width: label.width + 2 * clipRoot.border.width
width: label.width + (2 * clipRoot.border.width)
height: label.height
visible: clipRoot.width > width / 2
Text {
......
......@@ -170,6 +170,8 @@ Item {
onEntered: {
var itemPos = mapToItem(tracksContainerArea, 0, 0, width, height)
initDrag(compositionRoot, itemPos, compositionRoot.clipId, compositionRoot.modelStart, compositionRoot.trackId, true)
var s = i18n("%1, Position: %2, Duration: %3".arg(label.text).arg(timeline.simplifiedTC(compositionRoot.modelStart)).arg(timeline.simplifiedTC(compositionRoot.clipDuration)))
timeline.showToolTip(s)
}
onExited: {
endDrag()
......@@ -203,23 +205,22 @@ Item {
anchors.right: compositionRoot.right
anchors.left: compositionRoot.left
anchors.topMargin: displayHeight
height: parentTrack.height - displayHeight + (compositionRoot.selected ? Math.min(Logic.getTrackHeightByPos(Logic.getTrackIndexFromId(parentTrack.trackInternalId) + 1) / 3, root.baseUnit) : 0)
color: selected ? 'mediumpurple' : Qt.darker('mediumpurple')
border.color: selected ? root.selectionColor : grouped ? root.groupColor : borderColor
border.width: isGrabbed ? 8 : 1.5
height: parentTrack.height - displayHeight
color: Qt.darker('mediumpurple')
border.color: grouped ? root.groupColor : mouseArea.containsMouse ? activePalette.highlight : borderColor
border.width: isGrabbed ? 8 : 2
opacity: dragProxyArea.drag.active && dragProxy.draggedItem == clipId ? 0.5 : 1.0
Item {
// clipping container
id: container
anchors.fill: displayRect
anchors.margins:1.5
anchors.margins: displayRect.border.width
clip: true
Rectangle {
// text background
id: labelRect
color: compositionRoot.aTrack > -1 ? 'yellow' : 'lightgray'
anchors.top: container.top
width: label.width + 2
height: label.height
Text {
......@@ -237,6 +238,7 @@ Item {
}
KeyframeView {
id: effectRow
anchors.margins: displayRect.border.width
visible: compositionRoot.showKeyframes && compositionRoot.keyframeModel
selected: compositionRoot.selected
inPoint: 0
......@@ -244,22 +246,6 @@ Item {
masterObject: compositionRoot
kfrModel: compositionRoot.hideCompoViews ? 0 : compositionRoot.keyframeModel
}
ToolTip {
visible: mouseArea.containsMouse && !trimInMouseArea.containsMouse && !trimOutMouseArea.containsMouse && !trimInMouseArea.drag.active && !trimOutMouseArea.drag.active
delay: 1000
timeout: 5000
background: Rectangle {
color: activePalette.alternateBase
border.color: activePalette.light
}
contentItem: Label {
color: activePalette.text
font: miniFont
text: '%1\n%4: %5'.arg(label.text)
.arg(i18n("Duration"))
.arg(timeline.simplifiedTC(compositionRoot.clipDuration))
}
}
}
/*Drag.active: mouseArea.drag.active
Drag.proposedAction: Qt.MoveAction*/
......@@ -279,103 +265,117 @@ Item {
PropertyChanges {
target: compositionRoot
z: 1
}
PropertyChanges {
target: displayRect
height: parentTrack.height - displayHeight + Math.min(Logic.getTrackHeightByPos(Logic.getTrackIndexFromId(parentTrack.trackInternalId) + 1) / 3, root.baseUnit)
color: 'mediumpurple'
border.color: root.selectionColor
}
}
]
transitions: Transition {
NumberAnimation {
properties: "height";
easing.type: Easing.InOutQuad;
duration: 150;
}
}
Rectangle {
id: trimIn
anchors.left: displayRect.left
anchors.leftMargin: 0
height: displayRect.height
width: root.baseUnit / 3
color: isAudio? 'green' : 'lawngreen'
opacity: 0
Drag.active: trimInMouseArea.drag.active
Drag.proposedAction: Qt.MoveAction
enabled: !compositionRoot.grouped
visible: trimInMouseArea.pressed || (root.activeTool === 0 && !dragProxyArea.drag.active && compositionRoot.width > 4 * width)
MouseArea {
id: trimInMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.SizeHorCursor
drag.target: parent
drag.axis: Drag.XAxis
drag.smoothed: false
visible: root.activeTool === 0
MouseArea {
id: trimInMouseArea
x: -displayRect.border.width
height: parent.height
width: root.baseUnit / 2
hoverEnabled: true
cursorShape: Qt.SizeHorCursor
drag.target: trimInMouseArea
drag.axis: Drag.XAxis
drag.smoothed: false
visible: root.activeTool === 0
enabled: !compositionRoot.grouped && (pressed || compositionRoot.width > 3 * width)
onPressed: {
root.autoScrolling = false
compositionRoot.originalX = compositionRoot.x
compositionRoot.originalDuration = clipDuration
parent.anchors.left = undefined
}
onReleased: {
root.autoScrolling = timeline.autoScroll
parent.anchors.left = displayRect.left
compositionRoot.trimmedIn(compositionRoot)
parent.opacity = 0
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
var delta = Math.round((trimIn.x) / timeScale)
if (delta < -modelStart) {
delta = -modelStart
}
if (delta !== 0) {
var newDuration = compositionRoot.clipDuration - delta
compositionRoot.trimmingIn(compositionRoot, newDuration, mouse)
}
onPressed: {
root.autoScrolling = false
compositionRoot.originalX = compositionRoot.x
compositionRoot.originalDuration = clipDuration
anchors.left = undefined
trimIn.opacity = 0
}
onReleased: {
root.autoScrolling = timeline.autoScroll
anchors.left = displayRect.left
compositionRoot.trimmedIn(compositionRoot)
trimIn.opacity = 0
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
var delta = Math.round(x / timeScale)
if (delta < -modelStart) {
delta = -modelStart
}
if (delta !== 0) {
var newDuration = compositionRoot.clipDuration - delta
compositionRoot.trimmingIn(compositionRoot, newDuration, mouse)
}
}
onEntered: parent.opacity = 0.5
onExited: parent.opacity = 0
}
onEntered: if (!pressed) trimIn.opacity = 1
onExited: trimIn.opacity = 0
Rectangle {
id: trimIn
anchors.left: parent.left
width: displayRect.border.width
height: parent.height
color: 'lawngreen'
opacity: 0
Drag.active: trimInMouseArea.drag.active
Drag.proposedAction: Qt.MoveAction
}
}
Rectangle {
id: trimOut
MouseArea {
id: trimOutMouseArea
anchors.right: displayRect.right
anchors.rightMargin: 0
height: displayRect.height
width: root.baseUnit / 3
color: 'red'
opacity: 0
Drag.active: trimOutMouseArea.drag.active
Drag.proposedAction: Qt.MoveAction
enabled: !compositionRoot.grouped
visible: trimOutMouseArea.pressed || (root.activeTool === 0 && !dragProxyArea.drag.active && compositionRoot.width > 4 * width)
width: root.baseUnit / 2
hoverEnabled: true
cursorShape: Qt.SizeHorCursor
drag.target: trimOutMouseArea
drag.axis: Drag.XAxis
drag.smoothed: false
visible: root.activeTool === 0
enabled: !compositionRoot.grouped && (pressed || compositionRoot.width > 3 * width)
MouseArea {
id: trimOutMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.SizeHorCursor
drag.target: parent
drag.axis: Drag.XAxis
drag.smoothed: false
visible: root.activeTool === 0
onPressed: {
root.autoScrolling = false
compositionRoot.originalDuration = clipDuration
parent.anchors.right = undefined
}
onReleased: {
root.autoScrolling = timeline.autoScroll
parent.anchors.right = displayRect.right
compositionRoot.trimmedOut(compositionRoot)
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
var newDuration = Math.round((parent.x + parent.width) / timeScale)
compositionRoot.trimmingOut(compositionRoot, newDuration, mouse)
}
onPressed: {
root.autoScrolling = false
compositionRoot.originalDuration = clipDuration
anchors.right = undefined
trimOut.opacity = 0
}
onReleased: {
root.autoScrolling = timeline.autoScroll
anchors.right = displayRect.right
compositionRoot.trimmedOut(compositionRoot)
}
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
var newDuration = Math.round((x + width) / timeScale)
compositionRoot.trimmingOut(compositionRoot, newDuration, mouse)
}
onEntered: parent.opacity = 0.5
onExited: parent.opacity = 0
}
onEntered: if (!pressed) trimOut.opacity = 1
onExited: trimOut.opacity = 0
Rectangle {
id: trimOut
anchors.right: parent.right
width: displayRect.border.width
height: parent.height
color: 'red'
opacity: 0
Drag.active: trimOutMouseArea.drag.active
Drag.proposedAction: Qt.MoveAction
}
}
}
......
......@@ -402,11 +402,9 @@ Item{
// Show amount trimmed as a time in a "bubble" help.
var delta = clip.originalDuration - new_duration
var s = timeline.simplifiedTC(Math.abs(delta))
s = '%1%2 = %3'.arg((delta <= 0)? '+' : '-')
.arg(s)
.arg(timeline.simplifiedTC(new_duration))
s = i18n("%1%2, Duration = %3", ((delta <= 0)? '+' : '-')
, s, timeline.simplifiedTC(new_duration))
timeline.showToolTip(s)
//bubbleHelp.show(clip.x + clip.width, trackRoot.y + trackRoot.height, s)
}
}
onTrimmedIn: {
......@@ -422,11 +420,9 @@ Item{
// Show amount trimmed as a time in a "bubble" help.
var delta = clip.originalDuration - new_duration
var s = timeline.simplifiedTC(Math.abs(delta))
s = '%1%2 = %3'.arg((delta <= 0)? '+' : '-')
.arg(s)
.arg(timeline.simplifiedTC(new_duration))
s = i18n("%1%2, Duration = %3", ((delta <= 0)? '+' : '-')
, s, timeline.simplifiedTC(new_duration))
timeline.showToolTip(s)
//bubbleHelp.show(clip.x + clip.width, trackRoot.y + trackRoot.height, s)
}
}
onTrimmedOut: {
......
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