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
86218927
Commit
86218927
authored
Feb 03, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix subtitle text not updated on go to next/prev and related crash.
Related to
#935
parent
d4b9ee65
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/dialogs/subtitleedit.cpp
View file @
86218927
...
...
@@ -191,9 +191,9 @@ void SubtitleEdit::setActiveSubtitle(int id)
QSignalBlocker
bk
(
subText
);
frame_position
->
setEnabled
(
true
);
buttonDelete
->
setEnabled
(
true
);
/*
QSignalBlocker bk2(m_position);
QSignalBlocker
bk2
(
m_position
);
QSignalBlocker
bk3
(
m_endPosition
);
QSignalBlocker bk4(m_duration);
*/
QSignalBlocker
bk4
(
m_duration
);
subText
->
setPlainText
(
m_model
->
getText
(
id
));
m_startPos
=
m_model
->
getStartPosForId
(
id
);
GenTime
duration
=
GenTime
(
m_model
->
getSubtitlePlaytime
(
id
),
pCore
->
getCurrentFps
());
...
...
@@ -201,7 +201,13 @@ void SubtitleEdit::setActiveSubtitle(int id)
m_position
->
setValue
(
m_startPos
);
m_endPosition
->
setValue
(
m_endPos
);
m_duration
->
setValue
(
duration
);
m_position
->
setEnabled
(
true
);
m_endPosition
->
setEnabled
(
true
);
m_duration
->
setEnabled
(
true
);
}
else
{
m_position
->
setEnabled
(
false
);
m_endPosition
->
setEnabled
(
false
);
m_duration
->
setEnabled
(
false
);
subText
->
setEnabled
(
false
);
frame_position
->
setEnabled
(
false
);
buttonDelete
->
setEnabled
(
false
);
...
...
@@ -213,7 +219,24 @@ void SubtitleEdit::setActiveSubtitle(int id)
void
SubtitleEdit
::
goToPrevious
()
{
if
(
m_model
)
{
int
id
=
m_model
->
getPreviousSub
(
m_activeSub
);
int
id
=
-
1
;
if
(
m_activeSub
>
-
1
)
{
id
=
m_model
->
getPreviousSub
(
m_activeSub
);
}
else
{
// Start from timeline cursor position
int
cursorPos
=
pCore
->
getTimelinePosition
();
std
::
unordered_set
<
int
>
sids
=
m_model
->
getItemsInRange
(
cursorPos
,
cursorPos
);
if
(
sids
.
empty
())
{
sids
=
m_model
->
getItemsInRange
(
0
,
cursorPos
);
for
(
int
s
:
sids
)
{
if
(
id
==
-
1
||
m_model
->
getSubtitleEnd
(
s
)
>
m_model
->
getSubtitleEnd
(
id
))
{
id
=
s
;
}
}
}
else
{
id
=
m_model
->
getPreviousSub
(
*
sids
.
begin
());
}
}
if
(
id
>
-
1
)
{
if
(
buttonApply
->
isEnabled
())
{
updateSubtitle
();
...
...
@@ -228,7 +251,24 @@ void SubtitleEdit::goToPrevious()
void
SubtitleEdit
::
goToNext
()
{
if
(
m_model
)
{
int
id
=
m_model
->
getNextSub
(
m_activeSub
);
int
id
=
-
1
;
if
(
m_activeSub
>
-
1
)
{
id
=
m_model
->
getNextSub
(
m_activeSub
);
}
else
{
// Start from timeline cursor position
int
cursorPos
=
pCore
->
getTimelinePosition
();
std
::
unordered_set
<
int
>
sids
=
m_model
->
getItemsInRange
(
cursorPos
,
cursorPos
);
if
(
sids
.
empty
())
{
sids
=
m_model
->
getItemsInRange
(
cursorPos
,
-
1
);
for
(
int
s
:
sids
)
{
if
(
id
==
-
1
||
m_model
->
getStartPosForId
(
s
)
<
m_model
->
getStartPosForId
(
id
))
{
id
=
s
;
}
}
}
else
{
id
=
m_model
->
getNextSub
(
*
sids
.
begin
());
}
}
if
(
id
>
-
1
)
{
if
(
buttonApply
->
isEnabled
())
{
updateSubtitle
();
...
...
src/timecodedisplay.cpp
View file @
86218927
...
...
@@ -69,7 +69,7 @@ TimecodeDisplay::TimecodeDisplay(const Timecode &t, QWidget *parent)
setSizePolicy
(
QSizePolicy
::
Fixed
,
QSizePolicy
::
Maximum
);
setAccelerated
(
true
);
connect
(
lineEdit
(),
&
QLineEdit
::
editingFinished
,
this
,
&
TimecodeDisplay
::
slotEditingFinished
);
connect
(
lineEdit
(),
&
QLineEdit
::
editingFinished
,
this
,
&
TimecodeDisplay
::
slotEditingFinished
,
Qt
::
DirectConnection
);
}
// virtual protected
...
...
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