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
a582d5db
Commit
a582d5db
authored
Apr 09, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix timeline clip selection broken after a move undo operation
parent
b6731517
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinefunctions.cpp
View file @
a582d5db
...
...
@@ -949,7 +949,7 @@ bool TimelineFunctions::changeClipState(const std::shared_ptr<TimelineItemModel>
}
result
=
timeline
->
m_allClips
[
clipId
]
->
setClipState
(
status
,
local_undo
,
local_redo
);
if
(
result
&&
track
>
-
1
)
{
result
=
timeline
->
getTrackById
(
track
)
->
requestClipInsertion
(
clipId
,
start
,
true
,
true
,
local_undo
,
local_redo
);
result
=
timeline
->
getTrackById
(
track
)
->
requestClipInsertion
(
clipId
,
start
,
true
,
true
,
local_undo
,
local_redo
,
false
,
false
);
}
UPDATE_UNDO_REDO_NOLOCK
(
local_redo
,
local_undo
,
undo
,
redo
);
return
result
;
...
...
src/timeline2/model/timelinemodel.cpp
View file @
a582d5db
...
...
@@ -841,7 +841,7 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
}
else
{
}
}
ok
=
ok
&&
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
position
,
updateView
,
finalMove
,
local_undo
,
local_redo
,
groupMove
,
allowedClipMixes
);
ok
=
ok
&&
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
position
,
updateView
,
finalMove
,
local_undo
,
local_redo
,
groupMove
,
false
,
allowedClipMixes
);
if
(
!
ok
)
{
qWarning
()
<<
"clip insertion failed"
;
...
...
@@ -2924,11 +2924,11 @@ int TimelineModel::requestClipResizeAndTimeWarp(int itemId, int size, bool right
if
(
!
right
)
{
pos
+=
getItemPlaytime
(
id
)
-
size
;
}
result
=
getTrackById
(
tid
)
->
requestClipDeletion
(
id
,
true
,
true
,
undo
,
redo
,
false
,
tru
e
);
result
=
getTrackById
(
tid
)
->
requestClipDeletion
(
id
,
true
,
true
,
undo
,
redo
,
false
,
fals
e
);
bool
pitchCompensate
=
m_allClips
[
id
]
->
getIntProperty
(
QStringLiteral
(
"warp_pitch"
));
result
=
result
&&
requestClipTimeWarp
(
id
,
speed
,
pitchCompensate
,
true
,
undo
,
redo
);
result
=
result
&&
requestItemResize
(
id
,
size
,
true
,
true
,
undo
,
redo
);
result
=
result
&&
getTrackById
(
tid
)
->
requestClipInsertion
(
id
,
pos
,
true
,
true
,
undo
,
redo
);
result
=
result
&&
getTrackById
(
tid
)
->
requestClipInsertion
(
id
,
pos
,
true
,
true
,
undo
,
redo
,
false
,
false
);
if
(
!
result
)
{
break
;
}
...
...
@@ -5422,7 +5422,7 @@ void TimelineModel::requestClipReload(int clipId, int forceDuration)
if
(
forceDuration
>
-
1
)
{
m_allClips
[
clipId
]
->
requestResize
(
forceDuration
,
true
,
local_undo
,
local_redo
);
}
getTrackById
(
old_trackId
)
->
requestClipInsertion
(
clipId
,
oldPos
,
refreshView
,
true
,
local_undo
,
local_redo
);
getTrackById
(
old_trackId
)
->
requestClipInsertion
(
clipId
,
oldPos
,
refreshView
,
true
,
local_undo
,
local_redo
,
false
,
false
);
if
(
maxDuration
!=
m_allClips
[
clipId
]
->
getMaxDuration
())
{
QModelIndex
ix
=
makeClipIndexFromID
(
clipId
);
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
MaxDurationRole
});
...
...
@@ -5467,7 +5467,7 @@ bool TimelineModel::requestClipTimeWarp(int clipId, double speed, bool pitchComp
success
=
m_allClips
[
clipId
]
->
useTimewarpProducer
(
speed
,
pitchCompensate
,
changeDuration
,
local_undo
,
local_redo
);
}
if
(
trackId
!=
-
1
)
{
success
=
success
&&
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
oldPos
,
true
,
true
,
local_undo
,
local_redo
);
success
=
success
&&
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
oldPos
,
true
,
true
,
local_undo
,
local_redo
,
false
,
false
);
}
if
(
!
success
)
{
local_undo
();
...
...
@@ -5525,7 +5525,7 @@ bool TimelineModel::requestClipTimeRemap(int clipId, bool enable, Fun &undo, Fun
success
=
m_allClips
[
clipId
]
->
useTimeRemapProducer
(
enable
,
local_undo
,
local_redo
);
}
if
(
trackId
!=
-
1
)
{
success
=
success
&&
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
oldPos
,
true
,
true
,
local_undo
,
local_redo
);
success
=
success
&&
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
oldPos
,
true
,
true
,
local_undo
,
local_redo
,
false
,
false
);
if
(
success
&&
!
enable
&&
previousDuration
>
0
)
{
// Restore input duration
requestItemResize
(
clipId
,
previousDuration
,
true
,
true
,
local_undo
,
local_redo
);
...
...
src/timeline2/model/trackmodel.cpp
View file @
a582d5db
...
...
@@ -265,7 +265,7 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
return
[]()
{
return
false
;
};
}
bool
TrackModel
::
requestClipInsertion
(
int
clipId
,
int
position
,
bool
updateView
,
bool
finalMove
,
Fun
&
undo
,
Fun
&
redo
,
bool
groupMove
,
const
QList
<
int
>
&
allowedClipMixes
)
bool
TrackModel
::
requestClipInsertion
(
int
clipId
,
int
position
,
bool
updateView
,
bool
finalMove
,
Fun
&
undo
,
Fun
&
redo
,
bool
groupMove
,
bool
newInsertion
,
const
QList
<
int
>
&
allowedClipMixes
)
{
QWriteLocker
locker
(
&
m_lock
);
if
(
isLocked
())
{
...
...
@@ -300,7 +300,7 @@ bool TrackModel::requestClipInsertion(int clipId, int position, bool updateView,
// A clip move changed the track duration, update track effects
m_effectStack
->
adjustStackLength
(
true
,
0
,
duration
,
0
,
trackDuration
(),
0
,
undo
,
redo
,
true
);
}
auto
reverse
=
requestClipDeletion_lambda
(
clipId
,
updateView
,
finalMove
,
groupMove
,
finalMove
);
auto
reverse
=
requestClipDeletion_lambda
(
clipId
,
updateView
,
finalMove
,
groupMove
,
newInsertion
);
UPDATE_UNDO_REDO
(
operation
,
reverse
,
local_undo
,
local_redo
);
UPDATE_UNDO_REDO
(
local_redo
,
local_undo
,
undo
,
redo
);
return
true
;
...
...
src/timeline2/model/trackmodel.hpp
View file @
a582d5db
...
...
@@ -174,7 +174,7 @@ protected:
@param undo Lambda function containing the current undo stack. Will be updated with current operation
@param redo Lambda function containing the current redo queue. Will be updated with current operation
*/
bool
requestClipInsertion
(
int
clipId
,
int
position
,
bool
updateView
,
bool
finalMove
,
Fun
&
undo
,
Fun
&
redo
,
bool
groupMove
=
false
,
const
QList
<
int
>
&
allowedClipMixes
=
{});
bool
requestClipInsertion
(
int
clipId
,
int
position
,
bool
updateView
,
bool
finalMove
,
Fun
&
undo
,
Fun
&
redo
,
bool
groupMove
=
false
,
bool
newInsertion
=
true
,
const
QList
<
int
>
&
allowedClipMixes
=
{});
/** @brief This function returns a lambda that performs the requested operation */
Fun
requestClipInsertion_lambda
(
int
clipId
,
int
position
,
bool
updateView
,
bool
finalMove
,
bool
groupMove
=
false
,
const
QList
<
int
>
&
allowedClipMixes
=
{});
...
...
src/timeline2/view/qml/Clip.qml
View file @
a582d5db
...
...
@@ -391,7 +391,7 @@ Rectangle {
color
:
'
transparent
'
id
:
itemBorder
anchors.fill
:
parent
border.color
:
(
clipStatus
===
ClipStatus
.
StatusMissing
||
ClipStatus
===
ClipStatus
.
StatusWaiting
||
clipStatus
===
ClipStatus
.
StatusDeleting
)
?
"
#ff0000
"
:
selected
?
root
.
selectionColor
:
grouped
?
root
.
groupColor
:
borderColor
border.color
:
(
clipStatus
===
ClipStatus
.
StatusMissing
||
ClipStatus
===
ClipStatus
.
StatusWaiting
||
clipStatus
===
ClipStatus
.
StatusDeleting
)
?
"
#ff0000
"
:
clipRoot
.
selected
?
root
.
selectionColor
:
grouped
?
root
.
groupColor
:
borderColor
border.width
:
isGrabbed
?
8
:
2
}
...
...
@@ -1153,7 +1153,7 @@ Rectangle {
}
},
State
{
name
:
'
selected
'
name
:
'
selected
Clip
'
when
:
clipRoot
.
selected
===
true
PropertyChanges
{
target
:
clipRoot
...
...
@@ -1446,7 +1446,7 @@ Rectangle {
height
:
container
.
height
width
:
clipRoot
.
maxDuration
*
clipRoot
.
timeScale
x
:
-
(
clipRoot
.
inPoint
-
slipOffset
)
*
clipRoot
.
timeScale
visible
:
root
.
activeTool
===
ProjectTool
.
SlipTool
&&
selected
&&
clipRoot
.
maxDuration
>
0
// don't show for endless clips
visible
:
root
.
activeTool
===
ProjectTool
.
SlipTool
&&
clipRoot
.
selected
&&
clipRoot
.
maxDuration
>
0
// don't show for endless clips
property
int
inPoint
:
clipRoot
.
inPoint
property
int
outPoint
:
clipRoot
.
outPoint
Rectangle
{
...
...
src/timeline2/view/qml/Track.qml
View file @
a582d5db
...
...
@@ -106,7 +106,7 @@ Item{
target
:
loader
.
item
property
:
"
selected
"
value
:
model
.
selected
when
:
loader
.
status
==
Loader
.
Ready
&&
model
.
clipType
!=
ProducerType
.
Track
when
:
loader
.
status
==
Loader
.
Ready
&&
loader
.
item
}
Binding
{
target
:
loader
.
item
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
a582d5db
...
...
@@ -3976,7 +3976,7 @@ bool TimelineController::endFakeMove(int clipId, int position, bool updateView,
}
res
=
res
&&
TimelineFunctions
::
requestInsertSpace
(
m_model
,
QPoint
(
position
,
position
+
duration
),
undo
,
redo
,
{
trackId
});
}
res
=
res
&&
m_model
->
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
position
,
updateView
,
invalidateTimeline
,
undo
,
redo
);
res
=
res
&&
m_model
->
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
position
,
updateView
,
invalidateTimeline
,
undo
,
redo
,
false
,
false
);
if
(
res
)
{
// Terminate fake move
if
(
m_model
->
isClip
(
clipId
))
{
...
...
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