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
17a9ef37
Commit
17a9ef37
authored
Oct 14, 2020
by
Sashmita Raghav
Browse files
Add function to enable subtitle clips' movement in subtitle track
parent
27b5e631
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/timelinecontroller.cpp
View file @
17a9ef37
...
...
@@ -3672,13 +3672,28 @@ void TimelineController::editSubtitle(int startFrame, QString text, int endFrame
GenTime
startPos
(
startFrame
,
pCore
->
getCurrentFps
());
GenTime
endPos
(
endFrame
,
pCore
->
getCurrentFps
());
subtitleModel
->
editSubtitle
(
startPos
,
text
,
endPos
);
return
;
}
void
TimelineController
::
moveSubtitle
(
int
oldStartFrame
,
int
newStartFrame
)
{
qDebug
()
<<
"Moving existing subtitle in controller from"
<<
oldStartFrame
<<
" to "
<<
newStartFrame
;
qDebug
()
<<
"Moving existing subtitle
start position
in controller from"
<<
oldStartFrame
<<
" to "
<<
newStartFrame
;
auto
subtitleModel
=
pCore
->
projectManager
()
->
current
()
->
getSubtitleModel
();
GenTime
oldStartPos
(
oldStartFrame
,
pCore
->
getCurrentFps
());
GenTime
newStartPos
(
newStartFrame
,
pCore
->
getCurrentFps
());
subtitleModel
->
moveSubtitle
(
oldStartPos
,
newStartPos
);
return
;
}
void
TimelineController
::
shiftSubtitle
(
int
oldStartFrame
,
int
newStartFrame
,
int
endFrame
,
QString
text
)
{
qDebug
()
<<
"Shifting existing subtitle in controller from"
<<
oldStartFrame
<<
" to "
<<
newStartFrame
;
auto
subtitleModel
=
pCore
->
projectManager
()
->
current
()
->
getSubtitleModel
();
GenTime
oldStartPos
(
oldStartFrame
,
pCore
->
getCurrentFps
());
GenTime
newStartPos
(
newStartFrame
,
pCore
->
getCurrentFps
());
GenTime
endPos
(
endFrame
,
pCore
->
getCurrentFps
());
subtitleModel
->
removeSubtitle
(
oldStartPos
);
//first delete subtitle at old start position
subtitleModel
->
addSubtitle
(
newStartPos
,
endPos
,
text
);
//next, add a new subtitle at new start position
}
src/timeline2/view/timelinecontroller.h
View file @
17a9ef37
...
...
@@ -558,8 +558,10 @@ public:
QPoint
selectionInOut
()
const
;
/** @brief Edit the subtitle text and/or end timings */
Q_INVOKABLE
void
editSubtitle
(
int
startFrame
,
QString
text
,
int
endFrame
);
/** @brief Move position of subtitle */
/** @brief Move position of subtitle
start timing
*/
Q_INVOKABLE
void
moveSubtitle
(
int
oldStartFrame
,
int
newStartFrame
);
/** @brief Shift subtitle clips without changing the clip duration */
Q_INVOKABLE
void
shiftSubtitle
(
int
oldStartFrame
,
int
newStartFrame
,
int
endFrame
=
0
,
QString
text
=
""
);
public
slots
:
void
resetView
();
...
...
Write
Preview
Supports
Markdown
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