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
00d1ebdf
Commit
00d1ebdf
authored
Dec 29, 2010
by
Srikanth Raju
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt/ML: Extend Playlist model from VLCModel
parent
ed89fe73
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
53 deletions
+36
-53
modules/gui/qt4/components/playlist/playlist_item.hpp
modules/gui/qt4/components/playlist/playlist_item.hpp
+2
-2
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+20
-33
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+14
-18
No files found.
modules/gui/qt4/components/playlist/playlist_item.hpp
View file @
00d1ebdf
...
...
@@ -49,11 +49,11 @@ public:
void
removeChildren
();
void
takeChildAt
(
int
);
PLItem
*
child
(
int
row
)
{
return
children
.
value
(
row
);
}
PLItem
*
child
(
int
row
)
const
{
return
children
.
value
(
row
);
}
int
childCount
()
const
{
return
children
.
count
();
}
PLItem
*
parent
()
{
return
parentItem
;
}
input_item_t
*
inputItem
()
{
return
p_input
;
}
input_item_t
*
inputItem
()
const
{
return
p_input
;
}
int
id
()
{
return
i_id
;
}
bool
operator
<
(
PLItem
&
);
...
...
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
00d1ebdf
...
...
@@ -66,9 +66,8 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
intf_thread_t
*
_p_intf
,
/* main Qt p_intf */
playlist_item_t
*
p_root
,
QObject
*
parent
)
/* Basic Qt parent */
:
QAbstractItemModel
(
parent
)
:
VLCModel
(
_p_intf
,
parent
)
{
p_intf
=
_p_intf
;
p_playlist
=
_p_playlist
;
i_cached_id
=
-
1
;
i_cached_input_id
=
-
1
;
...
...
@@ -338,6 +337,21 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
QString
returninfo
;
if
(
metadata
==
COLUMN_NUMBER
)
returninfo
=
QString
::
number
(
index
.
row
()
+
1
);
else
if
(
metadata
==
COLUMN_COVER
)
{
QString
artUrl
;
artUrl
=
InputManager
::
decodeArtURL
(
item
->
inputItem
()
);
if
(
artUrl
.
isEmpty
()
)
{
for
(
int
i
=
0
;
i
<
item
->
childCount
();
i
++
)
{
artUrl
=
InputManager
::
decodeArtURL
(
item
->
child
(
i
)
->
inputItem
()
);
if
(
!
artUrl
.
isEmpty
()
)
break
;
}
}
return
QVariant
(
artUrl
);
}
else
{
char
*
psz
=
psz_column_meta
(
item
->
p_input
,
metadata
);
...
...
@@ -558,34 +572,6 @@ PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input ) const
return
NULL
;
}
int
PLModel
::
columnToMeta
(
int
_column
)
{
int
meta
=
1
;
int
column
=
0
;
while
(
column
!=
_column
&&
meta
!=
COLUMN_END
)
{
meta
<<=
1
;
column
++
;
}
return
meta
;
}
int
PLModel
::
columnFromMeta
(
int
meta_col
)
{
int
meta
=
1
;
int
column
=
0
;
while
(
meta
!=
meta_col
&&
meta
!=
COLUMN_END
)
{
meta
<<=
1
;
column
++
;
}
return
column
;
}
bool
PLModel
::
canEdit
()
const
{
return
(
...
...
@@ -601,11 +587,12 @@ bool PLModel::canEdit() const
QString
PLModel
::
getMeta
(
const
QModelIndex
&
index
,
int
meta
)
{
return
index
.
model
()
->
index
(
index
.
row
(),
PLModel
::
columnFromMeta
(
meta
),
index
.
parent
()
)
.
data
().
toString
();
columnFromMeta
(
meta
),
index
.
parent
()
)
.
data
().
toString
();
}
QPixmap
PLModel
::
getArtPixmap
(
const
QModelIndex
&
index
,
const
QSize
&
size
)
{
PLItem
*
item
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
00d1ebdf
...
...
@@ -29,13 +29,14 @@
# include "config.h"
#endif
#include "qt4.hpp"
#include <vlc_input.h>
#include <vlc_playlist.h>
#include "vlc_model.hpp"
#include "playlist_item.hpp"
#include <QObject>
#include <QEvent>
#include <QSignalMapper>
#include <QMimeData>
#include <QAbstractItemModel>
#include <QVariant>
...
...
@@ -46,20 +47,14 @@ class PLSelector;
class
PlMimeData
;
class
QSignalMapper
;
class
PLModel
:
public
QAbstractItem
Model
class
PLModel
:
public
VLC
Model
{
Q_OBJECT
public:
enum
{
IsCurrentRole
=
Qt
::
UserRole
,
IsLeafNodeRole
,
IsCurrentsParentNodeRole
};
PLModel
(
playlist_t
*
,
intf_thread_t
*
,
playlist_item_t
*
,
QObject
*
parent
=
0
);
~
PLModel
();
virtual
~
PLModel
();
/*** QModel subclassing ***/
...
...
@@ -86,18 +81,16 @@ public:
QStringList
selectedURIs
();
QModelIndex
index
(
PLItem
*
,
const
int
c
)
const
;
QModelIndex
index
(
const
int
i_id
,
const
int
c
);
QModelIndex
currentIndex
()
const
;
virtual
QModelIndex
currentIndex
()
const
;
bool
isParent
(
const
QModelIndex
&
index
,
const
QModelIndex
&
current
)
const
;
bool
isCurrent
(
const
QModelIndex
&
index
)
const
;
int
itemId
(
const
QModelIndex
&
index
)
const
;
static
int
columnFromMeta
(
int
meta_column
);
static
int
columnToMeta
(
int
column
);
static
QString
getMeta
(
const
QModelIndex
&
index
,
int
meta
);
static
QPixmap
getArtPixmap
(
const
QModelIndex
&
index
,
const
QSize
&
size
);
static
QString
getMeta
(
const
QModelIndex
&
index
,
int
meta
);
/* Actions */
bool
popup
(
const
QModelIndex
&
index
,
const
QPoint
&
point
,
const
QModelIndexList
&
list
);
virtual
bool
popup
(
const
QModelIndex
&
index
,
const
QPoint
&
point
,
const
QModelIndexList
&
list
);
void
doDelete
(
QModelIndexList
selected
);
void
search
(
const
QString
&
search_text
,
const
QModelIndex
&
root
,
bool
b_recursive
);
void
sort
(
const
int
column
,
Qt
::
SortOrder
order
);
...
...
@@ -111,13 +104,17 @@ public:
return
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
else
return
rootItem
;
}
virtual
int
getId
(
QModelIndex
index
)
const
{
return
getItem
(
index
)
->
id
();
}
signals:
void
currentChanged
(
const
QModelIndex
&
);
void
rootChanged
();
public
slots
:
void
activateItem
(
const
QModelIndex
&
index
);
v
irtual
v
oid
activateItem
(
const
QModelIndex
&
index
);
void
activateItem
(
playlist_item_t
*
p_item
);
private:
...
...
@@ -125,7 +122,6 @@ private:
PLItem
*
rootItem
;
playlist_t
*
p_playlist
;
intf_thread_t
*
p_intf
;
static
QIcon
icons
[
ITEM_TYPE_NUMBER
];
...
...
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