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
258
Issues
258
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
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
36472080
Commit
36472080
authored
Jul 08, 2019
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic collision check to speed resize
Related to
#224
parent
88f5f07f
Pipeline
#5087
passed with stage
in 21 minutes and 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
2 deletions
+39
-2
src/timeline2/model/timelinemodel.cpp
src/timeline2/model/timelinemodel.cpp
+35
-0
src/timeline2/model/timelinemodel.hpp
src/timeline2/model/timelinemodel.hpp
+2
-0
src/timeline2/view/qml/Track.qml
src/timeline2/view/qml/Track.qml
+2
-2
No files found.
src/timeline2/model/timelinemodel.cpp
View file @
36472080
...
...
@@ -1809,6 +1809,41 @@ int TimelineModel::requestItemResizeInfo(int itemId, int in, int out, int size,
return
size
;
}
int
TimelineModel
::
requestItemSpeedChange
(
int
itemId
,
int
size
,
bool
right
,
int
snapDistance
)
{
Q_ASSERT
(
isClip
(
itemId
));
QWriteLocker
locker
(
&
m_lock
);
TRACE
(
itemId
,
size
,
right
,
snapDistance
);
Q_ASSERT
(
isItem
(
itemId
));
if
(
size
<=
0
)
{
TRACE_RES
(
-
1
);
return
-
1
;
}
int
in
=
getItemPosition
(
itemId
);
int
out
=
in
+
getItemPlaytime
(
itemId
);
if
(
right
&&
size
>
out
-
in
)
{
int
targetPos
=
in
+
size
-
1
;
int
trackId
=
getItemTrackId
(
itemId
);
if
(
!
getTrackById_const
(
trackId
)
->
isBlankAt
(
targetPos
)
||
!
getItemsInRange
(
trackId
,
out
+
1
,
targetPos
,
false
).
empty
())
{
size
=
getTrackById_const
(
trackId
)
->
getBlankEnd
(
out
+
1
)
-
in
;
}
}
else
if
(
!
right
&&
size
>
(
out
-
in
))
{
int
targetPos
=
out
-
size
;
int
trackId
=
getItemTrackId
(
itemId
);
if
(
!
getTrackById_const
(
trackId
)
->
isBlankAt
(
targetPos
)
||
!
getItemsInRange
(
trackId
,
targetPos
,
in
-
1
,
false
).
empty
())
{
size
=
out
-
getTrackById_const
(
trackId
)
->
getBlankStart
(
in
-
1
);
}
}
int
timelinePos
=
pCore
->
getTimelinePosition
();
m_snaps
->
addPoint
(
timelinePos
);
int
proposed_size
=
m_snaps
->
proposeSize
(
in
,
out
,
getBoundaries
(
itemId
),
size
,
right
,
snapDistance
);
m_snaps
->
removePoint
(
timelinePos
);
qDebug
()
<<
"==== RESIZE REQUEST: "
<<
size
<<
"*, RESULKT: "
<<
proposed_size
;
return
proposed_size
>
0
?
proposed_size
:
size
;
}
int
TimelineModel
::
requestItemResize
(
int
itemId
,
int
size
,
bool
right
,
bool
logUndo
,
int
snapDistance
,
bool
allowSingleResize
)
{
if
(
logUndo
)
{
...
...
src/timeline2/model/timelinemodel.hpp
View file @
36472080
...
...
@@ -462,6 +462,8 @@ public:
/* Same function, but accumulates undo and redo and doesn't deal with snapping*/
bool
requestItemResize
(
int
itemId
,
int
size
,
bool
right
,
bool
logUndo
,
Fun
&
undo
,
Fun
&
redo
,
bool
blockUndo
=
false
);
/* Returns a proposed size for clip resize, checking for collisions */
Q_INVOKABLE
int
requestItemSpeedChange
(
int
itemId
,
int
size
,
bool
right
,
int
snapDistance
);
/* Returns a list of {id, position duration} for all elements in the group*/
Q_INVOKABLE
const
QVariantList
getGroupData
(
int
itemId
);
Q_INVOKABLE
void
processGroupResize
(
QVariantList
startPos
,
QVariantList
endPos
,
bool
right
);
...
...
src/timeline2/view/qml/Track.qml
View file @
36472080
...
...
@@ -271,7 +271,7 @@ Column{
}
onTrimmingIn
:
{
if
(
controlTrim
)
{
newDuration
=
Math
.
max
(
1
,
newDuration
)
newDuration
=
controller
.
requestItemSpeedChange
(
clip
.
clipId
,
newDuration
,
false
,
root
.
snapping
)
speedController
.
x
=
clip
.
x
+
clip
.
width
-
newDuration
*
trackRoot
.
timeScale
speedController
.
width
=
newDuration
*
trackRoot
.
timeScale
speedController
.
lastValidDuration
=
newDuration
...
...
@@ -315,7 +315,7 @@ Column{
onTrimmingOut
:
{
if
(
controlTrim
)
{
speedController
.
x
=
clip
.
x
newDuration
=
Math
.
max
(
1
,
newDuration
)
newDuration
=
controller
.
requestItemSpeedChange
(
clip
.
clipId
,
newDuration
,
true
,
root
.
snapping
)
speedController
.
width
=
newDuration
*
trackRoot
.
timeScale
speedController
.
lastValidDuration
=
newDuration
speedController
.
speedText
=
(
100
*
clip
.
originalDuration
*
clip
.
speed
/
speedController
.
lastValidDuration
).
toFixed
(
2
)
+
'
%
'
...
...
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