Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
d9c2006c
Commit
d9c2006c
authored
Sep 08, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: clean PLModel of i_depth related code
parent
bd7e3618
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
38 deletions
+11
-38
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+8
-35
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+2
-2
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+1
-1
No files found.
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
d9c2006c
...
@@ -64,12 +64,9 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
...
@@ -64,12 +64,9 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
playlist_item_t
*
p_root
,
playlist_item_t
*
p_root
,
/*playlist_GetPreferredNode( THEPL, THEPL->p_local_category );
/*playlist_GetPreferredNode( THEPL, THEPL->p_local_category );
and THEPL->p_root_category for SelectPL */
and THEPL->p_root_category for SelectPL */
int
_i_depth
,
/* -1 for StandPL, 1 for SelectPL */
QObject
*
parent
)
/* Basic Qt parent */
QObject
*
parent
)
/* Basic Qt parent */
:
QAbstractItemModel
(
parent
)
:
QAbstractItemModel
(
parent
)
{
{
i_depth
=
_i_depth
;
assert
(
i_depth
==
DEPTH_SEL
||
i_depth
==
DEPTH_PL
);
p_intf
=
_p_intf
;
p_intf
=
_p_intf
;
p_playlist
=
_p_playlist
;
p_playlist
=
_p_playlist
;
i_cached_id
=
-
1
;
i_cached_id
=
-
1
;
...
@@ -123,13 +120,7 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
...
@@ -123,13 +120,7 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
p_playlist
->
p_ml_category
?
p_playlist
->
p_ml_category
?
p_playlist
->
p_ml_category
->
p_input
:
NULL
;
p_playlist
->
p_ml_category
->
p_input
:
NULL
;
if
(
i_depth
==
DEPTH_SEL
)
if
(
(
pl_input
&&
rootItem
->
p_input
==
pl_input
)
||
{
if
(
(
pl_input
&&
item
->
p_input
==
pl_input
)
||
(
ml_input
&&
item
->
p_input
==
ml_input
)
)
flags
|=
Qt
::
ItemIsDropEnabled
;
}
else
if
(
(
pl_input
&&
rootItem
->
p_input
==
pl_input
)
||
(
ml_input
&&
rootItem
->
p_input
==
ml_input
)
)
(
ml_input
&&
rootItem
->
p_input
==
ml_input
)
)
{
{
PL_LOCK
;
PL_LOCK
;
...
@@ -351,14 +342,6 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
...
@@ -351,14 +342,6 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
PLItem
*
item
=
getItem
(
index
);
PLItem
*
item
=
getItem
(
index
);
if
(
role
==
Qt
::
DisplayRole
)
if
(
role
==
Qt
::
DisplayRole
)
{
{
if
(
i_depth
==
DEPTH_SEL
)
{
vlc_mutex_lock
(
&
item
->
p_input
->
lock
);
QString
returninfo
=
QString
(
qfu
(
item
->
p_input
->
psz_name
)
);
vlc_mutex_unlock
(
&
item
->
p_input
->
lock
);
return
QVariant
(
returninfo
);
}
int
metadata
=
columnToMeta
(
index
.
column
()
);
int
metadata
=
columnToMeta
(
index
.
column
()
);
if
(
metadata
==
COLUMN_END
)
return
QVariant
();
if
(
metadata
==
COLUMN_END
)
return
QVariant
();
...
@@ -406,8 +389,6 @@ QVariant PLModel::headerData( int section, Qt::Orientation orientation,
...
@@ -406,8 +389,6 @@ QVariant PLModel::headerData( int section, Qt::Orientation orientation,
if
(
orientation
!=
Qt
::
Horizontal
||
role
!=
Qt
::
DisplayRole
)
if
(
orientation
!=
Qt
::
Horizontal
||
role
!=
Qt
::
DisplayRole
)
return
QVariant
();
return
QVariant
();
if
(
i_depth
==
DEPTH_SEL
)
return
QVariant
(
QString
(
""
)
);
int
meta_col
=
columnToMeta
(
section
);
int
meta_col
=
columnToMeta
(
section
);
if
(
meta_col
==
COLUMN_END
)
return
QVariant
();
if
(
meta_col
==
COLUMN_END
)
return
QVariant
();
...
@@ -463,7 +444,7 @@ QModelIndex PLModel::parent( const QModelIndex &index ) const
...
@@ -463,7 +444,7 @@ QModelIndex PLModel::parent( const QModelIndex &index ) const
int
PLModel
::
columnCount
(
const
QModelIndex
&
i
)
const
int
PLModel
::
columnCount
(
const
QModelIndex
&
i
)
const
{
{
return
i_depth
==
DEPTH_SEL
?
1
:
columnFromMeta
(
COLUMN_END
);
return
columnFromMeta
(
COLUMN_END
);
}
}
int
PLModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
int
PLModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
...
@@ -665,7 +646,7 @@ void PLModel::processInputItemUpdate( input_item_t *p_item )
...
@@ -665,7 +646,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
);
updateTreeItem
(
item
);
}
}
void
PLModel
::
processItemRemoval
(
int
i_id
)
void
PLModel
::
processItemRemoval
(
int
i_id
)
...
@@ -688,9 +669,6 @@ void PLModel::processItemAppend( const playlist_add_t *p_add )
...
@@ -688,9 +669,6 @@ void PLModel::processItemAppend( const playlist_add_t *p_add )
PL_LOCK
;
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
&&
p_item
->
p_parent
->
i_id
!=
rootItem
->
i_id
)
goto
end
;
newItem
=
new
PLItem
(
p_item
,
nodeItem
);
newItem
=
new
PLItem
(
p_item
,
nodeItem
);
PL_UNLOCK
;
PL_UNLOCK
;
...
@@ -698,7 +676,7 @@ void PLModel::processItemAppend( const playlist_add_t *p_add )
...
@@ -698,7 +676,7 @@ void PLModel::processItemAppend( const playlist_add_t *p_add )
beginInsertRows
(
index
(
nodeItem
,
0
),
nodeItem
->
childCount
(),
nodeItem
->
childCount
()
);
beginInsertRows
(
index
(
nodeItem
,
0
),
nodeItem
->
childCount
(),
nodeItem
->
childCount
()
);
nodeItem
->
appendChild
(
newItem
);
nodeItem
->
appendChild
(
newItem
);
endInsertRows
();
endInsertRows
();
updateTreeItem
(
newItem
,
true
);
updateTreeItem
(
newItem
);
return
;
return
;
end:
end:
PL_UNLOCK
;
PL_UNLOCK
;
...
@@ -808,20 +786,15 @@ void PLModel::updateChildren( playlist_item_t *p_node, PLItem *root )
...
@@ -808,20 +786,15 @@ void PLModel::updateChildren( playlist_item_t *p_node, PLItem *root )
currentItem
=
newItem
;
currentItem
=
newItem
;
emit
currentChanged
(
index
(
currentItem
,
0
)
);
emit
currentChanged
(
index
(
currentItem
,
0
)
);
}
}
if
(
i_depth
==
DEPTH_PL
&&
p_node
->
pp_children
[
i
]
->
i_children
!=
-
1
)
if
(
p_node
->
pp_children
[
i
]
->
i_children
!=
-
1
)
updateChildren
(
p_node
->
pp_children
[
i
],
newItem
);
updateChildren
(
p_node
->
pp_children
[
i
],
newItem
);
}
}
}
}
/* Function doesn't need playlist-lock, as we don't touch playlist_item_t stuff here*/
/* 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
)
{
{
if
(
!
item
||
!
item
->
p_input
)
if
(
!
item
)
return
;
return
;
if
(
!
force
&&
i_depth
==
DEPTH_SEL
&&
item
->
parentItem
&&
item
->
parentItem
->
p_input
!=
rootItem
->
p_input
)
return
;
if
(
signal
)
emit
dataChanged
(
index
(
item
,
0
)
,
index
(
item
,
columnCount
(
QModelIndex
()
)
)
);
emit
dataChanged
(
index
(
item
,
0
)
,
index
(
item
,
columnCount
(
QModelIndex
()
)
)
);
}
}
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
d9c2006c
...
@@ -87,7 +87,7 @@ friend class PLItem;
...
@@ -87,7 +87,7 @@ friend class PLItem;
public:
public:
PLModel
(
playlist_t
*
,
intf_thread_t
*
,
PLModel
(
playlist_t
*
,
intf_thread_t
*
,
playlist_item_t
*
,
int
,
QObject
*
parent
=
0
);
playlist_item_t
*
,
QObject
*
parent
=
0
);
~
PLModel
();
~
PLModel
();
/*** QModel subclassing ***/
/*** QModel subclassing ***/
...
@@ -150,7 +150,7 @@ private:
...
@@ -150,7 +150,7 @@ private:
/* Actions */
/* Actions */
void
recurseDelete
(
QList
<
PLItem
*>
children
,
QModelIndexList
*
fullList
);
void
recurseDelete
(
QList
<
PLItem
*>
children
,
QModelIndexList
*
fullList
);
void
doDeleteItem
(
PLItem
*
item
,
QModelIndexList
*
fullList
);
void
doDeleteItem
(
PLItem
*
item
,
QModelIndexList
*
fullList
);
void
updateTreeItem
(
PLItem
*
,
bool
,
bool
force
=
false
);
void
updateTreeItem
(
PLItem
*
);
void
takeItem
(
PLItem
*
);
//will not delete item
void
takeItem
(
PLItem
*
);
//will not delete item
void
insertChildren
(
PLItem
*
node
,
QList
<
PLItem
*>&
items
,
int
i_pos
);
void
insertChildren
(
PLItem
*
node
,
QList
<
PLItem
*>&
items
,
int
i_pos
);
void
dropAppendCopy
(
QByteArray
&
data
,
PLItem
*
target
);
void
dropAppendCopy
(
QByteArray
&
data
,
PLItem
*
target
);
...
...
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
d9c2006c
...
@@ -54,7 +54,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
...
@@ -54,7 +54,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
playlist_item_t
*
p_root
)
:
playlist_item_t
*
p_root
)
:
PLPanel
(
_parent
,
_p_intf
)
PLPanel
(
_parent
,
_p_intf
)
{
{
model
=
new
PLModel
(
p_playlist
,
p_intf
,
p_root
,
-
1
,
this
);
model
=
new
PLModel
(
p_playlist
,
p_intf
,
p_root
,
this
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
layout
->
setSpacing
(
0
);
layout
->
setMargin
(
0
);
layout
->
setSpacing
(
0
);
layout
->
setMargin
(
0
);
...
...
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