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
c661c680
Commit
c661c680
authored
Feb 19, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix subtitle selection by keyboard shortcut
parent
5026ce2b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/groupsmodel.cpp
View file @
c661c680
...
...
@@ -788,7 +788,7 @@ int GroupsModel::fromJson(const QJsonObject &o, Fun &undo, Fun &redo)
}
else
if
(
leaf
==
QLatin1String
(
"composition"
))
{
id
=
ptr
->
getCompositionByPosition
(
trackId
,
pos
);
}
else
if
(
leaf
==
QLatin1String
(
"subtitle"
))
{
id
=
ptr
->
getSubtitleByPosition
(
pos
);
id
=
ptr
->
getSubtitleBy
Start
Position
(
pos
);
}
else
{
qDebug
()
<<
" * * *UNKNOWN ITEM: "
<<
leaf
;
}
...
...
src/timeline2/model/timelinemodel.cpp
View file @
c661c680
...
...
@@ -356,7 +356,7 @@ int TimelineModel::getCompositionByPosition(int trackId, int position) const
return
getTrackById_const
(
trackId
)
->
getCompositionByPosition
(
position
);
}
int
TimelineModel
::
getSubtitleByPosition
(
int
position
)
const
int
TimelineModel
::
getSubtitleBy
Start
Position
(
int
position
)
const
{
READ_LOCK
();
GenTime
startTime
(
position
,
pCore
->
getCurrentFps
());
...
...
@@ -369,6 +369,19 @@ int TimelineModel::getSubtitleByPosition(int position) const
return
-
1
;
}
int
TimelineModel
::
getSubtitleByPosition
(
int
position
)
const
{
READ_LOCK
();
GenTime
startTime
(
position
,
pCore
->
getCurrentFps
());
if
(
m_subtitleModel
)
{
std
::
unordered_set
<
int
>
sids
=
m_subtitleModel
->
getItemsInRange
(
position
,
position
);
if
(
!
sids
.
empty
())
{
return
*
sids
.
begin
();
}
}
return
-
1
;
}
int
TimelineModel
::
getTrackPosition
(
int
trackId
)
const
{
READ_LOCK
();
...
...
src/timeline2/model/timelinemodel.hpp
View file @
c661c680
...
...
@@ -639,6 +639,9 @@ public:
/* @brief Get a timeline composition id by its starting position or -1 if not found
*/
int
getCompositionByPosition
(
int
trackId
,
int
position
)
const
;
/* @brief Get a timeline subtitle id by its starting position or -1 if not found
*/
int
getSubtitleByStartPosition
(
int
position
)
const
;
int
getSubtitleByPosition
(
int
position
)
const
;
/* @brief Returns a list of all items that are intersect with a given range.
...
...
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