Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
25bbccd3
Commit
25bbccd3
authored
Aug 16, 2009
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qt4: try to minimise time code keeps playlist global lock in playlist_model
parent
37f2e008
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+16
-17
No files found.
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
25bbccd3
...
@@ -528,11 +528,11 @@ QStringList PLModel::selectedURIs()
...
@@ -528,11 +528,11 @@ QStringList PLModel::selectedURIs()
QStringList
lst
;
QStringList
lst
;
for
(
int
i
=
0
;
i
<
current_selection
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
current_selection
.
size
();
i
++
)
{
{
PL_LOCK
;
PLItem
*
item
=
static_cast
<
PLItem
*>
PLItem
*
item
=
static_cast
<
PLItem
*>
(
current_selection
[
i
].
internalPointer
());
(
current_selection
[
i
].
internalPointer
());
if
(
item
)
if
(
item
)
{
{
PL_LOCK
;
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_playlist
,
item
->
i_id
);
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_playlist
,
item
->
i_id
);
if
(
p_item
)
if
(
p_item
)
{
{
...
@@ -543,9 +543,9 @@ QStringList PLModel::selectedURIs()
...
@@ -543,9 +543,9 @@ QStringList PLModel::selectedURIs()
free
(
psz
);
free
(
psz
);
}
}
}
}
}
PL_UNLOCK
;
PL_UNLOCK
;
}
}
}
return
lst
;
return
lst
;
}
}
...
@@ -686,11 +686,7 @@ void PLModel::ProcessInputItemUpdate( input_item_t *p_item )
...
@@ -686,11 +686,7 @@ void PLModel::ProcessInputItemUpdate( input_item_t *p_item )
if
(
!
p_item
||
p_item
->
i_id
<=
0
)
return
;
if
(
!
p_item
||
p_item
->
i_id
<=
0
)
return
;
PLItem
*
item
=
FindByInput
(
rootItem
,
p_item
->
i_id
);
PLItem
*
item
=
FindByInput
(
rootItem
,
p_item
->
i_id
);
if
(
item
)
if
(
item
)
{
UpdateTreeItem
(
item
,
true
,
true
);
QPL_LOCK
;
UpdateTreeItem
(
item
,
true
);
QPL_UNLOCK
;
}
}
}
void
PLModel
::
ProcessItemRemoval
(
int
i_id
)
void
PLModel
::
ProcessItemRemoval
(
int
i_id
)
...
@@ -708,9 +704,9 @@ void PLModel::ProcessItemAppend( const playlist_add_t *p_add )
...
@@ -708,9 +704,9 @@ void PLModel::ProcessItemAppend( const playlist_add_t *p_add )
PLItem
*
newItem
=
NULL
;
PLItem
*
newItem
=
NULL
;
PLItem
*
nodeItem
=
FindById
(
rootItem
,
p_add
->
i_node
);
PLItem
*
nodeItem
=
FindById
(
rootItem
,
p_add
->
i_node
);
PL_LOCK
;
if
(
!
nodeItem
)
return
;
if
(
!
nodeItem
)
goto
end
;
PL_LOCK
;
p_item
=
playlist_ItemGetById
(
p_playlist
,
p_add
->
i_item
);
p_item
=
playlist_ItemGetById
(
p_playlist
,
p_add
->
i_item
);
if
(
!
p_item
||
p_item
->
i_flags
&
PLAYLIST_DBL_FLAG
)
goto
end
;
if
(
!
p_item
||
p_item
->
i_flags
&
PLAYLIST_DBL_FLAG
)
goto
end
;
if
(
i_depth
==
DEPTH_SEL
&&
p_item
->
p_parent
&&
if
(
i_depth
==
DEPTH_SEL
&&
p_item
->
p_parent
&&
...
@@ -718,12 +714,15 @@ void PLModel::ProcessItemAppend( const playlist_add_t *p_add )
...
@@ -718,12 +714,15 @@ void PLModel::ProcessItemAppend( const playlist_add_t *p_add )
goto
end
;
goto
end
;
newItem
=
new
PLItem
(
p_item
,
nodeItem
);
newItem
=
new
PLItem
(
p_item
,
nodeItem
);
PL_UNLOCK
;
emit
layoutAboutToBeChanged
();
emit
layoutAboutToBeChanged
();
emit
beginInsertRows
(
index
(
newItem
,
0
),
nodeItem
->
childCount
(),
nodeItem
->
childCount
()
+
1
);
emit
beginInsertRows
(
index
(
newItem
,
0
),
nodeItem
->
childCount
(),
nodeItem
->
childCount
()
+
1
);
nodeItem
->
appendChild
(
newItem
);
nodeItem
->
appendChild
(
newItem
);
emit
endInsertRows
();
emit
endInsertRows
();
emit
layoutChanged
();
emit
layoutChanged
();
UpdateTreeItem
(
newItem
,
true
);
UpdateTreeItem
(
newItem
,
true
);
return
;
end:
end:
PL_UNLOCK
;
PL_UNLOCK
;
return
;
return
;
...
@@ -745,7 +744,6 @@ void PLModel::rebuild( playlist_item_t *p_root )
...
@@ -745,7 +744,6 @@ void PLModel::rebuild( playlist_item_t *p_root )
emit
layoutAboutToBeChanged
();
emit
layoutAboutToBeChanged
();
PL_LOCK
;
/* Clear the tree */
/* Clear the tree */
if
(
rootItem
)
if
(
rootItem
)
{
{
...
@@ -758,6 +756,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
...
@@ -758,6 +756,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
emit
endRemoveRows
();
emit
endRemoveRows
();
}
}
}
}
PL_LOCK
;
if
(
p_root
)
if
(
p_root
)
{
{
delete
rootItem
;
delete
rootItem
;
...
@@ -811,14 +810,13 @@ void PLModel::UpdateNodeChildren( playlist_item_t *p_node, PLItem *root )
...
@@ -811,14 +810,13 @@ void PLModel::UpdateNodeChildren( playlist_item_t *p_node, PLItem *root )
}
}
}
}
/*
This function must be entered WITH the playlist lock
*/
/*
Function doesn't need playlist-lock, as we don't touch playlist_item_t stuff here
*/
void
PLModel
::
UpdateTreeItem
(
PLItem
*
item
,
bool
signal
,
bool
force
)
void
PLModel
::
UpdateTreeItem
(
PLItem
*
item
,
bool
signal
,
bool
force
)
{
{
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_playlist
,
item
->
i_id
);
if
(
!
item
||
!
item
->
p_input
)
if
(
!
p_item
)
return
;
return
;
if
(
!
force
&&
i_depth
==
DEPTH_SEL
&&
p_item
->
p_parent
&&
if
(
!
force
&&
i_depth
==
DEPTH_SEL
&&
item
->
parentItem
&&
p_item
->
p_parent
->
i_id
!=
rootItem
->
i_id
)
item
->
parentItem
->
p_input
!=
rootItem
->
p_input
)
return
;
return
;
if
(
signal
)
if
(
signal
)
emit
dataChanged
(
index
(
item
,
0
)
,
index
(
item
,
columnCount
(
QModelIndex
()
)
)
);
emit
dataChanged
(
index
(
item
,
0
)
,
index
(
item
,
columnCount
(
QModelIndex
()
)
)
);
...
@@ -876,12 +874,12 @@ void PLModel::doDeleteItem( PLItem *item, QModelIndexList *fullList )
...
@@ -876,12 +874,12 @@ void PLModel::doDeleteItem( PLItem *item, QModelIndexList *fullList )
playlist_DeleteFromInput
(
p_playlist
,
p_item
->
p_input
,
pl_Locked
);
playlist_DeleteFromInput
(
p_playlist
,
p_item
->
p_input
,
pl_Locked
);
else
else
playlist_NodeDelete
(
p_playlist
,
p_item
,
true
,
false
);
playlist_NodeDelete
(
p_playlist
,
p_item
,
true
,
false
);
PL_UNLOCK
;
/* And finally, remove it from the tree */
/* And finally, remove it from the tree */
emit
beginRemoveRows
(
index
(
item
->
parentItem
,
0
),
item
->
parentItem
->
children
.
indexOf
(
item
),
emit
beginRemoveRows
(
index
(
item
->
parentItem
,
0
),
item
->
parentItem
->
children
.
indexOf
(
item
),
item
->
parentItem
->
children
.
indexOf
(
item
)
+
1
);
item
->
parentItem
->
children
.
indexOf
(
item
)
+
1
);
item
->
remove
(
item
,
i_depth
);
item
->
remove
(
item
,
i_depth
);
emit
endRemoveRows
();
emit
endRemoveRows
();
PL_UNLOCK
;
}
}
/******* Volume III: Sorting and searching ********/
/******* Volume III: Sorting and searching ********/
...
@@ -1039,7 +1037,8 @@ void PLModel::popupInfo()
...
@@ -1039,7 +1037,8 @@ void PLModel::popupInfo()
mid
->
setParent
(
PlaylistDialog
::
getInstance
(
p_intf
),
mid
->
setParent
(
PlaylistDialog
::
getInstance
(
p_intf
),
Qt
::
Dialog
);
Qt
::
Dialog
);
mid
->
show
();
mid
->
show
();
}
}
else
PL_UNLOCK
;
}
}
void
PLModel
::
popupStream
()
void
PLModel
::
popupStream
()
...
...
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