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
f265f7bb
Commit
f265f7bb
authored
Dec 22, 2020
by
Jean-Baptiste Mardelle
Browse files
Don't snap on subtitles when track is hidden
parent
daf52f0c
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/kdenlivesettings.kcfg
View file @
f265f7bb
...
...
@@ -916,6 +916,10 @@
<default>
#000000
</default>
</entry>
<entry
name=
"showSubtitles"
type=
"Bool"
>
<label>
Show subtitle track.
</label>
<default>
false
</default>
</entry>
<entry
name=
"thumbColor1"
type=
"Color"
>
<label>
Color to draw even audio channels.
</label>
...
...
src/mainwindow.cpp
View file @
f265f7bb
...
...
@@ -4208,7 +4208,7 @@ void MainWindow::resetSubtitles()
{
// Hide subtitle track
m_buttonSubtitleEditTool
->
setChecked
(
false
);
getMainTimeline
()
->
s
howSubtitles
=
false
;
KdenliveSettings
::
setS
howSubtitles
(
false
)
;
pCore
->
subtitleWidget
()
->
setModel
(
nullptr
);
if
(
pCore
->
currentDoc
())
{
const
QString
workPath
=
pCore
->
currentDoc
()
->
subTitlePath
(
false
);
...
...
@@ -4241,18 +4241,18 @@ void MainWindow::slotEditSubtitle(QMap<QString, QString> subProperties)
getMainTimeline
()
->
controller
()
->
subtitlesLockedChanged
();
getMainTimeline
()
->
controller
()
->
subtitlesDisabledChanged
();
}
getMainTimeline
()
->
s
howSubtitles
=
true
;
KdenliveSettings
::
setS
howSubtitles
(
true
)
;
m_buttonSubtitleEditTool
->
setChecked
(
true
);
getMainTimeline
()
->
connectSubtitleModel
(
true
);
}
else
{
getMainTimeline
()
->
s
howSubtitles
=
m_buttonSubtitleEditTool
->
isChecked
();
KdenliveSettings
::
setS
howSubtitles
(
m_buttonSubtitleEditTool
->
isChecked
()
)
;
getMainTimeline
()
->
connectSubtitleModel
(
false
);
}
}
void
MainWindow
::
slotAddSubtitle
()
{
if
(
pCore
->
getSubtitleModel
()
==
nullptr
||
!
getMainTimeline
()
->
showSubtitles
)
{
if
(
pCore
->
getSubtitleModel
()
==
nullptr
||
!
KdenliveSettings
::
showSubtitles
()
)
{
slotEditSubtitle
();
m_buttonSubtitleEditTool
->
setChecked
(
true
);
}
...
...
@@ -4271,7 +4271,7 @@ void MainWindow::slotLockSubtitle()
void
MainWindow
::
slotImportSubtitle
()
{
if
(
pCore
->
getSubtitleModel
()
==
nullptr
||
!
getMainTimeline
()
->
showSubtitles
)
{
if
(
pCore
->
getSubtitleModel
()
==
nullptr
||
!
KdenliveSettings
::
showSubtitles
()
)
{
slotEditSubtitle
();
m_buttonSubtitleEditTool
->
setChecked
(
true
);
}
...
...
src/timeline2/model/timelinemodel.cpp
View file @
f265f7bb
...
...
@@ -3878,7 +3878,14 @@ int TimelineModel::getNextSnapPos(int pos, std::vector<int> &snaps)
++
it
;
}
bool
hasSubtitles
=
m_subtitleModel
&&
!
m_allSubtitles
.
empty
();
if
((
tracks
.
isEmpty
()
||
tracks
.
count
()
==
(
int
)
m_allTracks
.
size
())
&&
(
!
hasSubtitles
||
!
m_subtitleModel
->
isLocked
()))
{
bool
filterOutSubtitles
=
false
;
if
(
hasSubtitles
)
{
// If subtitle track is locked or hidden, don't snap to it
if
(
m_subtitleModel
->
isLocked
()
||
!
KdenliveSettings
::
showSubtitles
())
{
filterOutSubtitles
=
true
;
}
}
if
((
tracks
.
isEmpty
()
||
tracks
.
count
()
==
(
int
)
m_allTracks
.
size
())
&&
!
filterOutSubtitles
)
{
// No active track, use all possible snap points
return
m_snaps
->
getNextPoint
((
int
)
pos
);
}
...
...
@@ -3891,7 +3898,7 @@ int TimelineModel::getNextSnapPos(int pos, std::vector<int> &snaps)
}
}
// Subtitle snaps
if
(
hasSubtitles
&&
!
m_subtitleModel
->
isLocked
()
)
{
if
(
hasSubtitles
&&
!
filterOutSubtitles
)
{
// Add subtitle snaps
m_subtitleModel
->
allSnaps
(
snaps
);
}
...
...
@@ -3917,7 +3924,14 @@ int TimelineModel::getPreviousSnapPos(int pos, std::vector<int> &snaps)
++
it
;
}
bool
hasSubtitles
=
m_subtitleModel
&&
!
m_allSubtitles
.
empty
();
if
((
tracks
.
isEmpty
()
||
tracks
.
count
()
==
(
int
)
m_allTracks
.
size
())
&&
(
!
hasSubtitles
||
!
m_subtitleModel
->
isLocked
()))
{
bool
filterOutSubtitles
=
false
;
if
(
hasSubtitles
)
{
// If subtitle track is locked or hidden, don't snap to it
if
(
m_subtitleModel
->
isLocked
()
||
!
KdenliveSettings
::
showSubtitles
())
{
filterOutSubtitles
=
true
;
}
}
if
((
tracks
.
isEmpty
()
||
tracks
.
count
()
==
(
int
)
m_allTracks
.
size
())
&&
!
filterOutSubtitles
)
{
// No active track, use all possible snap points
return
m_snaps
->
getPreviousPoint
((
int
)
pos
);
}
...
...
@@ -3930,7 +3944,7 @@ int TimelineModel::getPreviousSnapPos(int pos, std::vector<int> &snaps)
}
}
// Subtitle snaps
if
(
hasSubtitles
&&
!
m_subtitleModel
->
isLocked
()
)
{
if
(
hasSubtitles
&&
!
filterOutSubtitles
)
{
// Add subtitle snaps
m_subtitleModel
->
allSnaps
(
snaps
);
}
...
...
src/timeline2/view/timelinewidget.cpp
View file @
f265f7bb
...
...
@@ -502,7 +502,7 @@ void TimelineWidget::connectSubtitleModel(bool firstConnect)
else
{
//qDebug()<<"null ptr NOT here at root context";
rootObject
()
->
setProperty
(
"showSubtitles"
,
showSubtitles
);
rootObject
()
->
setProperty
(
"showSubtitles"
,
KdenliveSettings
::
showSubtitles
()
);
if
(
firstConnect
)
{
rootContext
()
->
setContextProperty
(
"subtitleModel"
,
pCore
->
getSubtitleModel
().
get
());
}
...
...
src/timeline2/view/timelinewidget.h
View file @
f265f7bb
...
...
@@ -57,7 +57,6 @@ public:
void
setTimelineMenu
(
QMenu
*
clipMenu
,
QMenu
*
compositionMenu
,
QMenu
*
timelineMenu
,
QMenu
*
timelineRulerMenu
,
QMenu
*
guideMenu
,
QAction
*
editGuideAction
,
QMenu
*
headerMenu
,
QMenu
*
thumbsMenu
,
QMenu
*
subtitleClipMenu
);
bool
loading
;
void
connectSubtitleModel
(
bool
firstConnect
);
bool
showSubtitles
=
false
;
protected:
void
mousePressEvent
(
QMouseEvent
*
event
)
override
;
...
...
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