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
c7853345
Commit
c7853345
authored
Sep 08, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: make PLSelector a subclass of QTreeWidget
parent
166581b3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
21 deletions
+11
-21
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/selector.cpp
+9
-17
modules/gui/qt4/components/playlist/selector.hpp
modules/gui/qt4/components/playlist/selector.hpp
+2
-4
No files found.
modules/gui/qt4/components/playlist/selector.cpp
View file @
c7853345
...
@@ -39,33 +39,26 @@
...
@@ -39,33 +39,26 @@
#include <vlc_services_discovery.h>
#include <vlc_services_discovery.h>
PLSelector
::
PLSelector
(
QWidget
*
p
,
intf_thread_t
*
_p_intf
)
PLSelector
::
PLSelector
(
QWidget
*
p
,
intf_thread_t
*
_p_intf
)
:
QWidget
(
p
),
p_intf
(
_p_intf
)
:
Q
Tree
Widget
(
p
),
p_intf
(
_p_intf
)
{
{
view
=
new
QTreeWidget
;
setIconSize
(
QSize
(
24
,
24
)
);
view
->
setIconSize
(
QSize
(
24
,
24
)
);
// view->setAlternatingRowColors( true );
// view->setAlternatingRowColors( true );
view
->
setIndentation
(
10
);
setIndentation
(
10
);
view
->
header
()
->
hide
();
header
()
->
hide
();
view
->
setRootIsDecorated
(
false
);
setRootIsDecorated
(
false
);
// model = new PLModel( THEPL, p_intf, THEPL->p_root_category, 1, this );
// model = new PLModel( THEPL, p_intf, THEPL->p_root_category, 1, this );
// view->setModel( model );
// view->setModel( model );
// view->setAcceptDrops(true);
// view->setAcceptDrops(true);
// view->setDropIndicatorShown(true);
// view->setDropIndicatorShown(true);
createItems
();
createItems
();
CONNECT
(
view
,
itemActivated
(
QTreeWidgetItem
*
,
int
),
CONNECT
(
this
,
itemActivated
(
QTreeWidgetItem
*
,
int
),
this
,
setSource
(
QTreeWidgetItem
*
)
);
this
,
setSource
(
QTreeWidgetItem
*
)
);
/* I believe this is unnecessary, seeing
/* I believe this is unnecessary, seeing
QStyle::SH_ItemView_ActivateItemOnSingleClick
QStyle::SH_ItemView_ActivateItemOnSingleClick
CONNECT( view, itemClicked( QTreeWidgetItem *, int ),
CONNECT( view, itemClicked( QTreeWidgetItem *, int ),
this, setSource( QTreeWidgetItem *) ); */
this, setSource( QTreeWidgetItem *) ); */
QVBoxLayout
*
layout
=
new
QVBoxLayout
;
layout
->
setSpacing
(
0
);
layout
->
setMargin
(
0
);
layout
->
addWidget
(
view
);
setLayout
(
layout
);
/* select the first item */
/* select the first item */
// view->setCurrentIndex( model->index( 0, 0, QModelIndex() ) );
// view->setCurrentIndex( model->index( 0, 0, QModelIndex() ) );
}
}
...
@@ -105,8 +98,7 @@ void PLSelector::setSource( QTreeWidgetItem *item )
...
@@ -105,8 +98,7 @@ void PLSelector::setSource( QTreeWidgetItem *item )
void
PLSelector
::
createItems
()
void
PLSelector
::
createItems
()
{
{
assert
(
view
);
QTreeWidgetItem
*
pl
=
new
QTreeWidgetItem
(
this
);
QTreeWidgetItem
*
pl
=
new
QTreeWidgetItem
(
view
);
pl
->
setText
(
0
,
qtr
(
"Playlist"
)
);
pl
->
setText
(
0
,
qtr
(
"Playlist"
)
);
pl
->
setData
(
0
,
TYPE_ROLE
,
PL_TYPE
);
pl
->
setData
(
0
,
TYPE_ROLE
,
PL_TYPE
);
pl
->
setData
(
0
,
PPL_ITEM_ROLE
,
QVariant
::
fromValue
(
THEPL
->
p_local_category
)
);
pl
->
setData
(
0
,
PPL_ITEM_ROLE
,
QVariant
::
fromValue
(
THEPL
->
p_local_category
)
);
...
@@ -114,7 +106,7 @@ void PLSelector::createItems()
...
@@ -114,7 +106,7 @@ void PLSelector::createItems()
/* QTreeWidgetItem *empty = new QTreeWidgetItem( view );
/* QTreeWidgetItem *empty = new QTreeWidgetItem( view );
empty->setFlags(Qt::NoItemFlags); */
empty->setFlags(Qt::NoItemFlags); */
QTreeWidgetItem
*
lib
=
new
QTreeWidgetItem
(
view
);
QTreeWidgetItem
*
lib
=
new
QTreeWidgetItem
(
this
);
lib
->
setText
(
0
,
qtr
(
"Library"
)
);
lib
->
setText
(
0
,
qtr
(
"Library"
)
);
lib
->
setData
(
0
,
TYPE_ROLE
,
ML_TYPE
);
lib
->
setData
(
0
,
TYPE_ROLE
,
ML_TYPE
);
lib
->
setData
(
0
,
PPL_ITEM_ROLE
,
QVariant
::
fromValue
(
THEPL
->
p_ml_category
)
);
lib
->
setData
(
0
,
PPL_ITEM_ROLE
,
QVariant
::
fromValue
(
THEPL
->
p_ml_category
)
);
...
@@ -122,7 +114,7 @@ void PLSelector::createItems()
...
@@ -122,7 +114,7 @@ void PLSelector::createItems()
/* QTreeWidgetItem *empty2 = new QTreeWidgetItem( view );
/* QTreeWidgetItem *empty2 = new QTreeWidgetItem( view );
empty2->setFlags(Qt::NoItemFlags);*/
empty2->setFlags(Qt::NoItemFlags);*/
QTreeWidgetItem
*
sds
=
new
QTreeWidgetItem
(
view
);
QTreeWidgetItem
*
sds
=
new
QTreeWidgetItem
(
this
);
sds
->
setExpanded
(
true
);
sds
->
setExpanded
(
true
);
sds
->
setText
(
0
,
qtr
(
"Libraries"
)
);
sds
->
setText
(
0
,
qtr
(
"Libraries"
)
);
...
...
modules/gui/qt4/components/playlist/selector.hpp
View file @
c7853345
...
@@ -29,14 +29,13 @@
...
@@ -29,14 +29,13 @@
# include "config.h"
# include "config.h"
#endif
#endif
#include <QWidget>
#include <Q
Tree
Widget>
#include <QTreeWidgetItem>
#include <QTreeWidgetItem>
#include <vlc_playlist.h>
#include <vlc_playlist.h>
#include "qt4.hpp"
#include "qt4.hpp"
class
QTreeWidget
;
class
PlaylistWidget
;
class
PlaylistWidget
;
enum
{
enum
{
...
@@ -52,7 +51,7 @@ enum {
...
@@ -52,7 +51,7 @@ enum {
};
};
Q_DECLARE_METATYPE
(
playlist_item_t
*
);
Q_DECLARE_METATYPE
(
playlist_item_t
*
);
class
PLSelector
:
public
QWidget
class
PLSelector
:
public
Q
Tree
Widget
{
{
Q_OBJECT
;
Q_OBJECT
;
public:
public:
...
@@ -62,7 +61,6 @@ protected:
...
@@ -62,7 +61,6 @@ protected:
friend
class
PlaylistWidget
;
friend
class
PlaylistWidget
;
private:
private:
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
QTreeWidget
*
view
;
void
createItems
();
void
createItems
();
private
slots
:
private
slots
:
void
setSource
(
QTreeWidgetItem
*
item
);
void
setSource
(
QTreeWidgetItem
*
item
);
...
...
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