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
2cb43162
Commit
2cb43162
authored
Nov 03, 2022
by
Jean-Baptiste Mardelle
Browse files
When deleting a guides category, also remove all clip markers using it
parent
6c1ac094
Pipeline
#260661
failed with stage
in 6 minutes and 22 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
2cb43162
...
...
@@ -5488,3 +5488,35 @@ void Bin::processMultiStream(const QString &clipId, QList<int> videoStreams, QLi
pCore
->
pushUndo
(
undo
,
redo
,
i18np
(
"Add additional stream for clip"
,
"Add additional streams for clip"
,
importedStreams
));
}
}
int
Bin
::
getAllClipMarkers
(
int
category
)
const
{
int
markersCount
=
0
;
QList
<
std
::
shared_ptr
<
ProjectClip
>>
clipList
=
m_itemModel
->
getRootFolder
()
->
childClips
();
for
(
const
std
::
shared_ptr
<
ProjectClip
>
&
clip
:
qAsConst
(
clipList
))
{
markersCount
+=
clip
->
getMarkerModel
()
->
getAllMarkers
(
category
).
count
();
}
return
markersCount
;
}
void
Bin
::
removeMarkerCategories
(
QList
<
int
>
toRemove
)
{
Fun
undo
=
[]()
{
return
true
;
};
Fun
redo
=
[]()
{
return
true
;
};
bool
found
=
false
;
QList
<
std
::
shared_ptr
<
ProjectClip
>>
clipList
=
m_itemModel
->
getRootFolder
()
->
childClips
();
for
(
const
std
::
shared_ptr
<
ProjectClip
>
&
clip
:
qAsConst
(
clipList
))
{
for
(
int
i
:
toRemove
)
{
QList
<
CommentedTime
>
toDelete
=
clip
->
getMarkerModel
()
->
getAllMarkers
(
i
);
if
(
!
found
&&
toDelete
.
count
()
>
0
)
{
found
=
true
;
}
for
(
CommentedTime
c
:
toDelete
)
{
clip
->
getMarkerModel
()
->
removeMarker
(
c
.
time
(),
undo
,
redo
);
}
}
}
if
(
found
)
{
pCore
->
pushUndo
(
undo
,
redo
,
i18n
(
"Remove clip markers"
));
}
}
src/bin/bin.h
View file @
2cb43162
...
...
@@ -243,6 +243,12 @@ public:
/** @brief Add markers on clip \@param binId at \@param positions with @comments text if given */
void
addClipMarker
(
const
QString
&
binId
,
const
QList
<
int
>
&
positions
,
const
QStringList
&
comments
=
{});
/** @brief Get the count of all markers in all clips using this category */
int
getAllClipMarkers
(
int
category
)
const
;
/** @brief Remove all clip markers using a category */
void
removeMarkerCategories
(
QList
<
int
>
toRemove
);
/** @brief Returns a list of selected clip ids.
* @param allowSubClips: if true, will include subclip ids in the form: "master clip id/in/out"
*/
...
...
src/doc/kdenlivedoc.cpp
View file @
2cb43162
...
...
@@ -381,6 +381,22 @@ const QStringList KdenliveDoc::guidesCategories() const
void
KdenliveDoc
::
updateGuideCategories
(
const
QStringList
&
categories
)
{
const
QStringList
currentCategories
=
m_documentProperties
.
value
(
QStringLiteral
(
"guidesCategories"
)).
split
(
QLatin1Char
(
'\n'
));
// Check if a guide category was removed
QList
<
int
>
currentIndexes
;
QList
<
int
>
updatedIndexes
;
for
(
auto
&
cat
:
currentCategories
)
{
currentIndexes
<<
cat
.
section
(
QLatin1Char
(
':'
),
-
2
,
-
2
).
toInt
();
}
for
(
auto
&
cat
:
categories
)
{
updatedIndexes
<<
cat
.
section
(
QLatin1Char
(
':'
),
-
2
,
-
2
).
toInt
();
}
for
(
auto
&
i
:
updatedIndexes
)
{
currentIndexes
.
removeAll
(
i
);
}
if
(
!
currentIndexes
.
isEmpty
())
{
// A marker category was removed, delete all Bin clip markers using it
pCore
->
bin
()
->
removeMarkerCategories
(
currentIndexes
);
}
m_guideModel
->
loadCategoriesWithUndo
(
categories
,
currentCategories
);
}
...
...
src/project/dialogs/guidecategories.cpp
View file @
2cb43162
...
...
@@ -113,6 +113,7 @@ GuideCategories::GuideCategories(KdenliveDoc *doc, QWidget *parent)
// Check usage
if
(
doc
)
{
int
count
=
doc
->
getGuideModel
()
->
getAllMarkers
(
ix
).
count
();
count
+=
pCore
->
bin
()
->
getAllClipMarkers
(
ix
);
item
->
setData
(
Qt
::
UserRole
+
2
,
count
);
}
guides_list
->
addItem
(
item
);
...
...
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