Skip to content
GitLab
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
b04d4fbd
Commit
b04d4fbd
authored
Mar 20, 2018
by
Jean-Baptiste Mardelle
Browse files
Fix composition selection issues
Reintroduce the select current item feature
parent
c74e7908
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/mainwindow.cpp
View file @
b04d4fbd
...
...
@@ -2601,62 +2601,32 @@ void MainWindow::slotClearPreviewRender()
void
MainWindow
::
slotSelectTimelineClip
()
{
// TODO refac
/*
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->selectClip(true);
}
*/
getCurrentTimeline
()
->
controller
()
->
selectCurrentItem
(
ObjectType
::
TimelineClip
,
true
);
}
void
MainWindow
::
slotSelectTimelineTransition
()
{
// TODO refac
/*
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->selectTransition(true);
}
*/
getCurrentTimeline
()
->
controller
()
->
selectCurrentItem
(
ObjectType
::
TimelineComposition
,
true
);
}
void
MainWindow
::
slotDeselectTimelineClip
()
{
// TODO refac
/*
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->selectClip(false, true);
}
*/
getCurrentTimeline
()
->
controller
()
->
selectCurrentItem
(
ObjectType
::
TimelineClip
,
false
);
}
void
MainWindow
::
slotDeselectTimelineTransition
()
{
// TODO refac
/*
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->selectTransition(false, true);
}
*/
getCurrentTimeline
()
->
controller
()
->
selectCurrentItem
(
ObjectType
::
TimelineComposition
,
false
);
}
void
MainWindow
::
slotSelectAddTimelineClip
()
{
// TODO refac
/*
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->selectClip(true, true);
}
*/
getCurrentTimeline
()
->
controller
()
->
selectCurrentItem
(
ObjectType
::
TimelineClip
,
true
,
true
);
}
void
MainWindow
::
slotSelectAddTimelineTransition
()
{
// TODO refac
/*
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->selectTransition(true, true);
}
*/
getCurrentTimeline
()
->
controller
()
->
selectCurrentItem
(
ObjectType
::
TimelineComposition
,
true
,
true
);
}
void
MainWindow
::
slotGroupClips
()
...
...
src/timeline2/model/groupsmodel.cpp
View file @
b04d4fbd
...
...
@@ -668,7 +668,7 @@ int GroupsModel::fromJson(const QJsonObject &o, Fun &undo, Fun &redo)
int
id
=
-
1
;
if
(
leaf
==
QLatin1String
(
"clip"
))
{
id
=
ptr
->
getClipByPosition
(
trackId
,
pos
);
}
else
if
(
leaf
==
QLatin1String
(
"c
lip
"
))
{
}
else
if
(
leaf
==
QLatin1String
(
"c
omposition
"
))
{
id
=
ptr
->
getCompositionByPosition
(
trackId
,
pos
);
}
return
id
;
...
...
src/timeline2/model/timelinemodel.cpp
View file @
b04d4fbd
...
...
@@ -857,6 +857,7 @@ bool TimelineModel::requestGroupDeletion(int clipId, Fun &undo, Fun &redo)
std
::
queue
<
int
>
group_queue
;
group_queue
.
push
(
m_groups
->
getRootId
(
clipId
));
std
::
unordered_set
<
int
>
all_clips
;
std
::
unordered_set
<
int
>
all_compositions
;
while
(
!
group_queue
.
empty
())
{
int
current_group
=
group_queue
.
front
();
if
(
m_temporarySelectionGroup
==
current_group
)
{
...
...
@@ -870,6 +871,9 @@ bool TimelineModel::requestGroupDeletion(int clipId, Fun &undo, Fun &redo)
if
(
isClip
(
c
))
{
all_clips
.
insert
(
c
);
one_child
=
c
;
}
else
if
(
isComposition
(
c
))
{
all_compositions
.
insert
(
c
);
one_child
=
c
;
}
else
{
Q_ASSERT
(
isGroup
(
c
));
one_child
=
c
;
...
...
@@ -891,6 +895,13 @@ bool TimelineModel::requestGroupDeletion(int clipId, Fun &undo, Fun &redo)
return
false
;
}
}
for
(
int
compo
:
all_compositions
)
{
bool
res
=
requestCompositionDeletion
(
compo
,
undo
,
redo
);
if
(
!
res
)
{
undo
();
return
false
;
}
}
return
true
;
}
...
...
src/timeline2/model/trackmodel.cpp
View file @
b04d4fbd
...
...
@@ -545,8 +545,12 @@ int TrackModel::getCompositionByPosition(int position)
{
READ_LOCK
();
for
(
const
auto
&
comp
:
m_compoPos
)
{
if
(
comp
.
second
==
position
)
{
return
comp
.
first
;
if
(
comp
.
first
==
position
)
{
return
comp
.
second
;
}
else
if
(
comp
.
first
<
position
)
{
if
(
comp
.
first
+
m_allCompositions
[
comp
.
second
]
->
getPlaytime
()
>=
position
)
{
return
comp
.
second
;
}
}
}
return
-
1
;
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
b04d4fbd
...
...
@@ -238,6 +238,28 @@ std::unordered_set<int> TimelineController::getCurrentSelectionIds() const
return
selection
;
}
void
TimelineController
::
selectCurrentItem
(
ObjectType
type
,
bool
select
,
bool
addToCurrent
)
{
QList
<
int
>
toSelect
;
int
currentClip
=
type
==
ObjectType
::
TimelineClip
?
m_model
->
getClipByPosition
(
m_activeTrack
,
timelinePosition
())
:
m_model
->
getCompositionByPosition
(
m_activeTrack
,
timelinePosition
());
if
(
currentClip
==
-
1
)
{
pCore
->
displayMessage
(
i18n
(
"No item under timeline cursor in active track"
),
InformationMessage
,
500
);
return
;
}
if
(
addToCurrent
||
!
select
)
{
toSelect
=
m_selection
.
selectedItems
;
}
if
(
select
)
{
if
(
!
toSelect
.
contains
(
currentClip
))
{
toSelect
<<
currentClip
;
setSelection
(
toSelect
);
}
}
else
if
(
toSelect
.
contains
(
currentClip
))
{
toSelect
.
removeAll
(
currentClip
);
setSelection
(
toSelect
);
}
}
void
TimelineController
::
setSelection
(
const
QList
<
int
>
&
newSelection
,
int
trackIndex
,
bool
isMultitrack
)
{
if
(
newSelection
!=
selection
()
||
trackIndex
!=
m_selection
.
selectedTrack
||
isMultitrack
!=
m_selection
.
isMultitrackSelected
)
{
...
...
src/timeline2/view/timelinecontroller.h
View file @
b04d4fbd
...
...
@@ -349,6 +349,8 @@ public:
void
resetTrackHeight
();
/** @brief timeline preview params changed, reset */
void
resetPreview
();
/** @brief Select the clip in active track under cursor */
void
selectCurrentItem
(
ObjectType
type
,
bool
select
,
bool
addToCurrent
=
false
);
public
slots
:
void
selectMultitrack
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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