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
7da3201e
Commit
7da3201e
authored
Jul 12, 2020
by
Jean-Baptiste Mardelle
Browse files
When dragging a clip in insert mode, don't allow leaving empty space in timeline.
Related to
#673
parent
367d056f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
7da3201e
...
...
@@ -727,6 +727,14 @@ QVariantList TimelineModel::suggestItemMove(int itemId, int trackId, int positio
return
suggestCompositionMove
(
itemId
,
trackId
,
position
,
cursorPosition
,
snapDistance
);
}
int
TimelineModel
::
adjustFrame
(
int
frame
,
int
trackId
)
{
if
(
m_editMode
==
TimelineMode
::
InsertEdit
&&
isTrack
(
trackId
))
{
frame
=
qMin
(
frame
,
getTrackById_const
(
trackId
)
->
trackDuration
());
}
return
frame
;
}
QVariantList
TimelineModel
::
suggestClipMove
(
int
clipId
,
int
trackId
,
int
position
,
int
cursorPosition
,
int
snapDistance
,
bool
moveMirrorTracks
)
{
QWriteLocker
locker
(
&
m_lock
);
...
...
@@ -744,6 +752,14 @@ QVariantList TimelineModel::suggestClipMove(int clipId, int trackId, int positio
TRACE_RES
(
position
);
return
{
position
,
trackId
};
}
if
(
m_editMode
==
TimelineMode
::
InsertEdit
)
{
int
maxPos
=
getTrackById_const
(
trackId
)
->
trackDuration
();
if
(
m_allClips
[
clipId
]
->
getCurrentTrackId
()
==
trackId
)
{
maxPos
-=
m_allClips
[
clipId
]
->
getPlaytime
();
}
qDebug
()
<<
"=== TRYING CLIP MOVE AT: "
<<
position
<<
", MAX TK: "
<<
getTrackById_const
(
trackId
)
->
trackDuration
();
position
=
qMin
(
position
,
maxPos
);
}
bool
after
=
position
>
currentPos
;
if
(
snapDistance
>
0
)
{
std
::
vector
<
int
>
ignored_pts
;
...
...
src/timeline2/model/timelinemodel.hpp
View file @
7da3201e
...
...
@@ -389,6 +389,9 @@ public:
Q_INVOKABLE
QVariantList
suggestItemMove
(
int
itemId
,
int
trackId
,
int
position
,
int
cursorPosition
,
int
snapDistance
=
-
1
);
Q_INVOKABLE
QVariantList
suggestClipMove
(
int
clipId
,
int
trackId
,
int
position
,
int
cursorPosition
,
int
snapDistance
=
-
1
,
bool
moveMirrorTracks
=
true
);
Q_INVOKABLE
QVariantList
suggestCompositionMove
(
int
compoId
,
int
trackId
,
int
position
,
int
cursorPosition
,
int
snapDistance
=
-
1
);
/** @brief returns the frame pos adjusted to edit mode
*/
Q_INVOKABLE
int
adjustFrame
(
int
frame
,
int
trackId
);
/* @brief Request clip insertion at given position. This action is undoable
Returns true on success. If it fails, nothing is modified.
...
...
src/timeline2/view/qml/timeline.qml
View file @
7da3201e
...
...
@@ -514,7 +514,8 @@ Rectangle {
clipBeingDroppedId
=
insertAndMaybeGroup
(
timeline
.
activeTrack
,
frame
,
clipBeingDroppedData
)
}
else
{
// we want insert/overwrite mode, make a fake insert at end of timeline, then move to position
clipBeingDroppedId
=
insertAndMaybeGroup
(
timeline
.
activeTrack
,
timeline
.
fullDuration
,
clipBeingDroppedData
)
frame
=
controller
.
adjustFrame
(
frame
,
timeline
.
activeTrack
)
clipBeingDroppedId
=
insertAndMaybeGroup
(
timeline
.
activeTrack
,
frame
,
clipBeingDroppedData
)
if
(
clipBeingDroppedId
>
-
1
)
{
var
moveData
=
controller
.
suggestClipMove
(
clipBeingDroppedId
,
timeline
.
activeTrack
,
frame
,
root
.
consumerPosition
,
root
.
snapping
)
fakeFrame
=
moveData
[
0
]
...
...
Write
Preview
Supports
Markdown
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