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

Some improvments to timeline tooltips

parent ff1fa2fd
Pipeline #5165 passed with stage
in 16 minutes and 5 seconds
......@@ -114,7 +114,7 @@ Rectangle {
}
contentItem: Label {
color: activePalette.text
text: label.text + ' (' + timeline.timecode(clipRoot.inPoint) + '-' + timeline.timecode(clipRoot.outPoint) + ')'
text: label.text + ' (' + timeline.simplifiedTC(clipRoot.inPoint) + '-' + timeline.simplifiedTC(clipRoot.outPoint) + ')'
}
}
......@@ -364,7 +364,7 @@ Rectangle {
}
contentItem: Label {
color: activePalette.text
text: positionOffset < 0 ? i18n("Offset: -%1", timeline.timecode(-positionOffset)) : i18n("Offset: %1", timeline.timecode(positionOffset))
text: positionOffset < 0 ? i18n("Offset: -%1", timeline.simplifiedTC(-positionOffset)) : i18n("Offset: %1", timeline.simplifiedTC(positionOffset))
}
}
Text {
......@@ -673,7 +673,7 @@ Rectangle {
if (duration != clipRoot.fadeIn) {
timeline.adjustFade(clipRoot.clipId, 'fadein', duration, -1)
// Show fade duration as time in a "bubble" help.
var s = timeline.timecode(Math.max(duration, 0))
var s = timeline.simplifiedTC(Math.max(duration, 0))
bubbleHelp.show(clipRoot.x, parentTrack.y + clipRoot.height, s)
}
}
......@@ -774,7 +774,7 @@ Rectangle {
if (clipRoot.fadeOut != duration) {
timeline.adjustFade(clipRoot.clipId, 'fadeout', duration, -1)
// Show fade duration as time in a "bubble" help.
var s = timeline.timecode(Math.max(duration, 0))
var s = timeline.simplifiedTC(Math.max(duration, 0))
bubbleHelp.show(clipRoot.x + clipRoot.width, parentTrack.y + clipRoot.height, s)
}
}
......@@ -812,6 +812,21 @@ Rectangle {
Drag.proposedAction: Qt.MoveAction
visible: trimInMouseArea.pressed || (root.activeTool === 0 && !mouseArea.drag.active && clipRoot.width > 4 * width)
ToolTip {
visible: trimInMouseArea.containsMouse && !trimInMouseArea.pressed
font.pixelSize: root.baseUnit
delay: 1000
timeout: 5000
background: Rectangle {
color: activePalette.alternateBase
border.color: activePalette.light
}
contentItem: Label {
color: activePalette.text
text: i18n("In:%1\nPosition:%2", timeline.simplifiedTC(clipRoot.inPoint),timeline.simplifiedTC(clipRoot.modelStart))
}
}
MouseArea {
id: trimInMouseArea
anchors.fill: parent
......@@ -879,6 +894,21 @@ Rectangle {
Drag.proposedAction: Qt.MoveAction
visible: trimOutMouseArea.pressed || (root.activeTool === 0 && !mouseArea.drag.active && clipRoot.width > 4 * width)
ToolTip {
visible: trimOutMouseArea.containsMouse && !trimOutMouseArea.pressed
font.pixelSize: root.baseUnit
delay: 1000
timeout: 5000
background: Rectangle {
color: activePalette.alternateBase
border.color: activePalette.light
}
contentItem: Label {
color: activePalette.text
text: i18n("Out: ") + timeline.simplifiedTC(clipRoot.outPoint)
}
}
MouseArea {
id: trimOutMouseArea
anchors.fill: parent
......
......@@ -285,10 +285,11 @@ Column{
clip.originalX = clip.draggedX
// Show amount trimmed as a time in a "bubble" help.
var delta = new_duration - clip.originalDuration
var s = timeline.timecode(Math.abs(delta))
s = '%1%2 = %3'.arg((delta < 0)? '+' : (delta > 0)? '-' : '')
var s = timeline.simplifiedTC(Math.abs(delta))
s = '%1%2\n%3:%4'.arg((delta <= 0)? '+' : '-')
.arg(s)
.arg(timeline.timecode(clipDuration))
.arg(i18n("In"))
.arg(timeline.simplifiedTC(clip.inPoint))
bubbleHelp.show(clip.x - 20, trackRoot.y + trackRoot.height, s)
}
}
......@@ -327,10 +328,11 @@ Column{
clip.lastValidDuration = new_duration
// Show amount trimmed as a time in a "bubble" help.
var delta = clip.originalDuration - new_duration
var s = timeline.timecode(Math.abs(delta))
s = '%1%2 = %3'.arg((delta < 0)? '+' : (delta > 0)? '-' : '')
var s = timeline.simplifiedTC(Math.abs(delta))
s = '%1%2\n%3:%4'.arg((delta <= 0)? '+' : '-')
.arg(s)
.arg(timeline.timecode(new_duration))
.arg(i18n("Duration"))
.arg(timeline.simplifiedTC(new_duration))
bubbleHelp.show(clip.x + clip.width - 20, trackRoot.y + trackRoot.height, s)
}
}
......@@ -368,10 +370,10 @@ Column{
clip.originalX = clip.draggedX
// Show amount trimmed as a time in a "bubble" help.
var delta = newDuration - clip.originalDuration
var s = timeline.timecode(Math.abs(delta))
s = '%1%2 = %3'.arg((delta < 0)? '+' : (delta > 0)? '-' : '')
var s = timeline.simplifiedTC(Math.abs(delta))
s = '%1%2 = %3'.arg((delta <= 0)? '+' : '-')
.arg(s)
.arg(timeline.timecode(clipDuration))
.arg(timeline.simplifiedTC(clipDuration))
bubbleHelp.show(clip.x + clip.width, trackRoot.y + trackRoot.height, s)
}
}
......@@ -386,10 +388,10 @@ Column{
clip.lastValidDuration = newDuration
// Show amount trimmed as a time in a "bubble" help.
var delta = newDuration - clip.originalDuration
var s = timeline.timecode(Math.abs(delta))
s = '%1%2 = %3'.arg((delta < 0)? '+' : (delta > 0)? '-' : '')
var s = timeline.simplifiedTC(Math.abs(delta))
s = '%1%2 = %3'.arg((delta <= 0)? '+' : '-')
.arg(s)
.arg(timeline.timecode(clipDuration))
.arg(timeline.simplifiedTC(clipDuration))
bubbleHelp.show(clip.x + clip.width, trackRoot.y + trackRoot.height, s)
}
}
......
......@@ -1227,12 +1227,9 @@ Rectangle {
}
var delta = dragFrame - dragProxy.sourceFrame
if (delta != 0) {
var s = timeline.timecode(Math.abs(delta))
// remove leading zeroes
if (s.substring(0, 3) === '00:')
s = s.substring(3)
s = ((delta < 0)? '-' : (delta > 0)? '+' : '') + s
bubbleHelp.show(parent.x, ruler.height, s)
var s = timeline.simplifiedTC(Math.abs(delta))
s = ((delta < 0)? '-' : '+') + s + i18n("\nPosition:%1", timeline.simplifiedTC(dragFrame))
bubbleHelp.show(parent.x + mouseX, Math.max(ruler.height, Logic.getTrackYFromId(timeline.activeTrack)), s)
} else bubbleHelp.hide()
}
}
......
......@@ -484,6 +484,15 @@ QString TimelineController::timecode(int frames)
return KdenliveSettings::frametimecode() ? QString::number(frames) : m_model->tractor()->frames_to_time(frames, mlt_time_smpte_df);
}
QString TimelineController::simplifiedTC(int frames)
{
if (KdenliveSettings::frametimecode()) {
return QString::number(frames);
}
QString s = m_model->tractor()->frames_to_time(frames, mlt_time_smpte_df);
return s.startsWith(QLatin1String("00:")) ? s.remove(0, 3) : s;
}
bool TimelineController::showThumbnails() const
{
return KdenliveSettings::videothumbnails();
......
......@@ -164,6 +164,7 @@ public:
Q_INVOKABLE bool ripple();
Q_INVOKABLE bool scrub();
Q_INVOKABLE QString timecode(int frames);
Q_INVOKABLE QString simplifiedTC(int frames);
/* @brief Request inserting a new clip in timeline (dragged from bin or monitor)
@param tid is the destination track
@param position is the timeline position
......
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