Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
1c55acae
Commit
1c55acae
authored
Sep 03, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: using correctly setSource with playlist_items
And correct decoration.
parent
6ea7535a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
7 deletions
+53
-7
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/selector.cpp
+47
-7
modules/gui/qt4/components/playlist/selector.hpp
modules/gui/qt4/components/playlist/selector.hpp
+6
-0
No files found.
modules/gui/qt4/components/playlist/selector.cpp
View file @
1c55acae
/*****************************************************************************
* selector.cpp : Playlist source selector
****************************************************************************
* Copyright (C) 200
0-2005
the VideoLAN team
* Copyright (C) 200
6-2009
the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Jean-Baptiste Kempf
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -35,6 +36,7 @@
#include <QTreeWidget>
#include <vlc_playlist.h>
#include <vlc_services_discovery.h>
PLSelector
::
PLSelector
(
QWidget
*
p
,
intf_thread_t
*
_p_intf
)
:
QWidget
(
p
),
p_intf
(
_p_intf
)
{
...
...
@@ -42,8 +44,9 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p ), p_i
view
=
new
QTreeWidget
;
view
->
setIconSize
(
QSize
(
24
,
24
)
);
// view->setAlternatingRowColors( true );
view
->
setIndentation
(
0
);
view
->
setIndentation
(
1
0
);
view
->
header
()
->
hide
();
view
->
setRootIsDecorated
(
false
);
// view->setModel( model );
view
->
setAcceptDrops
(
true
);
...
...
@@ -67,12 +70,30 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p ), p_i
void
PLSelector
::
setSource
(
QTreeWidgetItem
*
item
)
{
if
(
item
)
if
(
!
item
)
return
;
int
i_type
=
item
->
data
(
0
,
Qt
::
UserRole
).
toInt
();
if
(
i_type
==
SD_TYPE
)
{
QString
qs
=
item
->
data
(
0
,
Qt
::
UserRole
+
1
).
toString
();
if
(
!
playlist_IsServicesDiscoveryLoaded
(
THEPL
,
qtu
(
qs
)
)
)
{
playlist_ServicesDiscoveryAdd
(
THEPL
,
qtu
(
qs
)
);
//FIXME we should return the playlist_item_t;
emit
NULL
;
}
}
else
if
(
i_type
==
PL_TYPE
||
i_type
==
ML_TYPE
)
{
playlist_item_t
*
pl_item
=
item
->
data
(
0
,
Qt
::
UserRole
).
value
<
playlist_item_t
*>
();
emit
activated
(
pl_item
);
item
->
data
(
0
,
Qt
::
UserRole
+
1
).
value
<
playlist_item_t
*>
();
if
(
pl_item
)
emit
activated
(
pl_item
);
}
else
assert
(
0
);
}
void
PLSelector
::
createItems
()
...
...
@@ -80,18 +101,37 @@ void PLSelector::createItems()
assert
(
view
);
QTreeWidgetItem
*
pl
=
new
QTreeWidgetItem
(
view
);
pl
->
setText
(
0
,
qtr
(
"Playlist"
)
);
pl
->
setData
(
0
,
Qt
::
UserRole
,
QVariant
::
fromValue
(
THEPL
->
p_local_category
)
);
pl
->
setData
(
0
,
Qt
::
UserRole
,
PL_TYPE
);
pl
->
setData
(
0
,
Qt
::
UserRole
+
1
,
QVariant
::
fromValue
(
THEPL
->
p_local_category
)
);
/* QTreeWidgetItem *empty = new QTreeWidgetItem( view );
empty->setFlags(Qt::NoItemFlags);
*/
QTreeWidgetItem
*
lib
=
new
QTreeWidgetItem
(
view
);
lib
->
setText
(
0
,
qtr
(
"Library"
)
);
lib
->
setData
(
0
,
Qt
::
UserRole
,
QVariant
::
fromValue
(
THEPL
->
p_ml_category
)
);
lib
->
setData
(
0
,
Qt
::
UserRole
,
ML_TYPE
);
lib
->
setData
(
0
,
Qt
::
UserRole
+
1
,
QVariant
::
fromValue
(
THEPL
->
p_ml_category
)
);
/*
QTreeWidgetItem *empty2 = new QTreeWidgetItem( view );
empty2->setFlags(Qt::NoItemFlags);*/
QTreeWidgetItem
*
sds
=
new
QTreeWidgetItem
(
view
);
sds
->
setExpanded
(
true
);
sds
->
setText
(
0
,
qtr
(
"Libraries"
)
);
char
**
ppsz_longnames
;
char
**
ppsz_names
=
vlc_sd_GetNames
(
&
ppsz_longnames
);
if
(
!
ppsz_names
)
return
;
char
**
ppsz_name
=
ppsz_names
,
**
ppsz_longname
=
ppsz_longnames
;
QTreeWidgetItem
*
sd_item
;
for
(
;
*
ppsz_name
;
ppsz_name
++
,
ppsz_longname
++
)
{
sd_item
=
new
QTreeWidgetItem
(
QStringList
(
*
ppsz_longname
)
);
sd_item
->
setData
(
0
,
Qt
::
UserRole
,
SD_TYPE
);
sd_item
->
setData
(
0
,
Qt
::
UserRole
+
1
,
qfu
(
*
ppsz_name
)
);
sds
->
addChild
(
sd_item
);
}
}
PLSelector
::~
PLSelector
()
...
...
modules/gui/qt4/components/playlist/selector.hpp
View file @
1c55acae
...
...
@@ -36,6 +36,12 @@
class
QTreeWidget
;
class
PlaylistWidget
;
enum
{
PL_TYPE
,
ML_TYPE
,
SD_TYPE
,
};
Q_DECLARE_METATYPE
(
playlist_item_t
*
);
class
PLSelector
:
public
QWidget
{
...
...
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