Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
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
videolan
vlc-2-2
Commits
74d4a589
Commit
74d4a589
authored
Feb 10, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: simplify selected item deletion in playlist model
parent
a99d1a2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
30 deletions
+14
-30
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+14
-29
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+0
-1
No files found.
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
74d4a589
...
...
@@ -757,18 +757,22 @@ void PLModel::doDelete( QModelIndexList selected )
{
if
(
!
canEdit
()
)
return
;
for
(
int
i
=
selected
.
size
()
-
1
;
i
>=
0
;
i
--
)
while
(
!
selected
.
isEmpty
()
)
{
QModelIndex
index
=
selected
[
i
];
QModelIndex
index
=
selected
[
0
];
selected
.
removeAt
(
0
);
if
(
index
.
column
()
!=
0
)
continue
;
PLItem
*
item
=
getItem
(
index
);
if
(
item
)
{
if
(
item
->
children
.
size
()
)
recurseDelete
(
item
->
children
,
&
selected
);
doDeleteItem
(
item
,
&
selected
);
}
if
(
i
>
selected
.
size
()
)
i
=
selected
.
size
();
if
(
item
->
children
.
size
()
)
recurseDelete
(
item
->
children
,
&
selected
);
PL_LOCK
;
playlist_DeleteFromInput
(
p_playlist
,
item
->
p_input
,
pl_Locked
);
PL_UNLOCK
;
removeItem
(
item
);
}
}
...
...
@@ -779,29 +783,10 @@ void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList
PLItem
*
item
=
children
[
i
];
if
(
item
->
children
.
size
()
)
recurseDelete
(
item
->
children
,
fullList
);
doDeleteItem
(
item
,
fullList
);
fullList
->
removeAll
(
index
(
item
,
0
)
);
}
}
void
PLModel
::
doDeleteItem
(
PLItem
*
item
,
QModelIndexList
*
fullList
)
{
QModelIndex
deleteIndex
=
index
(
item
,
0
);
fullList
->
removeAll
(
deleteIndex
);
PL_LOCK
;
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_playlist
,
item
->
i_id
);
if
(
!
p_item
)
{
PL_UNLOCK
;
return
;
}
playlist_DeleteFromInput
(
p_playlist
,
p_item
->
p_input
,
pl_Locked
);
PL_UNLOCK
;
/* And finally, remove it from the tree */
removeItem
(
item
);
}
/******* Volume III: Sorting and searching ********/
void
PLModel
::
sort
(
int
column
,
Qt
::
SortOrder
order
)
{
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
74d4a589
...
...
@@ -120,7 +120,6 @@ private:
/* Actions */
void
recurseDelete
(
QList
<
PLItem
*>
children
,
QModelIndexList
*
fullList
);
void
doDeleteItem
(
PLItem
*
item
,
QModelIndexList
*
fullList
);
void
updateTreeItem
(
PLItem
*
);
void
removeItem
(
PLItem
*
);
void
takeItem
(
PLItem
*
);
//will not delete item
...
...
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