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
a19cacad
Commit
a19cacad
authored
Aug 19, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qt4: helper function PLItem * getItem( const QModelIndex ) const
parent
40684649
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
25 deletions
+17
-25
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+16
-25
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_model.cpp
View file @
a19cacad
...
@@ -130,9 +130,7 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
...
@@ -130,9 +130,7 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
{
{
Qt
::
ItemFlags
flags
=
QAbstractItemModel
::
flags
(
index
);
Qt
::
ItemFlags
flags
=
QAbstractItemModel
::
flags
(
index
);
PLItem
*
item
=
index
.
isValid
()
?
PLItem
*
item
=
index
.
isValid
()
?
getItem
(
index
)
:
rootItem
;
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
)
:
rootItem
;
input_item_t
*
pl_input
=
p_playlist
->
p_local_category
->
p_input
;
input_item_t
*
pl_input
=
p_playlist
->
p_local_category
->
p_input
;
input_item_t
*
ml_input
=
p_playlist
->
p_ml_category
->
p_input
;
input_item_t
*
ml_input
=
p_playlist
->
p_ml_category
->
p_input
;
...
@@ -325,7 +323,7 @@ void PLModel::delCallbacks()
...
@@ -325,7 +323,7 @@ void PLModel::delCallbacks()
void
PLModel
::
activateItem
(
const
QModelIndex
&
index
)
void
PLModel
::
activateItem
(
const
QModelIndex
&
index
)
{
{
assert
(
index
.
isValid
()
);
assert
(
index
.
isValid
()
);
PLItem
*
item
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
PLItem
*
item
=
getItem
(
index
);
assert
(
item
);
assert
(
item
);
PL_LOCK
;
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
);
...
@@ -352,7 +350,7 @@ void PLModel::activateItem( playlist_item_t *p_item )
...
@@ -352,7 +350,7 @@ void PLModel::activateItem( playlist_item_t *p_item )
QVariant
PLModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
QVariant
PLModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
{
if
(
!
index
.
isValid
()
)
return
QVariant
();
if
(
!
index
.
isValid
()
)
return
QVariant
();
PLItem
*
item
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
PLItem
*
item
=
getItem
(
index
);
if
(
role
==
Qt
::
DisplayRole
)
if
(
role
==
Qt
::
DisplayRole
)
{
{
if
(
i_depth
==
DEPTH_SEL
)
if
(
i_depth
==
DEPTH_SEL
)
...
@@ -395,15 +393,13 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
...
@@ -395,15 +393,13 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
bool
PLModel
::
isCurrent
(
const
QModelIndex
&
index
)
const
bool
PLModel
::
isCurrent
(
const
QModelIndex
&
index
)
const
{
{
assert
(
index
.
isValid
()
);
if
(
!
currentItem
)
return
false
;
if
(
!
currentItem
)
return
false
;
return
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
)
->
p_input
==
currentItem
->
p_input
;
return
getItem
(
index
)
->
p_input
==
currentItem
->
p_input
;
}
}
int
PLModel
::
itemId
(
const
QModelIndex
&
index
)
const
int
PLModel
::
itemId
(
const
QModelIndex
&
index
)
const
{
{
assert
(
index
.
isValid
()
);
return
getItem
(
index
)
->
i_id
;
return
static_cast
<
PLItem
*>
(
index
.
internalPointer
())
->
i_id
;
}
}
QVariant
PLModel
::
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
QVariant
PLModel
::
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
...
@@ -424,11 +420,7 @@ QVariant PLModel::headerData( int section, Qt::Orientation orientation,
...
@@ -424,11 +420,7 @@ QVariant PLModel::headerData( int section, Qt::Orientation orientation,
QModelIndex
PLModel
::
index
(
int
row
,
int
column
,
const
QModelIndex
&
parent
)
QModelIndex
PLModel
::
index
(
int
row
,
int
column
,
const
QModelIndex
&
parent
)
const
const
{
{
PLItem
*
parentItem
;
PLItem
*
parentItem
=
parent
.
isValid
()
?
getItem
(
parent
)
:
rootItem
;
if
(
!
parent
.
isValid
()
)
parentItem
=
rootItem
;
else
parentItem
=
static_cast
<
PLItem
*>
(
parent
.
internalPointer
());
PLItem
*
childItem
=
parentItem
->
child
(
row
);
PLItem
*
childItem
=
parentItem
->
child
(
row
);
if
(
childItem
)
if
(
childItem
)
...
@@ -452,7 +444,7 @@ QModelIndex PLModel::parent( const QModelIndex &index ) const
...
@@ -452,7 +444,7 @@ QModelIndex PLModel::parent( const QModelIndex &index ) const
{
{
if
(
!
index
.
isValid
()
)
return
QModelIndex
();
if
(
!
index
.
isValid
()
)
return
QModelIndex
();
PLItem
*
childItem
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
PLItem
*
childItem
=
getItem
(
index
);
if
(
!
childItem
)
if
(
!
childItem
)
{
{
msg_Err
(
p_playlist
,
"NULL CHILD"
);
msg_Err
(
p_playlist
,
"NULL CHILD"
);
...
@@ -493,13 +485,7 @@ int PLModel::childrenCount( const QModelIndex &parent ) const
...
@@ -493,13 +485,7 @@ int PLModel::childrenCount( const QModelIndex &parent ) const
int
PLModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
int
PLModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
{
PLItem
*
parentItem
;
PLItem
*
parentItem
=
parent
.
isValid
()
?
getItem
(
parent
)
:
rootItem
;
if
(
!
parent
.
isValid
()
)
parentItem
=
rootItem
;
else
parentItem
=
static_cast
<
PLItem
*>
(
parent
.
internalPointer
());
return
parentItem
->
childCount
();
return
parentItem
->
childCount
();
}
}
...
@@ -508,8 +494,7 @@ QStringList PLModel::selectedURIs()
...
@@ -508,8 +494,7 @@ 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
++
)
{
{
PLItem
*
item
=
static_cast
<
PLItem
*>
PLItem
*
item
=
getItem
(
current_selection
[
i
]
);
(
current_selection
[
i
].
internalPointer
());
if
(
item
)
if
(
item
)
{
{
PL_LOCK
;
PL_LOCK
;
...
@@ -626,6 +611,12 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input )
...
@@ -626,6 +611,12 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input )
#undef CACHE
#undef CACHE
#undef ICACHE
#undef ICACHE
PLItem
*
PLModel
::
getItem
(
const
QModelIndex
&
index
)
const
{
assert
(
index
.
isValid
()
);
return
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
}
/* computes column id of meta data from visible column index */
/* computes column id of meta data from visible column index */
int
PLModel
::
metaColumn
(
int
column
)
const
int
PLModel
::
metaColumn
(
int
column
)
const
{
{
...
@@ -831,7 +822,7 @@ void PLModel::doDelete( QModelIndexList selected )
...
@@ -831,7 +822,7 @@ void PLModel::doDelete( QModelIndexList selected )
{
{
QModelIndex
index
=
selected
[
i
];
QModelIndex
index
=
selected
[
i
];
if
(
index
.
column
()
!=
0
)
continue
;
if
(
index
.
column
()
!=
0
)
continue
;
PLItem
*
item
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
PLItem
*
item
=
getItem
(
index
);
if
(
item
)
if
(
item
)
{
{
if
(
item
->
children
.
size
()
)
if
(
item
->
children
.
size
()
)
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
a19cacad
...
@@ -166,6 +166,7 @@ private:
...
@@ -166,6 +166,7 @@ private:
PLItem
*
FindById
(
PLItem
*
,
int
);
PLItem
*
FindById
(
PLItem
*
,
int
);
PLItem
*
FindByInput
(
PLItem
*
,
int
);
PLItem
*
FindByInput
(
PLItem
*
,
int
);
PLItem
*
FindInner
(
PLItem
*
,
int
,
bool
);
PLItem
*
FindInner
(
PLItem
*
,
int
,
bool
);
PLItem
*
getItem
(
const
QModelIndex
&
index
)
const
;
int
metaColumn
(
int
column
)
const
;
int
metaColumn
(
int
column
)
const
;
PLItem
*
p_cached_item
;
PLItem
*
p_cached_item
;
PLItem
*
p_cached_item_bi
;
PLItem
*
p_cached_item_bi
;
...
...
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