Skip to content
GitLab
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
e1e4a9bc
Commit
e1e4a9bc
authored
Nov 04, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix move guide and filtering clip monitor markers
parent
8c45212e
Pipeline
#261039
passed with stage
in 7 minutes and 29 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/monitor/glwidget.cpp
View file @
e1e4a9bc
...
...
@@ -29,6 +29,7 @@
#include
<QQuickItem>
#include
<memory>
#include
"bin/model/markersortmodel.h"
#include
"core.h"
#include
"glwidget.h"
#include
"monitorproxy.h"
...
...
@@ -1704,7 +1705,7 @@ int GLWidget::getCurrentPos() const
return
m_proxy
->
getPosition
();
}
void
GLWidget
::
setRulerInfo
(
int
duration
,
const
std
::
shared_ptr
<
Marker
Lis
tModel
>
&
model
)
void
GLWidget
::
setRulerInfo
(
int
duration
,
const
std
::
shared_ptr
<
Marker
Sor
tModel
>
&
model
)
{
m_maxProducerPosition
=
duration
;
rootObject
()
->
setProperty
(
"duration"
,
duration
);
...
...
src/monitor/glwidget.h
View file @
e1e4a9bc
...
...
@@ -38,6 +38,7 @@ class Consumer;
class
RenderThread
;
class
FrameRenderer
;
class
MonitorProxy
;
class
MarkerSortModel
;
using
thread_function_t
=
void
*
(
*
)(
void
*
);
...
...
@@ -100,7 +101,7 @@ public:
int
getCurrentPos
()
const
;
/** @brief Requests a monitor refresh */
void
requestRefresh
();
void
setRulerInfo
(
int
duration
,
const
std
::
shared_ptr
<
Marker
Lis
tModel
>
&
model
=
nullptr
);
void
setRulerInfo
(
int
duration
,
const
std
::
shared_ptr
<
Marker
Sor
tModel
>
&
model
=
nullptr
);
MonitorProxy
*
getControllerProxy
();
bool
playZone
(
bool
loop
=
false
);
bool
loopClip
(
QPoint
inOut
);
...
...
src/monitor/monitor.cpp
View file @
e1e4a9bc
...
...
@@ -21,6 +21,7 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include
"mltcontroller/clipcontroller.h"
#include
"project/dialogs/guideslist.h"
#include
"bin/model/markersortmodel.h"
#include
"monitormanager.h"
#include
"monitorproxy.h"
#include
"profiles/profilemodel.hpp"
...
...
@@ -1440,7 +1441,7 @@ void Monitor::slotForwardOneFrame(int diff)
}
}
void
Monitor
::
adjustRulerSize
(
int
length
,
const
std
::
shared_ptr
<
Marker
Lis
tModel
>
&
markerModel
)
void
Monitor
::
adjustRulerSize
(
int
length
,
const
std
::
shared_ptr
<
Marker
Sor
tModel
>
&
markerModel
)
{
if
(
m_controller
!=
nullptr
)
{
m_glMonitor
->
setRulerInfo
(
length
);
...
...
@@ -1448,10 +1449,12 @@ void Monitor::adjustRulerSize(int length, const std::shared_ptr<MarkerListModel>
m_glMonitor
->
setRulerInfo
(
length
,
markerModel
);
}
m_timePos
->
setRange
(
0
,
length
);
if
(
markerModel
)
{
connect
(
markerModel
.
get
(),
SIGNAL
(
dataChanged
(
QModelIndex
,
QModelIndex
,
QVector
<
int
>
)),
this
,
SLOT
(
checkOverlay
()));
connect
(
markerModel
.
get
(),
SIGNAL
(
rowsInserted
(
QModelIndex
,
int
,
int
)),
this
,
SLOT
(
checkOverlay
()));
connect
(
markerModel
.
get
(),
SIGNAL
(
rowsRemoved
(
QModelIndex
,
int
,
int
)),
this
,
SLOT
(
checkOverlay
()));
QAbstractItemModel
*
sourceModel
=
markerModel
->
sourceModel
();
connect
(
sourceModel
,
SIGNAL
(
dataChanged
(
QModelIndex
,
QModelIndex
,
QVector
<
int
>
)),
this
,
SLOT
(
checkOverlay
()));
connect
(
sourceModel
,
SIGNAL
(
rowsInserted
(
QModelIndex
,
int
,
int
)),
this
,
SLOT
(
checkOverlay
()));
connect
(
sourceModel
,
SIGNAL
(
rowsRemoved
(
QModelIndex
,
int
,
int
)),
this
,
SLOT
(
checkOverlay
()));
}
else
{
// Project simply changed length, update display
emit
durationChanged
(
length
);
...
...
@@ -1776,7 +1779,7 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
}
if
(
m_controller
->
statusReady
())
{
m_timePos
->
setRange
(
0
,
int
(
m_controller
->
frameDuration
()
-
1
));
m_glMonitor
->
setRulerInfo
(
int
(
m_controller
->
frameDuration
()
-
1
),
controller
->
getMarkerModel
());
m_glMonitor
->
setRulerInfo
(
int
(
m_controller
->
frameDuration
()
-
1
),
controller
->
get
Filtered
MarkerModel
());
pCore
->
guidesList
()
->
setClipMarkerModel
(
m_controller
);
loadQmlScene
(
MonitorSceneDefault
);
updateMarkers
();
...
...
@@ -2308,7 +2311,7 @@ void Monitor::buildSplitEffect(Mlt::Producer *original)
delete
original
;
m_splitProducer
=
std
::
make_shared
<
Mlt
::
Producer
>
(
trac
.
get_producer
());
m_glMonitor
->
setProducer
(
m_splitProducer
,
isActive
(),
position
());
m_glMonitor
->
setRulerInfo
(
int
(
m_controller
->
frameDuration
()),
m_controller
->
getMarkerModel
());
m_glMonitor
->
setRulerInfo
(
int
(
m_controller
->
frameDuration
()),
m_controller
->
get
Filtered
MarkerModel
());
loadQmlScene
(
MonitorSceneSplit
);
}
...
...
src/monitor/monitor.h
View file @
e1e4a9bc
...
...
@@ -36,6 +36,7 @@ class QLabel;
class
GLWidget
;
class
MonitorAudioLevel
;
class
MonitorProxy
;
class
MarkerSortModel
;
namespace
Mlt
{
class
Profile
;
...
...
@@ -318,7 +319,7 @@ public slots:
void
slotLoadClipZone
(
const
QPoint
&
zone
);
void
slotSeekToNextSnap
();
void
slotSeekToPreviousSnap
();
void
adjustRulerSize
(
int
length
,
const
std
::
shared_ptr
<
Marker
Lis
tModel
>
&
markerModel
=
nullptr
);
void
adjustRulerSize
(
int
length
,
const
std
::
shared_ptr
<
Marker
Sor
tModel
>
&
markerModel
=
nullptr
);
void
setTimePos
(
const
QString
&
pos
);
/** @brief Display the on monitor effect scene (to adjust geometry over monitor). */
void
slotShowEffectScene
(
MonitorSceneType
sceneType
,
bool
temporary
=
false
,
const
QVariant
&
sceneData
=
QVariant
());
...
...
src/project/dialogs/guideslist.cpp
View file @
e1e4a9bc
...
...
@@ -103,6 +103,7 @@ GuidesList::GuidesList(QWidget *parent)
// Filtering
show_categories
->
enableFilterMode
();
show_categories
->
setAllowAll
(
true
);
show_categories
->
setOnlyUsed
(
true
);
connect
(
show_categories
,
&
QToolButton
::
toggled
,
this
,
&
GuidesList
::
switchFilter
);
connect
(
show_categories
,
&
MarkerCategoryButton
::
categoriesChanged
,
this
,
&
GuidesList
::
updateFilter
);
...
...
@@ -370,8 +371,12 @@ void GuidesList::switchFilter(bool enable)
void
GuidesList
::
updateFilter
(
QList
<
int
>
categories
)
{
pCore
->
currentDoc
()
->
setGuidesFilter
(
categories
);
emit
pCore
->
refreshActiveGuides
();
if
(
m_markerMode
)
{
m_clip
->
getFilteredMarkerModel
()
->
slotSetFilters
(
categories
);
}
else
{
pCore
->
currentDoc
()
->
setGuidesFilter
(
categories
);
emit
pCore
->
refreshActiveGuides
();
}
}
void
GuidesList
::
filterView
(
const
QString
&
text
)
...
...
src/project/projectmanager.cpp
View file @
e1e4a9bc
...
...
@@ -1084,7 +1084,7 @@ bool ProjectManager::updateTimeline(int pos, const QString &chunks, const QStrin
emit
pCore
->
monitorManager
()
->
updatePreviewScaling
();
pCore
->
monitorManager
()
->
projectMonitor
()
->
slotActivateMonitor
();
pCore
->
monitorManager
()
->
projectMonitor
()
->
setProducer
(
m_mainTimelineModel
->
producer
(),
pos
);
pCore
->
monitorManager
()
->
projectMonitor
()
->
adjustRulerSize
(
m_mainTimelineModel
->
duration
()
-
1
,
m_project
->
getGuideModel
());
pCore
->
monitorManager
()
->
projectMonitor
()
->
adjustRulerSize
(
m_mainTimelineModel
->
duration
()
-
1
,
m_project
->
get
Filtered
GuideModel
());
}
m_mainTimelineModel
->
setUndoStack
(
m_project
->
commandStack
());
...
...
src/timeline2/view/qml/Ruler.qml
View file @
e1e4a9bc
...
...
@@ -154,26 +154,35 @@ Item {
cursorShape
:
Qt
.
PointingHandCursor
hoverEnabled
:
true
property
int
prevFrame
property
int
destFrame
property
int
movingMarkerId
property
int
xOffset
:
0
drag.axis
:
Drag
.
XAxis
onPressed
:
{
prevFrame
=
model
.
frame
destFrame
=
prevFrame
xOffset
=
mouseX
anchors
.
left
=
undefined
movingMarkerId
=
markerBase
.
markerId
}
onReleased
:
{
if
(
prevFrame
!=
model
.
frame
)
{
var
newFrame
=
model
.
frame
timeline
.
moveGuideWithoutUndo
(
markerBase
.
markerId
,
prevFrame
)
timeline
.
moveGuide
(
prevFrame
,
newFrame
)
if
(
prevFrame
!=
destFrame
)
{
timeline
.
moveGuideWithoutUndo
(
movingMarkerId
,
prevFrame
)
timeline
.
moveGuideById
(
movingMarkerId
,
destFrame
)
}
movingMarkerId
=
-
1
anchors
.
left
=
parent
.
left
}
onPositionChanged
:
{
if
(
pressed
)
{
var
newFrame
=
Math
.
round
(
model
.
frame
+
(
mouseX
-
xOffset
)
/
timeline
.
scaleFactor
)
newFrame
=
controller
.
suggestSnapPoint
(
newFrame
,
mouse
.
modifiers
&
Qt
.
ShiftModifier
?
-
1
:
root
.
snapping
)
timeline
.
moveGuideWithoutUndo
(
markerBase
.
markerId
,
newFrame
)
if
(
newFrame
!=
destFrame
)
{
var
frame
=
timeline
.
moveGuideWithoutUndo
(
movingMarkerId
,
newFrame
)
if
(
frame
>
-
1
)
{
destFrame
=
frame
}
}
}
}
drag.smoothed
:
false
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
e1e4a9bc
...
...
@@ -876,11 +876,17 @@ void TimelineController::gotoPreviousSnap()
void
TimelineController
::
gotoNextGuide
()
{
QList
<
CommentedTime
>
guides
=
pCore
->
currentDoc
()
->
getGuideModel
()
->
getAllMarkers
();
std
::
vector
<
int
>
canceled
=
pCore
->
currentDoc
()
->
getFilteredGuideModel
()
->
getIgnoredSnapPoints
();
int
pos
=
pCore
->
getMonitorPosition
();
double
fps
=
pCore
->
getCurrentFps
();
int
guidePos
=
0
;
for
(
auto
&
guide
:
guides
)
{
if
(
guide
.
time
().
frames
(
fps
)
>
pos
)
{
setPosition
(
guide
.
time
().
frames
(
fps
));
guidePos
=
guide
.
time
().
frames
(
fps
);
if
(
std
::
find
(
canceled
.
begin
(),
canceled
.
end
(),
guidePos
)
!=
canceled
.
end
())
{
continue
;
}
if
(
guidePos
>
pos
)
{
setPosition
(
guidePos
);
return
;
}
}
...
...
@@ -891,15 +897,21 @@ void TimelineController::gotoPreviousGuide()
{
if
(
pCore
->
getMonitorPosition
()
>
0
)
{
QList
<
CommentedTime
>
guides
=
pCore
->
currentDoc
()
->
getGuideModel
()
->
getAllMarkers
();
std
::
vector
<
int
>
canceled
=
pCore
->
currentDoc
()
->
getFilteredGuideModel
()
->
getIgnoredSnapPoints
();
int
pos
=
pCore
->
getMonitorPosition
();
double
fps
=
pCore
->
getCurrentFps
();
int
lastGuidePos
=
0
;
int
guidePos
=
0
;
for
(
auto
&
guide
:
guides
)
{
if
(
guide
.
time
().
frames
(
fps
)
>=
pos
)
{
guidePos
=
guide
.
time
().
frames
(
fps
);
if
(
std
::
find
(
canceled
.
begin
(),
canceled
.
end
(),
guidePos
)
!=
canceled
.
end
())
{
continue
;
}
if
(
guidePos
>=
pos
)
{
setPosition
(
lastGuidePos
);
return
;
}
lastGuidePos
=
guide
.
time
().
frames
(
fps
)
;
lastGuidePos
=
guide
Pos
;
}
setPosition
(
lastGuidePos
);
}
...
...
@@ -1257,25 +1269,28 @@ void TimelineController::editGuide(int frame)
guideModel
->
editMarkerGui
(
pos
,
qApp
->
activeWindow
(),
false
);
}
void
TimelineController
::
moveGuide
(
int
frame
,
int
newFrame
)
void
TimelineController
::
moveGuide
ById
(
int
id
,
int
newFrame
)
{
if
(
newFrame
<
0
)
{
return
;
}
auto
guideModel
=
pCore
->
currentDoc
()
->
getGuideModel
();
GenTime
pos
(
frame
,
pCore
->
getCurrentFps
());
GenTime
newPos
(
newFrame
,
pCore
->
getCurrentFps
());
guideModel
->
editMarker
(
pos
,
newPos
);
GenTime
oldPos
=
guideModel
->
markerById
(
id
).
time
();
guideModel
->
editMarker
(
oldPos
,
newPos
);
}
void
TimelineController
::
moveGuideWithoutUndo
(
int
mid
,
int
newFrame
)
int
TimelineController
::
moveGuideWithoutUndo
(
int
mid
,
int
newFrame
)
{
if
(
newFrame
<
0
)
{
return
;
return
-
1
;
}
auto
guideModel
=
pCore
->
currentDoc
()
->
getGuideModel
();
GenTime
newPos
(
newFrame
,
pCore
->
getCurrentFps
());
guideModel
->
moveMarker
(
mid
,
newPos
);
if
(
guideModel
->
moveMarker
(
mid
,
newPos
))
{
return
newFrame
;
}
return
-
1
;
}
bool
TimelineController
::
moveGuidesInRange
(
int
start
,
int
end
,
int
offset
)
...
...
src/timeline2/view/timelinecontroller.h
View file @
e1e4a9bc
...
...
@@ -307,8 +307,8 @@ public:
/** @brief Ask for edit timeline guide dialog
*/
Q_INVOKABLE
void
editGuide
(
int
frame
=
-
1
);
Q_INVOKABLE
void
moveGuide
(
int
frame
,
int
newFrame
);
Q_INVOKABLE
void
moveGuideWithoutUndo
(
int
frame
,
int
newFrame
);
Q_INVOKABLE
void
moveGuide
ById
(
int
id
,
int
newFrame
);
Q_INVOKABLE
int
moveGuideWithoutUndo
(
int
mid
,
int
newFrame
);
/** @brief Move all guides in the given range
* @param start the start point of the range in frames
* @param end the end point of the range in frames
...
...
src/widgets/markercategorybutton.cpp
View file @
e1e4a9bc
...
...
@@ -124,7 +124,7 @@ void MarkerCategoryButton::refresh()
ac
->
setChecked
(
selected
.
contains
(
i
.
key
()));
m_menu
->
addAction
(
ac
);
}
if
(
m_menu
->
actions
().
count
()
==
0
)
{
if
(
m_menu
->
actions
().
count
()
==
0
&&
!
m_allowAll
)
{
setEnabled
(
false
);
setText
(
i18n
(
"Nothing to select"
));
return
;
...
...
@@ -134,7 +134,11 @@ void MarkerCategoryButton::refresh()
QAction
*
ac
=
new
QAction
(
i18n
(
"All Categories"
),
m_menu
);
ac
->
setData
(
-
1
);
ac
->
setCheckable
(
true
);
m_menu
->
insertAction
(
m_menu
->
actions
().
first
(),
ac
);
if
(
m_menu
->
actions
().
isEmpty
())
{
m_menu
->
addAction
(
ac
);
}
else
{
m_menu
->
insertAction
(
m_menu
->
actions
().
first
(),
ac
);
}
if
(
selected
.
isEmpty
()
||
selected
.
contains
(
-
1
))
{
ac
->
setChecked
(
true
);
}
...
...
@@ -195,5 +199,8 @@ void MarkerCategoryButton::setAllowAll(bool allowAll)
void
MarkerCategoryButton
::
setOnlyUsed
(
bool
onlyUsed
)
{
m_onlyUsed
=
onlyUsed
;
if
(
m_onlyUsed
)
{
connect
(
m_menu
,
&
QMenu
::
aboutToShow
,
this
,
&
MarkerCategoryButton
::
changed
);
}
emit
changed
();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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