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
ad96891a
Commit
ad96891a
authored
Feb 05, 2021
by
Jean-Baptiste Mardelle
Browse files
Automatically highlight text for editing when adding a subtitle.
Fixes
#938
parent
6d8451b5
Pipeline
#49924
passed with stage
in 10 minutes and 36 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
ad96891a
...
...
@@ -3591,6 +3591,11 @@ void TimelineModel::registerSubtitle(int id, GenTime startTime, bool temporary)
}
}
int
TimelineModel
::
positionForIndex
(
int
id
)
{
return
std
::
distance
(
m_allSubtitles
.
begin
(),
m_allSubtitles
.
find
(
id
));
}
void
TimelineModel
::
deregisterSubtitle
(
int
id
,
bool
temporary
)
{
Q_ASSERT
(
m_allSubtitles
.
count
(
id
)
>
0
);
...
...
src/timeline2/model/timelinemodel.hpp
View file @
ad96891a
...
...
@@ -743,6 +743,9 @@ protected:
void
registerSubtitle
(
int
id
,
GenTime
startTime
,
bool
temporary
=
false
);
void
deregisterSubtitle
(
int
id
,
bool
temporary
=
false
);
/* @brief Returns the index for a subtitle's id (it's position in the list
*/
int
positionForIndex
(
int
id
);
/* @brief Register a new group. This is a call-back meant to be called from GroupsModel
*/
...
...
src/timeline2/view/qml/SubTitle.qml
View file @
ad96891a
...
...
@@ -15,6 +15,12 @@ Item {
property
bool
selected
property
bool
isGrabbed
:
false
height
:
subtitleTrack
.
height
function
editText
()
{
subtitleBase
.
textEditBegin
=
true
}
onStartFrameChanged
:
{
if
(
!
subtitleClipArea
.
pressed
)
{
subtitleClipArea
.
x
=
startFrame
*
root
.
timeScale
...
...
src/timeline2/view/qml/timeline.qml
View file @
ad96891a
...
...
@@ -60,6 +60,11 @@ Rectangle {
}
}
function
highlightSub
(
ix
)
{
var
currentSub
=
subtitlesRepeater
.
itemAt
(
ix
)
currentSub
.
editText
()
}
function
checkDeletion
(
itemId
)
{
if
(
dragProxy
.
draggedItem
==
itemId
)
{
endDrag
()
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
ad96891a
...
...
@@ -4065,6 +4065,10 @@ void TimelineController::addSubtitle(int startframe)
if
(
local_redo
())
{
m_model
->
requestAddToSelection
(
id
,
true
);
pCore
->
pushUndo
(
local_undo
,
local_redo
,
i18n
(
"Add subtitle"
));
int
index
=
m_model
->
positionForIndex
(
id
);
if
(
index
>
-
1
)
{
QMetaObject
::
invokeMethod
(
m_root
,
"highlightSub"
,
Qt
::
QueuedConnection
,
Q_ARG
(
QVariant
,
index
));
}
}
}
...
...
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