Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
261
Issues
261
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
137f5f91
Commit
137f5f91
authored
Mar 09, 2018
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix clip monitor zone, snap to zone
parent
17411d21
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
100 additions
and
13 deletions
+100
-13
src/bin/bin.cpp
src/bin/bin.cpp
+0
-2
src/monitor/glwidget.cpp
src/monitor/glwidget.cpp
+2
-0
src/monitor/glwidget.h
src/monitor/glwidget.h
+32
-3
src/monitor/monitor.cpp
src/monitor/monitor.cpp
+17
-6
src/monitor/monitor.h
src/monitor/monitor.h
+2
-0
src/monitor/view/kdenliveclipmonitor.qml
src/monitor/view/kdenliveclipmonitor.qml
+1
-1
src/monitor/view/kdenlivemonitor.qml
src/monitor/view/kdenlivemonitor.qml
+1
-1
src/project/projectmanager.cpp
src/project/projectmanager.cpp
+1
-0
src/timeline2/model/timelinemodel.cpp
src/timeline2/model/timelinemodel.cpp
+10
-0
src/timeline2/model/timelinemodel.hpp
src/timeline2/model/timelinemodel.hpp
+10
-0
src/timeline2/view/timelinecontroller.cpp
src/timeline2/view/timelinecontroller.cpp
+24
-0
No files found.
src/bin/bin.cpp
View file @
137f5f91
...
...
@@ -1898,9 +1898,7 @@ void Bin::selectClip(const std::shared_ptr<ProjectClip> &clip)
if
(
id
.
isValid
()
&&
id2
.
isValid
())
{
m_proxyModel
->
selectionModel
()
->
select
(
QItemSelection
(
m_proxyModel
->
mapFromSource
(
id
),
m_proxyModel
->
mapFromSource
(
id2
)),
QItemSelectionModel
::
Select
);
}
selectProxyModel
(
m_proxyModel
->
mapFromSource
(
ix
));
m_itemView
->
scrollTo
(
m_proxyModel
->
mapFromSource
(
ix
));
emit
openClip
(
clip
);
}
void
Bin
::
slotOpenCurrent
()
...
...
src/monitor/glwidget.cpp
View file @
137f5f91
...
...
@@ -1781,6 +1781,8 @@ void GLWidget::setRulerInfo(int duration, std::shared_ptr<MarkerListModel> model
{
rootObject
()
->
setProperty
(
"duration"
,
duration
);
if
(
model
!=
nullptr
)
{
// we are resetting marker/snap model, reset zone
m_proxy
->
resetZone
();
rootContext
()
->
setContextProperty
(
"markersModel"
,
model
.
get
());
}
}
...
...
src/monitor/glwidget.h
View file @
137f5f91
...
...
@@ -350,25 +350,52 @@ public:
int
zoneOut
()
const
{
return
m_zoneOut
;
}
void
setZoneIn
(
int
pos
)
{
if
(
m_zoneIn
>
0
)
{
emit
removeSnap
(
m_zoneIn
);
}
m_zoneIn
=
pos
;
if
(
pos
>
0
)
{
emit
addSnap
(
pos
);
}
emit
zoneChanged
();
}
void
setZoneOut
(
int
pos
)
{
if
(
m_zoneOut
>
0
)
{
emit
removeSnap
(
m_zoneOut
);
}
m_zoneOut
=
pos
;
if
(
pos
>
0
)
{
emit
addSnap
(
pos
);
}
emit
zoneChanged
();
}
Q_INVOKABLE
void
setZone
(
int
in
,
int
out
)
{
if
(
m_zoneIn
>
0
)
{
emit
removeSnap
(
m_zoneIn
);
}
if
(
m_zoneOut
>
0
)
{
emit
removeSnap
(
m_zoneOut
);
}
m_zoneIn
=
in
;
m_zoneOut
=
out
;
if
(
m_zoneIn
>
0
)
{
emit
addSnap
(
m_zoneIn
);
}
if
(
m_zoneOut
>
0
)
{
emit
addSnap
(
m_zoneOut
);
}
emit
zoneChanged
();
}
void
setZone
(
QPoint
zone
)
{
m_zoneIn
=
zone
.
x
();
m_zoneOut
=
zone
.
y
();
emit
zoneChanged
();
setZone
(
zone
.
x
(),
zone
.
y
());
}
void
resetZone
()
{
m_zoneIn
=
0
;
m_zoneOut
=
-
1
;
}
QPoint
zone
()
const
{
return
QPoint
(
m_zoneIn
,
m_zoneOut
);
}
signals:
...
...
@@ -378,6 +405,8 @@ signals:
void
zoneChanged
();
void
markerCommentChanged
();
void
rulerHeightChanged
();
void
addSnap
(
int
);
void
removeSnap
(
int
);
private:
GLWidget
*
q
;
...
...
src/monitor/monitor.cpp
View file @
137f5f91
...
...
@@ -637,10 +637,6 @@ int Monitor::position()
GenTime
Monitor
::
getSnapForPos
(
bool
previous
)
{
QPoint
zone
=
m_glMonitor
->
getControllerProxy
()
->
zone
();
// TODO: move points with the zone
m_snaps
->
addPoint
(
zone
.
x
());
m_snaps
->
addPoint
(
zone
.
y
());
int
frame
=
previous
?
m_snaps
->
getPreviousPoint
(
m_glMonitor
->
getCurrentPos
())
:
m_snaps
->
getNextPoint
(
m_glMonitor
->
getCurrentPos
());
return
GenTime
(
frame
,
pCore
->
getCurrentFps
());
}
...
...
@@ -1219,6 +1215,9 @@ void Monitor::adjustRulerSize(int length, std::shared_ptr<MarkerListModel> marke
connect
(
markerModel
.
get
(),
SIGNAL
(
dataChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
,
const
QVector
<
int
>
&
)),
this
,
SLOT
(
checkOverlay
()));
connect
(
markerModel
.
get
(),
SIGNAL
(
rowsInserted
(
const
QModelIndex
&
,
int
,
int
)),
this
,
SLOT
(
checkOverlay
()));
connect
(
markerModel
.
get
(),
SIGNAL
(
rowsRemoved
(
const
QModelIndex
&
,
int
,
int
)),
this
,
SLOT
(
checkOverlay
()));
if
(
m_controller
)
{
markerModel
->
registerSnapModel
(
m_snaps
);
}
}
}
...
...
@@ -1350,13 +1349,11 @@ void Monitor::slotOpenClip(std::shared_ptr<ProjectClip> controller, int in, int
loadQmlScene
(
MonitorSceneDefault
);
m_snaps
.
reset
(
new
SnapModel
());
if
(
controller
)
{
m_controller
->
getMarkerModel
()
->
registerSnapModel
(
m_snaps
);
connect
(
m_controller
->
getMarkerModel
().
get
(),
SIGNAL
(
dataChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
,
const
QVector
<
int
>
&
)),
this
,
SLOT
(
checkOverlay
()));
connect
(
m_controller
->
getMarkerModel
().
get
(),
SIGNAL
(
rowsInserted
(
const
QModelIndex
&
,
int
,
int
)),
this
,
SLOT
(
checkOverlay
()));
connect
(
m_controller
->
getMarkerModel
().
get
(),
SIGNAL
(
rowsRemoved
(
const
QModelIndex
&
,
int
,
int
)),
this
,
SLOT
(
checkOverlay
()));
m_snaps
->
addPoint
(
m_controller
->
frameDuration
());
if
(
m_recManager
->
toolbar
()
->
isVisible
())
{
// we are in record mode, don't display clip
return
;
...
...
@@ -1364,7 +1361,10 @@ void Monitor::slotOpenClip(std::shared_ptr<ProjectClip> controller, int in, int
m_glMonitor
->
setRulerInfo
(
m_controller
->
frameDuration
(),
controller
->
getMarkerModel
());
m_timePos
->
setRange
(
0
,
m_controller
->
frameDuration
());
updateMarkers
();
connect
(
m_glMonitor
->
getControllerProxy
(),
&
MonitorProxy
::
addSnap
,
this
,
&
Monitor
::
addSnapPoint
,
Qt
::
DirectConnection
);
connect
(
m_glMonitor
->
getControllerProxy
(),
&
MonitorProxy
::
removeSnap
,
this
,
&
Monitor
::
removeSnapPoint
,
Qt
::
DirectConnection
);
m_glMonitor
->
getControllerProxy
()
->
setZone
(
m_controller
->
zone
());
m_snaps
->
addPoint
(
m_controller
->
frameDuration
());
// Loading new clip / zone, stop if playing
if
(
m_playAction
->
isActive
())
{
m_playAction
->
setActive
(
false
);
...
...
@@ -2151,3 +2151,14 @@ void Monitor::slotEnd()
m_glMonitor
->
switchPlay
(
false
);
m_glMonitor
->
seek
(
m_glMonitor
->
duration
());
}
void
Monitor
::
addSnapPoint
(
int
pos
)
{
m_snaps
->
addPoint
(
pos
);
}
void
Monitor
::
removeSnapPoint
(
int
pos
)
{
m_snaps
->
removePoint
(
pos
);
}
src/monitor/monitor.h
View file @
137f5f91
...
...
@@ -275,6 +275,8 @@ private slots:
/** @brief Project monitor zone changed, inform timeline */
void
updateTimelineClipZone
();
void
slotSeekPosition
(
int
);
void
addSnapPoint
(
int
pos
);
void
removeSnapPoint
(
int
pos
);
public
slots
:
void
slotOpenDvdFile
(
const
QString
&
);
...
...
src/monitor/view/kdenliveclipmonitor.qml
View file @
137f5f91
...
...
@@ -194,7 +194,7 @@ Item {
style
:
TextFieldStyle
{
textColor
:
"
white
"
background
:
Rectangle
{
color
:
"
#66ff0000
"
color
:
controller
.
position
==
controller
.
zoneIn
?
"
#9900ff00
"
:
controller
.
position
==
controller
.
zoneOut
?
"
#99ff0000
"
:
"
#990000ff
"
width
:
marker
.
width
}
}
...
...
src/monitor/view/kdenlivemonitor.qml
View file @
137f5f91
...
...
@@ -162,7 +162,7 @@ Item {
style
:
TextFieldStyle
{
textColor
:
"
white
"
background
:
Rectangle
{
color
:
"
#99ff0000
"
color
:
controller
.
position
==
controller
.
zoneIn
?
"
#9900ff00
"
:
controller
.
position
==
controller
.
zoneOut
?
"
#99ff0000
"
:
"
#990000ff
"
width
:
marker
.
width
}
}
...
...
src/project/projectmanager.cpp
View file @
137f5f91
...
...
@@ -902,3 +902,4 @@ std::shared_ptr<DocUndoStack> ProjectManager::undoStack()
{
return
current
()
->
commandStack
();
}
src/timeline2/model/timelinemodel.cpp
View file @
137f5f91
...
...
@@ -1443,6 +1443,16 @@ int TimelineModel::requestPreviousSnapPos(int pos)
return
m_snaps
->
getPreviousPoint
(
pos
);
}
void
TimelineModel
::
addSnap
(
int
pos
)
{
return
m_snaps
->
addPoint
(
pos
);
}
void
TimelineModel
::
removeSnap
(
int
pos
)
{
return
m_snaps
->
removePoint
(
pos
);
}
void
TimelineModel
::
registerComposition
(
const
std
::
shared_ptr
<
CompositionModel
>
&
composition
)
{
int
id
=
composition
->
getId
();
...
...
src/timeline2/model/timelinemodel.hpp
View file @
137f5f91
...
...
@@ -447,6 +447,16 @@ public:
*/
int
requestPreviousSnapPos
(
int
pos
);
/* @brief Add a new snap point
@param pos is the current position
*/
void
addSnap
(
int
pos
);
/* @brief Remove snap point
@param pos is the current position
*/
void
removeSnap
(
int
pos
);
/* @brief Request composition insertion at given position.
This action is undoable
Returns true on success. If it fails, nothing is modified.
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
137f5f91
...
...
@@ -699,18 +699,42 @@ void TimelineController::onSeeked(int position)
void
TimelineController
::
setZone
(
const
QPoint
&
zone
)
{
if
(
m_zone
.
x
()
>
0
)
{
m_model
->
removeSnap
(
m_zone
.
x
());
}
if
(
m_zone
.
y
()
>
0
)
{
m_model
->
removeSnap
(
m_zone
.
y
());
}
if
(
zone
.
x
()
>
0
)
{
m_model
->
addSnap
(
zone
.
x
());
}
if
(
zone
.
y
()
>
0
)
{
m_model
->
addSnap
(
zone
.
y
());
}
m_zone
=
zone
;
emit
zoneChanged
();
}
void
TimelineController
::
setZoneIn
(
int
inPoint
)
{
if
(
m_zone
.
x
()
>
0
)
{
m_model
->
removeSnap
(
m_zone
.
x
());
}
if
(
inPoint
>
0
)
{
m_model
->
addSnap
(
inPoint
);
}
m_zone
.
setX
(
inPoint
);
emit
zoneMoved
(
m_zone
);
}
void
TimelineController
::
setZoneOut
(
int
outPoint
)
{
if
(
m_zone
.
y
()
>
0
)
{
m_model
->
removeSnap
(
m_zone
.
y
());
}
if
(
outPoint
>
0
)
{
m_model
->
addSnap
(
outPoint
);
}
m_zone
.
setY
(
outPoint
);
emit
zoneMoved
(
m_zone
);
}
...
...
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