Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
259
Issues
259
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
3e111f51
Commit
3e111f51
authored
Aug 24, 2020
by
Sashmita Raghav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make start position of subtitle editable
parent
2ad81743
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
47 deletions
+119
-47
src/timeline2/view/qml/timeline.qml
src/timeline2/view/qml/timeline.qml
+119
-47
No files found.
src/timeline2/view/qml/timeline.qml
View file @
3e111f51
...
...
@@ -1464,10 +1464,12 @@ Rectangle {
id
:
subtitleRoot
visible
:
true
z
:
20
property
int
duration
:
(
model
.
endframe
-
model
.
startframe
)
*
timeScale
property
real
duration
:
(
model
.
endframe
-
model
.
startframe
)
property
int
oldStartX
property
double
oldStartFrame
:
subtitleBase
.
x
Rectangle
{
id
:
subtitleBase
width
:
duration
width
:
duration
*
timeScale
height
:
tracksContainer
.
height
x
:
model
.
startframe
*
timeScale
;
/*Text {
...
...
@@ -1475,7 +1477,7 @@ Rectangle {
anchors.fill: parent
visible: true
text: model.subtitle
color: '
white
'
color: '
black
'
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
...
...
@@ -1505,55 +1507,125 @@ Rectangle {
color
:
'
black
'
padding
:
0
}
Rectangle
{
// end position resize handle
id
:
rightend
}
Rectangle
{
id
:
leftstart
width
:
4
height
:
subtitleBase
.
height
x
:
model
.
startframe
*
timeScale
;
anchors.top
:
subtitleBase
.
top
anchors.left
:
subtitleBase
.
left
color
:
'
green
'
visible
:
true
MouseArea
{
// Right resize handle to change end timing
id
:
startMouseArea
anchors.fill
:
parent
height
:
parent
.
height
width
:
2
hoverEnabled
:
true
enabled
:
true
property
bool
sizeChanged
:
false
property
int
newStart
:
-
1
property
int
diff
:
-
1
property
double
delta
:
-
1
acceptedButtons
:
Qt
.
LeftButton
cursorShape
:
Qt
.
SizeHorCursor
drag.target
:
leftstart
drag.axis
:
Drag
.
XAxis
// drag.smoothed: false
onPressed
:
{
console
.
log
(
'
IT IS PRESSED
'
)
root
.
autoScrolling
=
false
//rightend.anchors.right = undefined
oldStartX
=
mouseX
oldStartFrame
=
subtitleBase
.
x
console
.
log
(
oldStartFrame
)
console
.
log
(
subtitleBase
.
x
)
}
onPositionChanged
:
{
if
(
pressed
)
{
//console.log('POSITION CHANGED')
newStart
=
Math
.
round
((
subtitleBase
.
x
+
(
mouseX
-
oldStartX
))
/
timeScale
)
//diff = (mouseX - oldStartX) / timeScale
if
(
mouseX
!=
oldStartX
)
{
sizeChanged
=
true
diff
=
(
mouseX
-
oldStartX
)
/
timeScale
subtitleBase
.
x
=
subtitleBase
.
x
+
diff
console
.
log
(
"
oldStartFrame
"
,
oldStartFrame
/
timeline
.
scaleFactor
,
"
subtitleBase
"
,
subtitleBase
.
x
/
timeline
.
scaleFactor
)
console
.
log
(
"
duration:
"
,
duration
)
delta
=
subtitleBase
.
x
/
timeline
.
scaleFactor
-
oldStartFrame
/
timeline
.
scaleFactor
console
.
log
(
"
Diff:
"
,
diff
,
"
Delta:
"
,
delta
)
console
.
log
(
"
new duration =
"
,
subtitleBase
.
width
/
timeScale
-
delta
)
//timeline.moveSubtitle(oldStartX/ timeScale, subtitleBase.x/timeline.scaleFactor)
}
}
}
onReleased
:
{
console
.
log
(
'
its RELEASED
'
)
root
.
autoScrolling
=
timeline
.
autoScroll
//rightend.anchors.right = subtitleBase.right
if
(
mouseX
!=
oldStartX
&&
oldStartFrame
!=
subtitleBase
.
x
)
{
console
.
log
(
"
subtitleBase.x::
"
,
subtitleBase
.
x
/
timeline
.
scaleFactor
,
"
:
"
,
subtitleBase
.
x
/
timeline
.
scaleFactor
+
delta
)
console
.
log
(
"
old start frame
"
,
oldStartFrame
/
timeline
.
scaleFactor
,
"
new frame
"
,
oldStartFrame
/
timeline
.
scaleFactor
+
delta
)
timeline
.
moveSubtitle
(
oldStartFrame
/
timeline
.
scaleFactor
,
oldStartFrame
/
timeline
.
scaleFactor
+
delta
)
}
}
}
}
Rectangle
{
// end position resize handle
id
:
rightend
width
:
4
height
:
subtitleBase
.
height
x
:
model
.
endframe
*
timeScale
;
anchors.right
:
subtitleBase
.
right
anchors.top
:
subtitleBase
.
top
color
:
'
blue
'
// to distinguish the resize handle
//Drag.active: endMouseArea.drag.active
//Drag.proposedAction: Qt.MoveAction
visible
:
true
MouseArea
{
id
:
endMouseArea
anchors.fill
:
parent
height
:
parent
.
height
width
:
4
height
:
subtitleBase
.
height
x
:
model
.
endframe
*
timeScale
;
anchors.right
:
subtitleBase
.
right
anchors.top
:
subtitleBase
.
top
color
:
'
blue
'
// to distinguish the resize handle
//Drag.active: endMouseArea.drag.active
//Drag.proposedAction: Qt.MoveAction
visible
:
true
MouseArea
{
id
:
endMouseArea
anchors.fill
:
parent
height
:
parent
.
height
width
:
4
hoverEnabled
:
true
enabled
:
true
property
bool
sizeChanged
:
false
property
int
newEnd
:
-
1
property
int
oldMouseX
acceptedButtons
:
Qt
.
LeftButton
cursorShape
:
Qt
.
SizeHorCursor
drag.target
:
rightend
drag.axis
:
Drag
.
XAxis
drag.smoothed
:
false
hoverEnabled
:
true
enabled
:
true
property
bool
sizeChanged
:
false
property
int
newEnd
:
-
1
property
int
oldMouseX
acceptedButtons
:
Qt
.
LeftButton
cursorShape
:
Qt
.
SizeHorCursor
drag.target
:
rightend
drag.axis
:
Drag
.
XAxis
drag.smoothed
:
false
onPressed
:
{
root
.
autoScrolling
=
false
//rightend.anchors.right = undefined
oldMouseX
=
mouseX
onPressed
:
{
root
.
autoScrolling
=
false
//rightend.anchors.right = undefined
oldMouseX
=
mouseX
}
onPositionChanged
:
{
if
(
pressed
)
{
newEnd
=
Math
.
round
((
mouseX
+
width
)
/
timeScale
)
if
(
mouseX
!=
oldMouseX
)
{
sizeChanged
=
true
duration
=
subtitleBase
.
width
+
(
mouseX
-
oldMouseX
)
/
timeScale
}
}
onPositionChanged
:
{
if
(
pressed
)
{
newEnd
=
Math
.
round
((
mouseX
+
width
)
/
timeScale
)
if
(
mouseX
!=
oldMouseX
)
{
sizeChanged
=
true
//duration = subtitleBase.width + (mouseX - oldMouseX)/ timeline.scaleFactor
duration
=
(
subtitleBase
.
width
/
timeScale
+
(
mouseX
-
oldMouseX
)
/
timeScale
)
}
}
onReleased
:
{
root
.
autoScrolling
=
timeline
.
autoScroll
rightend
.
anchors
.
right
=
subtitleBase
.
right
if
(
mouseX
!=
oldMouseX
||
sizeChanged
)
{
timeline
.
editSubtitle
(
subtitleBase
.
x
/
timeline
.
scaleFactor
,
subtitleEdit
.
displayText
,
newEnd
)
}
}
onReleased
:
{
root
.
autoScrolling
=
timeline
.
autoScroll
rightend
.
anchors
.
right
=
subtitleBase
.
right
if
(
mouseX
!=
oldMouseX
||
sizeChanged
)
{
timeline
.
editSubtitle
(
subtitleBase
.
x
/
timeline
.
scaleFactor
,
subtitleEdit
.
displayText
,
newEnd
)
sizeChanged
=
false
}
}
}
...
...
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