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

Various fixes for clip monitor markers, fix zone out 1 frame offset

parent a5fe0909
......@@ -667,7 +667,7 @@ QPoint ProjectClip::zone() const
int x = getProducerIntProperty(QStringLiteral("kdenlive:zone_in"));
int y = getProducerIntProperty(QStringLiteral("kdenlive:zone_out"));
if (y <= x) {
y = getFramePlaytime() - 1;
y = getFramePlaytime();
}
return QPoint(x, y);
}
......
......@@ -1092,7 +1092,7 @@ void Monitor::checkOverlay(int pos)
if (!found) {
if (pos == zone.x()) {
overlayText = i18n("In Point");
} else if (pos == zone.y()) {
} else if (pos == zone.y() - 1) {
overlayText = i18n("Out Point");
}
} else {
......@@ -1213,9 +1213,6 @@ void Monitor::adjustRulerSize(int length, std::shared_ptr<MarkerListModel> marke
connect(markerModel.get(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &, const QVector<int> &)), this, SLOT(checkOverlay()));
connect(markerModel.get(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(checkOverlay()));
connect(markerModel.get(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(checkOverlay()));
if (m_controller) {
markerModel->registerSnapModel(m_snaps);
}
}
}
......@@ -1374,6 +1371,7 @@ void Monitor::slotOpenClip(std::shared_ptr<ProjectClip> controller, int in, int
m_glMonitor->setProducer(m_controller->originalProducer().get(), isActive(), in);
m_audioMeterWidget->audioChannels = controller->audioInfo() ? controller->audioInfo()->channels() : 0;
m_glMonitor->setAudioThumb(controller->audioChannels(), controller->audioFrameCache);
m_controller->getMarkerModel()->registerSnapModel(m_snaps);
// hasEffects = controller->hasEffects();
} else {
m_glMonitor->setProducer(nullptr, isActive());
......
......@@ -42,63 +42,10 @@ Rectangle {
opacity: 0.5
}
}
// markers
Repeater {
model: markersModel
delegate:
Item {
anchors.fill: parent
Rectangle {
id: markerBase
width: 1
height: parent.height
x: (model.frame) * root.timeScale;
color: model.color
}
Rectangle {
visible: mlabel.visible
opacity: 0.7
x: markerBase.x
radius: 2
width: mlabel.contentWidth
height: mlabel.contentHeight
anchors {
bottom: parent.top
}
color: model.color
Text {
id: mlabel
visible: true //mouseOverRuler && Math.abs(root.mouseRulerPos - markerBase.x) < 4
text: model.comment
font.pixelSize: root.baseUnit
anchors {
fill: parent
//topMargin: 2
//leftMargin: 2
}
color: 'white'
}
MouseArea {
z: 10
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
//onDoubleClicked: timeline.editMarker(clipRoot.binId, model.frame)
onClicked: {
controller.requestSeekPosition(markerBase.x / root.timeScale)
}
}
}
}
}
MouseArea {
id: rulerMouseArea
anchors.fill: parent
hoverEnabled: true
onEntered: root.mouseOverRuler = true;
onExited: root.mouseOverRuler = false;
onPressed: {
if (mouse.buttons === Qt.LeftButton) {
controller.requestSeekPosition(Math.min(mouseX / root.timeScale, root.duration));
......@@ -116,7 +63,7 @@ Rectangle {
// Zone duration indicator
Rectangle {
visible: zoneToolTipTimer.running || rulerMouseArea.containsMouse || trimInMouseArea.containsMouse || trimInMouseArea.pressed || trimOutMouseArea.containsMouse || trimOutMouseArea.pressed
width: inLabel.contentWidth
width: inLabel.contentWidth + 4
height: inLabel.contentHeight
property int centerPos: zone.x + zone.width / 2 - inLabel.contentWidth / 2
x: centerPos < 0 ? 0 : centerPos > ruler.width - inLabel.contentWidth ? ruler.width - inLabel.contentWidth : centerPos
......@@ -125,8 +72,9 @@ Rectangle {
Label {
id: inLabel
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
text: trimInMouseArea.containsMouse || trimInMouseArea.pressed ? controller.toTimecode(controller.zoneIn) + '>' + controller.toTimecode(controller.zoneOut - controller.zoneIn) : trimOutMouseArea.containsMouse || trimOutMouseArea.pressed ? controller.toTimecode(controller.zoneOut - controller.zoneIn) + '<' + controller.toTimecode(controller.zoneOut) : controller.toTimecode(controller.zoneOut - controller.zoneIn)
font.pixelSize: root.baseUnit
font.pointSize: root.baseUnit
color: activePalette.highlightedText
}
}
......@@ -199,6 +147,57 @@ Rectangle {
}
}
// markers
Repeater {
model: markersModel
delegate:
Item {
anchors.fill: parent
Rectangle {
id: markerBase
width: 1
height: parent.height
x: (model.frame) * root.timeScale;
color: model.color
}
Rectangle {
visible: !rulerMouseArea.pressed && (guideArea.containsMouse || (rulerMouseArea.containsMouse && Math.abs(rulerMouseArea.mouseX - markerBase.x) < 4))
opacity: 0.7
property int guidePos: markerBase.x - mlabel.contentWidth / 2
x: guidePos < 0 ? 0 : (guidePos > (parent.width - mlabel.contentWidth) ? parent.width - mlabel.contentWidth : guidePos)
radius: 2
width: mlabel.contentWidth
height: mlabel.contentHeight * .8
anchors {
bottom: parent.top
}
color: model.color
Text {
id: mlabel
text: model.comment
font.pointSize: root.baseUnit
verticalAlignment: Text.AlignVCenter
anchors {
fill: parent
}
color: 'white'
}
MouseArea {
z: 10
id: guideArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
//onDoubleClicked: timeline.editMarker(clipRoot.binId, model.frame)
onClicked: {
controller.requestSeekPosition(model.frame)
}
}
}
}
}
Rectangle {
id: seekCursor
visible: controller.seekPosition > -1
......
......@@ -28,7 +28,6 @@ Item {
property bool showToolbar: false
property real baseUnit: fontMetrics.font.pointSize
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
property double frameSize: 10
property double timeScale: 1
......
......@@ -27,7 +27,6 @@ Item {
property bool showAudiothumb
property real baseUnit: fontMetrics.font.pointSize
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
property double frameSize: 10
property double timeScale: 1
......
......@@ -27,7 +27,6 @@ Item {
property int requestedKeyFrame
property real baseUnit: fontMetrics.font.pointSize
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
property double frameSize: 10
property double timeScale: 1
......
......@@ -21,7 +21,6 @@ Item {
property double timeScale: 1
property double frameSize: 10
property int duration: 300
property bool mouseOverRuler: false
property real baseUnit: fontMetrics.font.pointSize
property int mouseRulerPos: 0
onScalexChanged: canvas.requestPaint()
......
......@@ -20,7 +20,6 @@ Item {
property double frameSize: 10
property int duration: 300
property double timeScale: 1
property bool mouseOverRuler: false
property real baseUnit: fontMetrics.font.pointSize
property int mouseRulerPos: 0
onOffsetxChanged: canvas.requestPaint()
......
......@@ -12,7 +12,6 @@ Item {
property double timeScale: 1
property double frameSize: 10
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
property int splitterPos
property point center
......
......@@ -168,23 +168,25 @@ Rectangle {
}
// Zone frame indicator
Rectangle {
visible: trimInMouseArea.drag.active || moveMouseArea2.drag.active || (useTimelineRuler && showZoneLabels && labelSize * 2 < zone.width)
visible: useTimelineRuler && (trimInMouseArea.drag.active || moveMouseArea2.drag.active || (useTimelineRuler && showZoneLabels && labelSize * 2 < zone.width))
width: inLabel.contentWidth
height: zone.height
height: inLabel.contentHeight
anchors.bottom: zone.top
color: activePalette.highlight
opacity: 0.8
Label {
id: inLabel
anchors.fill: parent
text: timeline.timecode(timeline.zoneIn)
font.pixelSize: zone.height
font.pointSize: root.baseUnit
color: activePalette.highlightedText
}
}
Rectangle {
visible: trimOutMouseArea.drag.active || (useTimelineRuler && showZoneLabels && labelSize * 2 < zone.width)
visible: useTimelineRuler && (trimOutMouseArea.drag.active || (useTimelineRuler && showZoneLabels && labelSize * 2 < zone.width))
width: outLabel.contentWidth
height: zone.height
height: outLabel.contentHeight
anchors.bottom: zone.top
color: activePalette.highlight
opacity: 0.8
x: zone.width - outLabel.contentWidth
......@@ -192,16 +194,17 @@ Rectangle {
id: outLabel
anchors.fill: parent
text: timeline.timecode(timeline.zoneOut)
font.pixelSize: zone.height
font.pointSize: root.baseUnit
color: activePalette.highlightedText
}
}
Rectangle {
id: durationRect
visible: parent.width > 2 * width && !trimInMouseArea.drag.active && !trimOutMouseArea.drag.active
anchors.bottom: zone.top
visible: useTimelineRuler && (parent.width > 2 * width && !trimInMouseArea.drag.active && !trimOutMouseArea.drag.active)
anchors.horizontalCenter: parent.horizontalCenter
width: durationLabel.contentWidth
height: zone.height
width: durationLabel.contentWidth + 4
height: durationLabel.contentHeight
color: activePalette.highlight
opacity: moveMouseArea2.drag.active ? 0 : 1
MouseArea {
......@@ -234,8 +237,9 @@ Rectangle {
Label {
id: durationLabel
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
text: timeline.timecode(timeline.zoneOut - timeline.zoneIn)
font.pixelSize: zone.height
font.pointSize: root.baseUnit
color: activePalette.highlightedText
}
}
......
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