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
9a8de2e4
Commit
9a8de2e4
authored
Jun 21, 2019
by
Jean-Baptiste Mardelle
Browse files
Cleanup in clip/composition resize UI update
parent
c4153484
Pipeline
#4487
passed with stage
in 14 minutes and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/compositionmodel.cpp
View file @
9a8de2e4
...
...
@@ -116,28 +116,34 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
// Perform resize only
setInOut
(
in
,
out
);
}
Fun
operation
=
[
track_operation
]()
{
QVector
<
int
>
roles
{
TimelineModel
::
DurationRole
};
if
(
!
right
)
{
roles
.
push_back
(
TimelineModel
::
StartRole
);
}
Fun
operation
=
[
this
,
track_operation
,
roles
]()
{
if
(
track_operation
())
{
// we send a list of roles to be updated
if
(
auto
ptr
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr
->
makeCompositionIndexFromID
(
m_id
);
ptr
->
dataChanged
(
ix
,
ix
,
roles
);
}
return
true
;
}
return
false
;
};
if
(
operation
())
{
// Now, we are in the state in which the timeline should be when we try to revert current action. So we can build the reverse action from here
auto
ptr
=
m_parent
.
lock
();
// we send a list of roles to be updated
QVector
<
int
>
roles
{
TimelineModel
::
DurationRole
};
if
(
!
right
)
{
roles
.
push_back
(
TimelineModel
::
StartRole
);
}
if
(
m_currentTrackId
!=
-
1
&&
ptr
)
{
QModelIndex
ix
=
ptr
->
makeCompositionIndexFromID
(
m_id
);
// TODO: integrate in undo
ptr
->
dataChanged
(
ix
,
ix
,
roles
);
track_reverse
=
ptr
->
getTrackById
(
m_currentTrackId
)
->
requestCompositionResize_lambda
(
m_id
,
old_in
,
old_out
,
logUndo
);
if
(
m_currentTrackId
!=
-
1
)
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
track_reverse
=
ptr
->
getTrackById
(
m_currentTrackId
)
->
requestCompositionResize_lambda
(
m_id
,
old_in
,
old_out
,
logUndo
);
}
}
Fun
reverse
=
[
track_reverse
]()
{
Fun
reverse
=
[
this
,
track_reverse
,
roles
]()
{
if
(
track_reverse
())
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr
->
makeCompositionIndexFromID
(
m_id
);
ptr
->
dataChanged
(
ix
,
ix
,
roles
);
}
return
true
;
}
return
false
;
...
...
src/timeline2/model/timelinemodel.cpp
View file @
9a8de2e4
...
...
@@ -1781,15 +1781,6 @@ bool TimelineModel::requestItemResize(int itemId, int size, bool right, bool log
{
Fun
local_undo
=
[]()
{
return
true
;
};
Fun
local_redo
=
[]()
{
return
true
;
};
Fun
update_model
=
[
itemId
,
right
,
logUndo
,
this
]()
{
Q_ASSERT
(
isItem
(
itemId
));
if
(
getItemTrackId
(
itemId
)
!=
-
1
)
{
qDebug
()
<<
"++++++++++
\n
RESIZING ITEM: "
<<
itemId
<<
"
\n
+++++++"
;
QModelIndex
modelIndex
=
isClip
(
itemId
)
?
makeClipIndexFromID
(
itemId
)
:
makeCompositionIndexFromID
(
itemId
);
notifyChange
(
modelIndex
,
modelIndex
,
!
right
,
true
,
logUndo
);
}
return
true
;
};
bool
result
=
false
;
if
(
isClip
(
itemId
))
{
result
=
m_allClips
[
itemId
]
->
requestResize
(
size
,
right
,
local_undo
,
local_redo
,
logUndo
);
...
...
@@ -1798,11 +1789,6 @@ bool TimelineModel::requestItemResize(int itemId, int size, bool right, bool log
result
=
m_allCompositions
[
itemId
]
->
requestResize
(
size
,
right
,
local_undo
,
local_redo
,
logUndo
);
}
if
(
result
)
{
if
(
!
blockUndo
)
{
PUSH_LAMBDA
(
update_model
,
local_undo
);
}
PUSH_LAMBDA
(
update_model
,
local_redo
);
update_model
();
UPDATE_UNDO_REDO
(
local_redo
,
local_undo
,
undo
,
redo
);
}
return
result
;
...
...
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