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
53cd4ad4
Commit
53cd4ad4
authored
Aug 19, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qt4: move item removal from PLItem to PLModel...
...and fix memleak when removing..
parent
26201e1c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
14 deletions
+17
-14
modules/gui/qt4/components/playlist/playlist_item.cpp
modules/gui/qt4/components/playlist/playlist_item.cpp
+0
-9
modules/gui/qt4/components/playlist/playlist_item.hpp
modules/gui/qt4/components/playlist/playlist_item.hpp
+0
-2
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+16
-3
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+1
-0
No files found.
modules/gui/qt4/components/playlist/playlist_item.cpp
View file @
53cd4ad4
...
@@ -84,15 +84,6 @@ void PLItem::insertChild( PLItem *item, int i_pos, bool signal )
...
@@ -84,15 +84,6 @@ void PLItem::insertChild( PLItem *item, int i_pos, bool signal )
children
.
insert
(
i_pos
,
item
);
children
.
insert
(
i_pos
,
item
);
}
}
void
PLItem
::
remove
(
PLItem
*
removed
,
int
i_depth
)
{
if
(
i_depth
==
1
/* DEPTH_SEL */
||
parentItem
)
{
int
i_index
=
parentItem
->
children
.
indexOf
(
removed
);
parentItem
->
children
.
removeAt
(
i_index
);
}
}
/* This function is used to get one's parent's row number in the model */
/* This function is used to get one's parent's row number in the model */
int
PLItem
::
row
()
const
int
PLItem
::
row
()
const
{
{
...
...
modules/gui/qt4/components/playlist/playlist_item.hpp
View file @
53cd4ad4
...
@@ -47,8 +47,6 @@ public:
...
@@ -47,8 +47,6 @@ public:
children
.
insert
(
children
.
count
(),
item
);
children
.
insert
(
children
.
count
(),
item
);
};
};
void
remove
(
PLItem
*
removed
,
int
i_depth
);
PLItem
*
child
(
int
row
)
{
return
children
.
value
(
row
);
};
PLItem
*
child
(
int
row
)
{
return
children
.
value
(
row
);
};
int
childCount
()
const
{
return
children
.
count
();
};
int
childCount
()
const
{
return
children
.
count
();
};
...
...
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
53cd4ad4
...
@@ -289,8 +289,7 @@ bool PLModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
...
@@ -289,8 +289,7 @@ bool PLModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
void
PLModel
::
removeItem
(
int
i_id
)
void
PLModel
::
removeItem
(
int
i_id
)
{
{
PLItem
*
item
=
FindById
(
rootItem
,
i_id
);
PLItem
*
item
=
FindById
(
rootItem
,
i_id
);
if
(
currentItem
&&
item
&&
currentItem
->
p_input
==
item
->
p_input
)
currentItem
=
NULL
;
RemoveItem
(
item
);
if
(
item
)
item
->
remove
(
item
,
i_depth
);
}
}
/* callbacks and slots */
/* callbacks and slots */
...
@@ -756,6 +755,20 @@ void PLModel::rebuild( playlist_item_t *p_root )
...
@@ -756,6 +755,20 @@ void PLModel::rebuild( playlist_item_t *p_root )
addCallbacks
();
addCallbacks
();
}
}
void
PLModel
::
RemoveItem
(
PLItem
*
item
)
{
if
(
!
item
)
return
;
if
(
currentItem
&&
currentItem
->
p_input
==
item
->
p_input
)
{
currentItem
=
NULL
;
emit
currentChanged
(
QModelIndex
()
);
}
PLItem
*
parent
=
item
->
parentItem
;
assert
(
parent
);
int
i_index
=
parent
->
children
.
indexOf
(
item
);
parent
->
children
.
removeAt
(
i_index
);
delete
item
;
}
void
PLModel
::
RemoveChildren
(
PLItem
*
root
)
void
PLModel
::
RemoveChildren
(
PLItem
*
root
)
{
{
if
(
root
->
children
.
size
()
)
if
(
root
->
children
.
size
()
)
...
@@ -853,7 +866,7 @@ void PLModel::doDeleteItem( PLItem *item, QModelIndexList *fullList )
...
@@ -853,7 +866,7 @@ void PLModel::doDeleteItem( PLItem *item, QModelIndexList *fullList )
/* And finally, remove it from the tree */
/* And finally, remove it from the tree */
int
itemIndex
=
item
->
parentItem
->
children
.
indexOf
(
item
);
int
itemIndex
=
item
->
parentItem
->
children
.
indexOf
(
item
);
beginRemoveRows
(
index
(
item
->
parentItem
,
0
),
itemIndex
,
itemIndex
);
beginRemoveRows
(
index
(
item
->
parentItem
,
0
),
itemIndex
,
itemIndex
);
item
->
remove
(
item
,
i_depth
);
RemoveItem
(
item
);
endRemoveRows
();
endRemoveRows
();
}
}
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
53cd4ad4
...
@@ -152,6 +152,7 @@ private:
...
@@ -152,6 +152,7 @@ private:
void
doDeleteItem
(
PLItem
*
item
,
QModelIndexList
*
fullList
);
void
doDeleteItem
(
PLItem
*
item
,
QModelIndexList
*
fullList
);
void
UpdateTreeItem
(
PLItem
*
,
bool
,
bool
force
=
false
);
void
UpdateTreeItem
(
PLItem
*
,
bool
,
bool
force
=
false
);
/* The following actions will not signal the view! */
/* The following actions will not signal the view! */
void
RemoveItem
(
PLItem
*
);
void
RemoveChildren
(
PLItem
*
);
void
RemoveChildren
(
PLItem
*
);
void
UpdateChildren
(
PLItem
*
);
void
UpdateChildren
(
PLItem
*
);
void
UpdateChildren
(
playlist_item_t
*
,
PLItem
*
);
void
UpdateChildren
(
playlist_item_t
*
,
PLItem
*
);
...
...
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