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
772823ac
Commit
772823ac
authored
Jul 28, 2020
by
Sashmita Raghav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to edit end timings of each subtitle
parent
4c318e7c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
0 deletions
+29
-0
src/bin/model/subtitlemodel.cpp
src/bin/model/subtitlemodel.cpp
+10
-0
src/bin/model/subtitlemodel.hpp
src/bin/model/subtitlemodel.hpp
+7
-0
src/timeline2/view/timelinecontroller.cpp
src/timeline2/view/timelinecontroller.cpp
+10
-0
src/timeline2/view/timelinecontroller.h
src/timeline2/view/timelinecontroller.h
+2
-0
No files found.
src/bin/model/subtitlemodel.cpp
View file @
772823ac
...
...
@@ -299,3 +299,13 @@ void SubtitleModel::addSnapPoint(GenTime startpos)
// Update the list of snapModel known to be valid
std
::
swap
(
m_regSnaps
,
validSnapModels
);
}
void
SubtitleModel
::
editEndPos
(
GenTime
startPos
,
GenTime
oldEndPos
,
GenTime
newEndPos
)
{
auto
model
=
getModel
();
if
(
oldEndPos
==
newEndPos
)
return
;
int
row
=
static_cast
<
int
>
(
std
::
distance
(
model
->
m_subtitleList
.
begin
(),
model
->
m_subtitleList
.
find
(
startPos
)));
model
->
m_subtitleList
[
startPos
].
second
=
newEndPos
;
emit
model
->
dataChanged
(
model
->
index
(
row
),
model
->
index
(
row
),
QVector
<
int
>
()
<<
EndPosRole
);
return
;
}
src/bin/model/subtitlemodel.hpp
View file @
772823ac
...
...
@@ -44,6 +44,13 @@ public:
/** @brief Registers a snap model to the subtitle model */
void
registerSnap
(
const
std
::
weak_ptr
<
SnapInterface
>
&
snapModel
);
/** @brief Edit subtitle end timing
@param startPos is start timing position of subtitles
@param oldPos is the old position of the end time
@param pos defines the new position of the end time
*/
void
editEndPos
(
GenTime
startPos
,
GenTime
oldEndPos
,
GenTime
newEndPos
);
public
slots
:
/** @brief Function that parses through a subtitle file */
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
772823ac
...
...
@@ -25,6 +25,7 @@
#include "bin/bin.h"
#include "bin/clipcreator.hpp"
#include "bin/model/markerlistmodel.hpp"
#include "bin/model/subtitlemodel.hpp"
#include "bin/projectclip.h"
#include "bin/projectfolder.h"
#include "bin/projectitemmodel.h"
...
...
@@ -3663,3 +3664,12 @@ void TimelineController::addTracks(int videoTracks, int audioTracks)
undo
();
}
}
void
TimelineController
::
editSubtitles
(
int
startFrame
,
int
oldEndFrame
,
int
newEndFrame
)
{
auto
subtitleModel
=
pCore
->
projectManager
()
->
current
()
->
getSubtitleModel
();
GenTime
startPos
(
startFrame
,
pCore
->
getCurrentFps
());
GenTime
endpos
(
oldEndFrame
,
pCore
->
getCurrentFps
());
GenTime
newendPos
(
newEndFrame
,
pCore
->
getCurrentFps
());
subtitleModel
->
editEndPos
(
startPos
,
endpos
,
newendPos
);
}
src/timeline2/view/timelinecontroller.h
View file @
772823ac
...
...
@@ -556,6 +556,8 @@ public:
void
addTracks
(
int
videoTracks
,
int
audioTracks
);
/** @brief Get in/out of currently selected items */
QPoint
selectionInOut
()
const
;
/** @brief Edit the subtitle end timings */
void
editSubtitles
(
int
startFrame
,
int
oldEndFrame
,
int
newEndFrame
);
public
slots
:
void
resetView
();
...
...
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