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
8e417866
Commit
8e417866
authored
Feb 04, 2021
by
Jean-Baptiste Mardelle
Browse files
FIx possible crash on subtitle resize, and allow cutting unselected subtitle.
Related to
#936
parent
5c139698
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/model/subtitlemodel.cpp
View file @
8e417866
...
...
@@ -485,19 +485,26 @@ std::unordered_set<int> SubtitleModel::getItemsInRange(int startFrame, int endFr
continue
;
}
if
(
subtitles
.
first
>=
startTime
||
subtitles
.
second
.
second
>=
startTime
)
{
matching
.
emplace
(
getIdForStartPos
(
subtitles
.
first
));
int
sid
=
getIdForStartPos
(
subtitles
.
first
);
if
(
sid
>
-
1
)
{
matching
.
emplace
(
sid
);
}
else
{
qDebug
()
<<
"==== FOUND INVALID SUBTILE AT: "
<<
subtitles
.
first
.
frames
(
pCore
->
getCurrentFps
());
}
}
}
return
matching
;
}
void
SubtitleModel
::
cutSubtitle
(
int
position
)
bool
SubtitleModel
::
cutSubtitle
(
int
position
)
{
Fun
redo
=
[]()
{
return
true
;
};
Fun
undo
=
[]()
{
return
true
;
};
if
(
cutSubtitle
(
position
,
undo
,
redo
))
{
pCore
->
pushUndo
(
undo
,
redo
,
i18n
(
"Cut clip"
));
return
true
;
}
return
false
;
}
...
...
src/bin/model/subtitlemodel.hpp
View file @
8e417866
...
...
@@ -122,7 +122,7 @@ public:
void
setSelected
(
int
id
,
bool
select
);
bool
isSelected
(
int
id
)
const
;
/** @brief Cut a subtitle */
void
cutSubtitle
(
int
position
);
bool
cutSubtitle
(
int
position
);
bool
cutSubtitle
(
int
position
,
Fun
&
undo
,
Fun
&
redo
);
QString
getText
(
int
id
)
const
;
int
getRowForId
(
int
id
)
const
;
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
8e417866
...
...
@@ -1519,6 +1519,10 @@ void TimelineController::cutClipUnderCursor(int position, int track)
if
(
cid
>=
0
&&
TimelineFunctions
::
requestClipCut
(
m_model
,
cid
,
position
))
{
foundClip
=
true
;
}
}
else
if
(
track
==
-
2
)
{
// Subtitle cut
auto
subtitleModel
=
pCore
->
getSubtitleModel
();
foundClip
=
subtitleModel
->
cutSubtitle
(
position
);
}
}
if
(
!
foundClip
)
{
...
...
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