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
7635e6e8
Commit
7635e6e8
authored
Aug 19, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qt4 playlist: refactor meta data retrieval and show meta title for sorting in popup menu
parent
4b800920
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
28 deletions
+27
-28
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+26
-28
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 @
7635e6e8
...
@@ -349,10 +349,6 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
...
@@ -349,10 +349,6 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
PLItem
*
item
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
());
PLItem
*
item
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
());
if
(
role
==
Qt
::
DisplayRole
)
if
(
role
==
Qt
::
DisplayRole
)
{
{
int
running_index
=
-
1
;
int
columncount
=
0
;
int
metadata
=
1
;
if
(
i_depth
==
DEPTH_SEL
)
if
(
i_depth
==
DEPTH_SEL
)
{
{
vlc_mutex_lock
(
&
item
->
p_input
->
lock
);
vlc_mutex_lock
(
&
item
->
p_input
->
lock
);
...
@@ -361,16 +357,8 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
...
@@ -361,16 +357,8 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
return
QVariant
(
returninfo
);
return
QVariant
(
returninfo
);
}
}
while
(
metadata
<
COLUMN_END
)
int
metadata
=
metaColumn
(
index
.
column
()
);
{
if
(
metadata
==
COLUMN_END
)
return
QVariant
();
if
(
i_showflags
&
metadata
)
running_index
++
;
if
(
running_index
==
index
.
column
()
)
break
;
metadata
<<=
1
;
}
if
(
running_index
!=
index
.
column
()
)
return
QVariant
();
QString
returninfo
;
QString
returninfo
;
if
(
metadata
==
COLUMN_NUMBER
)
if
(
metadata
==
COLUMN_NUMBER
)
...
@@ -378,7 +366,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
...
@@ -378,7 +366,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
else
else
{
{
char
*
psz
=
psz_column_meta
(
item
->
p_input
,
metadata
);
char
*
psz
=
psz_column_meta
(
item
->
p_input
,
metadata
);
returninfo
=
QString
(
qfu
(
psz
)
);
returninfo
=
qfu
(
psz
);
free
(
psz
);
free
(
psz
);
}
}
return
QVariant
(
returninfo
);
return
QVariant
(
returninfo
);
...
@@ -415,25 +403,16 @@ int PLModel::itemId( const QModelIndex &index ) const
...
@@ -415,25 +403,16 @@ int PLModel::itemId( const QModelIndex &index ) const
QVariant
PLModel
::
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
QVariant
PLModel
::
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
int
role
)
const
int
role
)
const
{
{
int
metadata
=
1
;
int
running_index
=-
1
;
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
(
""
)
);
if
(
i_depth
==
DEPTH_SEL
)
return
QVariant
(
QString
(
""
)
);
while
(
metadata
<
COLUMN_END
)
int
meta_col
=
metaColumn
(
section
);
{
if
(
metadata
&
i_showflags
)
running_index
++
;
if
(
running_index
==
section
)
break
;
metadata
<<=
1
;
}
if
(
running_index
!=
section
)
return
QVariant
();
if
(
meta_col
==
COLUMN_END
)
return
QVariant
();
return
QVariant
(
qfu
(
psz_column_title
(
meta
data
)
)
);
return
QVariant
(
qfu
(
psz_column_title
(
meta
_col
)
)
);
}
}
QModelIndex
PLModel
::
index
(
int
row
,
int
column
,
const
QModelIndex
&
parent
)
QModelIndex
PLModel
::
index
(
int
row
,
int
column
,
const
QModelIndex
&
parent
)
...
@@ -641,6 +620,24 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input )
...
@@ -641,6 +620,24 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input )
#undef CACHE
#undef CACHE
#undef ICACHE
#undef ICACHE
/* computes column id of meta data from visible column index */
int
PLModel
::
metaColumn
(
int
column
)
const
{
int
metadata
=
1
;
int
running_index
=
-
1
;
while
(
metadata
<
COLUMN_END
)
{
if
(
metadata
&
i_showflags
)
running_index
++
;
if
(
running_index
==
column
)
break
;
metadata
<<=
1
;
}
if
(
running_index
!=
column
)
return
COLUMN_END
;
return
metadata
;
}
/************************* Updates handling *****************************/
/************************* Updates handling *****************************/
void
PLModel
::
customEvent
(
QEvent
*
event
)
void
PLModel
::
customEvent
(
QEvent
*
event
)
...
@@ -966,7 +963,8 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
...
@@ -966,7 +963,8 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
if
(
node
)
if
(
node
)
{
{
menu
->
addSeparator
();
menu
->
addSeparator
();
QMenu
*
sort_menu
=
menu
->
addMenu
(
qtr
(
I_POP_SORT
)
);
QMenu
*
sort_menu
=
menu
->
addMenu
(
qtr
(
"Sort by "
)
+
qfu
(
psz_column_title
(
metaColumn
(
index
.
column
()
)
)
)
);
sort_menu
->
addAction
(
qtr
(
"Ascending"
),
sort_menu
->
addAction
(
qtr
(
"Ascending"
),
this
,
SLOT
(
popupSortAsc
()
)
);
this
,
SLOT
(
popupSortAsc
()
)
);
sort_menu
->
addAction
(
qtr
(
"Descending"
),
sort_menu
->
addAction
(
qtr
(
"Descending"
),
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
7635e6e8
...
@@ -164,6 +164,7 @@ private:
...
@@ -164,6 +164,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
);
int
metaColumn
(
int
column
)
const
;
PLItem
*
p_cached_item
;
PLItem
*
p_cached_item
;
PLItem
*
p_cached_item_bi
;
PLItem
*
p_cached_item_bi
;
int
i_cached_id
;
int
i_cached_id
;
...
...
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