Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
824741bd
Commit
824741bd
authored
Nov 23, 2020
by
Jean-Baptiste Mardelle
Browse files
Subtitle track: add expand button and track label
parent
046dd663
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/TrackHead.qml
View file @
824741bd
...
...
@@ -101,7 +101,7 @@ Rectangle {
background
:
Rectangle
{
color
:
trackTarget
.
bgColor
}
width
:
2
*
fontMetrics
.
boundingRect
(
"
M
"
).
w
idth
width
:
2
*
root
.
trackTagW
idth
height
:
trackHeadRoot
.
height
verticalAlignment
:
Text
.
AlignTop
horizontalAlignment
:
Text
.
AlignHCenter
...
...
@@ -294,7 +294,7 @@ Rectangle {
background
:
Rectangle
{
color
:
trackLed
.
bgColor
}
width
:
fontMetrics
.
boundingRect
(
"
M
"
).
w
idth
*
trackHeadRoot
.
trackTag
.
length
width
:
root
.
trackTagW
idth
*
trackHeadRoot
.
trackTag
.
length
height
:
root
.
collapsedHeight
-
2
y
:
1
verticalAlignment
:
Text
.
AlignVCenter
...
...
src/timeline2/view/qml/timeline.qml
View file @
824741bd
...
...
@@ -309,6 +309,7 @@ Rectangle {
property
bool
paletteUnchanged
:
true
property
int
maxLabelWidth
:
20
*
root
.
baseUnit
*
Math
.
sqrt
(
root
.
timeScale
)
property
bool
showSubtitles
:
false
property
int
trackTagWidth
:
fontMetrics
.
boundingRect
(
"
M
"
).
width
onSeekingFinishedChanged
:
{
playhead
.
opacity
=
seekingFinished
?
1
:
0.5
...
...
@@ -715,6 +716,43 @@ Rectangle {
scrollView
.
contentY
=
Math
.
max
(
newScroll
,
0
)
}
}
Item
{
id
:
subtitleTrackHeader
width
:
tracksContainerArea
.
width
height
:
subtitleTrack
.
height
property
bool
collapsed
:
subtitleTrack
.
height
==
root
.
collapsedHeight
ToolButton
{
id
:
expandSubButton
focusPolicy
:
Qt
.
NoFocus
property
var
modifier
:
0
anchors.left
:
parent
.
left
anchors.leftMargin
:
2
*
root
.
trackTagWidth
width
:
root
.
collapsedHeight
height
:
root
.
collapsedHeight
contentItem
:
Item
{
Image
{
source
:
subtitleTrackHeader
.
collapsed
?
"
image://icon/go-next
"
:
"
image://icon/go-down
"
anchors.centerIn
:
parent
width
:
root
.
collapsedHeight
-
4
height
:
root
.
collapsedHeight
-
4
cache
:
root
.
paletteUnchanged
}
}
onClicked
:
{
if
(
subtitleTrack
.
height
>
root
.
collapsedHeight
)
{
subtitleTrack
.
height
=
root
.
collapsedHeight
}
else
{
subtitleTrack
.
height
=
5
*
root
.
baseUnit
}
}
}
Label
{
anchors.left
:
expandSubButton
.
left
anchors.top
:
expandSubButton
.
bottom
font
:
miniFont
text
:
i18n
(
"
Subtitles
"
)
}
}
Column
{
id
:
trackHeaders
y
:
subtitleTrack
.
height
...
...
@@ -906,7 +944,7 @@ Rectangle {
scim
=
false
}
onDoubleClicked
:
{
if
(
root
.
showSubtitles
&&
root
.
activeTool
===
0
&&
mouse
.
y
>
ruler
.
height
&&
mouse
.
y
<
(
ruler
.
height
+
subtitleTrack
.
height
))
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
&&
root
.
showSubtitles
&&
root
.
activeTool
===
0
&&
mouse
.
y
>
ruler
.
height
&&
mouse
.
y
<
(
ruler
.
height
+
subtitleTrack
.
height
))
{
timeline
.
addSubtitle
((
scrollView
.
contentX
+
mouseX
)
/
timeline
.
scaleFactor
)
}
}
...
...
@@ -1124,7 +1162,7 @@ Rectangle {
Item
{
id
:
subtitleTrack
width
:
tracksContainerArea
.
width
height
:
showSubtitles
?
root
.
baseUnit
*
4
:
0
height
:
showSubtitles
?
root
.
baseUnit
*
5
:
0
Repeater
{
id
:
subtitlesRepeater
;
model
:
subtitleDelegateModel
}
MouseArea
{
anchors.fill
:
parent
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment