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
05dea895
Commit
05dea895
authored
Nov 06, 2020
by
Jean-Baptiste Mardelle
Browse files
refresh monitor on subtitle change
fix mouse wheel over subtitle track
parent
20e6804a
Pipeline
#39780
canceled with stage
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/core.cpp
View file @
05dea895
...
...
@@ -394,7 +394,7 @@ void Core::requestMonitorRefresh()
m_monitorManager
->
refreshProjectMonitor
();
}
void
Core
::
refreshProjectRange
(
Q
Size
range
)
void
Core
::
refreshProjectRange
(
Q
Pair
<
int
,
int
>
range
)
{
if
(
!
m_guiConstructed
)
return
;
m_monitorManager
->
refreshProjectRange
(
range
);
...
...
@@ -682,10 +682,10 @@ std::shared_ptr<ProjectItemModel> Core::projectItemModel()
return
m_projectItemModel
;
}
void
Core
::
invalidateRange
(
Q
Size
range
)
void
Core
::
invalidateRange
(
Q
Pair
<
int
,
int
>
range
)
{
if
(
!
m_guiConstructed
||
m_mainWindow
->
getCurrentTimeline
()
->
loading
)
return
;
m_mainWindow
->
getCurrentTimeline
()
->
controller
()
->
invalidateZone
(
range
.
width
()
,
range
.
height
()
);
m_mainWindow
->
getCurrentTimeline
()
->
controller
()
->
invalidateZone
(
range
.
first
,
range
.
second
);
}
void
Core
::
invalidateItem
(
ObjectId
itemId
)
...
...
src/core.h
View file @
05dea895
...
...
@@ -142,7 +142,7 @@ public:
/** @brief Request project monitor refresh */
void
requestMonitorRefresh
();
/** @brief Request project monitor refresh if current position is inside range*/
void
refreshProjectRange
(
Q
Size
range
);
void
refreshProjectRange
(
Q
Pair
<
int
,
int
>
range
);
/** @brief Request project monitor refresh if referenced item is under cursor */
void
refreshProjectItem
(
const
ObjectId
&
id
);
/** @brief Returns a reference to a monitor (clip or project monitor) */
...
...
@@ -179,7 +179,7 @@ public:
double
getClipSpeed
(
int
id
)
const
;
/** @brief Mark an item as invalid for timeline preview */
void
invalidateItem
(
ObjectId
itemId
);
void
invalidateRange
(
Q
Size
range
);
void
invalidateRange
(
Q
Pair
<
int
,
int
>
range
);
void
prepareShutdown
();
/** the keyframe model changed (effect added, deleted, active effect changed), inform timeline */
void
updateItemKeyframes
(
ObjectId
id
);
...
...
src/effects/effectstack/model/effectstackmodel.cpp
View file @
05dea895
...
...
@@ -676,7 +676,7 @@ bool EffectStackModel::adjustFadeLength(int duration, bool fromStart, bool audio
pCore
->
updateItemModel
(
m_ownerId
,
QStringLiteral
(
"fadein"
));
if
(
videoFade
)
{
int
min
=
pCore
->
getItemPosition
(
m_ownerId
);
Q
Size
range
(
min
,
min
+
qMax
(
duration
,
oldDuration
)
)
;
Q
Pair
<
int
,
int
>
range
=
{
min
,
min
+
qMax
(
duration
,
oldDuration
)
}
;
pCore
->
refreshProjectRange
(
range
);
if
(
logUndo
)
{
pCore
->
invalidateRange
(
range
);
...
...
@@ -719,7 +719,7 @@ bool EffectStackModel::adjustFadeLength(int duration, bool fromStart, bool audio
pCore
->
updateItemModel
(
m_ownerId
,
QStringLiteral
(
"fadeout"
));
if
(
videoFade
)
{
int
min
=
pCore
->
getItemPosition
(
m_ownerId
);
Q
Size
range
(
min
+
itemDuration
-
qMax
(
duration
,
oldDuration
),
min
+
itemDuration
)
;
Q
Pair
<
int
,
int
>
range
=
{
min
+
itemDuration
-
qMax
(
duration
,
oldDuration
),
min
+
itemDuration
}
;
pCore
->
refreshProjectRange
(
range
);
if
(
logUndo
)
{
pCore
->
invalidateRange
(
range
);
...
...
src/mainwindow.cpp
View file @
05dea895
...
...
@@ -3993,10 +3993,6 @@ void MainWindow::slotManageCache()
auto
*
lay
=
new
QVBoxLayout
;
TemporaryData
tmp
(
pCore
->
currentDoc
(),
false
,
this
);
connect
(
&
tmp
,
&
TemporaryData
::
disableProxies
,
this
,
&
MainWindow
::
slotDisableProxies
);
// TODO refac
/*
connect(&tmp, SIGNAL(disablePreview()), pCore->projectManager()->currentTimeline(), SLOT(invalidateRange()));
*/
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Close
);
connect
(
buttonBox
,
&
QDialogButtonBox
::
rejected
,
&
d
,
&
QDialog
::
reject
);
lay
->
addWidget
(
&
tmp
);
...
...
src/monitor/monitormanager.cpp
View file @
05dea895
...
...
@@ -104,9 +104,9 @@ void MonitorManager::focusProjectMonitor()
activateMonitor
(
Kdenlive
::
ProjectMonitor
);
}
void
MonitorManager
::
refreshProjectRange
(
Q
Size
range
)
void
MonitorManager
::
refreshProjectRange
(
Q
Pair
<
int
,
int
>
range
)
{
if
(
m_projectMonitor
->
position
()
>=
range
.
width
()
&&
m_projectMonitor
->
position
()
<=
range
.
height
()
)
{
if
(
m_projectMonitor
->
position
()
>=
range
.
first
&&
m_projectMonitor
->
position
()
<=
range
.
second
)
{
m_projectMonitor
->
refreshMonitorIfActive
();
}
}
...
...
src/monitor/monitormanager.h
View file @
05dea895
...
...
@@ -97,7 +97,7 @@ public slots:
void
focusProjectMonitor
();
void
refreshProjectMonitor
();
/** @brief Refresh project monitor if the timeline cursor is inside the range. */
void
refreshProjectRange
(
Q
Size
range
);
void
refreshProjectRange
(
Q
Pair
<
int
,
int
>
range
);
void
refreshClipMonitor
();
/** @brief Switch current monitor to fullscreen. */
...
...
src/timeline2/view/qml/SubTitle.qml
View file @
05dea895
...
...
@@ -186,7 +186,7 @@ Item {
//rightend.anchors.right = subtitleBase.right
if
(
mouseX
!=
oldStartX
&&
oldStartFrame
!=
subtitleBase
.
x
)
{
console
.
log
(
"
old start frame
"
,
oldStartFrame
/
timeline
.
scaleFactor
,
"
new frame
"
,
oldStartFrame
/
timeline
.
scaleFactor
+
delta
)
timeline
.
moveSubtitle
(
oldStartFrame
/
timeline
.
scaleFactor
,
oldStartFrame
/
timeline
.
scaleFactor
+
delta
)
timeline
.
moveSubtitle
(
oldStartFrame
/
timeline
.
scaleFactor
,
oldStartFrame
/
timeline
.
scaleFactor
+
delta
,
subtitleBase
.
duration
)
}
}
}
...
...
src/timeline2/view/qml/timeline.qml
View file @
05dea895
...
...
@@ -1076,6 +1076,12 @@ Rectangle {
width
:
tracksContainerArea
.
width
height
:
showSubtitles
?
root
.
baseUnit
*
3
:
0
Repeater
{
id
:
subtitlesRepeater
;
model
:
subtitleDelegateModel
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
NoButton
onWheel
:
zoomByWheel
(
wheel
)
cursorShape
:
dragProxyArea
.
drag
.
active
?
Qt
.
ClosedHandCursor
:
tracksArea
.
cursorShape
}
}
Item
{
id
:
tracksContainerArea
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
05dea895
...
...
@@ -3728,16 +3728,20 @@ void TimelineController::editSubtitle(int startFrame, QString text, int endFrame
GenTime
startPos
(
startFrame
,
pCore
->
getCurrentFps
());
GenTime
endPos
(
endFrame
,
pCore
->
getCurrentFps
());
subtitleModel
->
editSubtitle
(
startPos
,
text
,
endPos
);
pCore
->
refreshProjectRange
({
startFrame
,
endFrame
});
return
;
}
void
TimelineController
::
moveSubtitle
(
int
oldStartFrame
,
int
newStartFrame
)
void
TimelineController
::
moveSubtitle
(
int
oldStartFrame
,
int
newStartFrame
,
int
duration
)
{
qDebug
()
<<
"Moving existing subtitle start position in controller from"
<<
oldStartFrame
<<
" to "
<<
newStartFrame
;
auto
subtitleModel
=
pCore
->
projectManager
()
->
current
()
->
getSubtitleModel
();
GenTime
oldStartPos
(
oldStartFrame
,
pCore
->
getCurrentFps
());
GenTime
newStartPos
(
newStartFrame
,
pCore
->
getCurrentFps
());
subtitleModel
->
moveSubtitle
(
oldStartPos
,
newStartPos
);
int
min
=
qMin
(
oldStartFrame
,
newStartFrame
);
int
max
=
qMax
(
oldStartFrame
,
newStartFrame
);
pCore
->
refreshProjectRange
({
min
,
max
+
duration
});
return
;
}
...
...
@@ -3752,6 +3756,7 @@ void TimelineController::shiftSubtitle(int oldStartFrame, int newStartFrame, int
subtitleModel
->
removeSubtitle
(
oldStartPos
);
//first delete subtitle at old start position
subtitleModel
->
addSubtitle
(
newStartPos
,
endPos
,
text
);
//next, add a new subtitle at new start position
pCore
->
refreshProjectRange
({
qMin
(
oldStartFrame
,
newStartFrame
),
endFrame
});
}
void
TimelineController
::
addSubtitle
()
...
...
@@ -3764,6 +3769,7 @@ void TimelineController::addSubtitle()
auto
subtitleModel
=
pCore
->
projectManager
()
->
current
()
->
getSubtitleModel
();
QString
text
=
"Add Text"
;
subtitleModel
->
addSubtitle
(
start
,
end
,
text
);
pCore
->
refreshProjectRange
({
startframe
,
endframe
});
}
void
TimelineController
::
deleteSubtitle
(
int
frame
)
...
...
src/timeline2/view/timelinecontroller.h
View file @
05dea895
...
...
@@ -569,7 +569,7 @@ public:
/** @brief Edit the subtitle text and/or end timings */
Q_INVOKABLE
void
editSubtitle
(
int
startFrame
,
QString
text
,
int
endFrame
);
/** @brief Move position of subtitle start timing */
Q_INVOKABLE
void
moveSubtitle
(
int
oldStartFrame
,
int
newStartFrame
);
Q_INVOKABLE
void
moveSubtitle
(
int
oldStartFrame
,
int
newStartFrame
,
int
duration
);
/** @brief Shift subtitle clips without changing the clip duration */
Q_INVOKABLE
void
shiftSubtitle
(
int
oldStartFrame
,
int
newStartFrame
,
int
endFrame
=
0
,
QString
text
=
""
);
/** @brief Add subtitle clip at cursor's position in timeline */
...
...
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