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
4ed4e121
Commit
4ed4e121
authored
Nov 07, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: more media browser (PL Selector) beautification
parent
bc157d87
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
470 additions
and
85 deletions
+470
-85
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/playlist.cpp
+60
-1
modules/gui/qt4/components/playlist/playlist.hpp
modules/gui/qt4/components/playlist/playlist.hpp
+35
-0
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/selector.cpp
+295
-72
modules/gui/qt4/components/playlist/selector.hpp
modules/gui/qt4/components/playlist/selector.hpp
+78
-11
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+2
-1
No files found.
modules/gui/qt4/components/playlist/playlist.cpp
View file @
4ed4e121
...
@@ -33,6 +33,9 @@
...
@@ -33,6 +33,9 @@
#include "input_manager.hpp"
/* art signal */
#include "input_manager.hpp"
/* art signal */
#include "main_interface.hpp"
/* DropEvent TODO remove this*/
#include "main_interface.hpp"
/* DropEvent TODO remove this*/
#include <QGroupBox>
#include <iostream>
/**********************************************************************
/**********************************************************************
* Playlist Widget. The embedded playlist
* Playlist Widget. The embedded playlist
**********************************************************************/
**********************************************************************/
...
@@ -46,7 +49,12 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) : p_intf ( _p_i )
...
@@ -46,7 +49,12 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) : p_intf ( _p_i )
/* Source Selector */
/* Source Selector */
selector
=
new
PLSelector
(
this
,
p_intf
);
selector
=
new
PLSelector
(
this
,
p_intf
);
leftW
->
addWidget
(
selector
);
QVBoxLayout
*
selBox
=
new
QVBoxLayout
();
selBox
->
setContentsMargins
(
0
,
5
,
0
,
0
);
selBox
->
addWidget
(
selector
);
QGroupBox
*
selGroup
=
new
QGroupBox
(
qtr
(
"Media Browser"
)
);
selGroup
->
setLayout
(
selBox
);
leftW
->
addWidget
(
selGroup
);
/* Create a Container for the Art Label
/* Create a Container for the Art Label
in order to have a beautiful resizing for the selector above it */
in order to have a beautiful resizing for the selector above it */
...
@@ -140,3 +148,54 @@ void PlaylistWidget::closeEvent( QCloseEvent *event )
...
@@ -140,3 +148,54 @@ void PlaylistWidget::closeEvent( QCloseEvent *event )
event
->
ignore
();
event
->
ignore
();
}
}
}
}
PlaylistEventManager
::
PlaylistEventManager
(
playlist_t
*
_pl
)
:
pl
(
_pl
)
{
var_AddCallback
(
pl
,
"playlist-item-append"
,
itemAddedCb
,
this
);
var_AddCallback
(
pl
,
"playlist-item-deleted"
,
itemRemovedCb
,
this
);
}
PlaylistEventManager
::~
PlaylistEventManager
()
{
var_DelCallback
(
pl
,
"playlist-item-append"
,
itemAddedCb
,
this
);
var_DelCallback
(
pl
,
"playlist-item-deleted"
,
itemRemovedCb
,
this
);
}
int
PlaylistEventManager
::
itemAddedCb
(
vlc_object_t
*
obj
,
const
char
*
var
,
vlc_value_t
old
,
vlc_value_t
cur
,
void
*
data
)
{
PlaylistEventManager
*
p_this
=
static_cast
<
PlaylistEventManager
*>
(
data
);
p_this
->
trigger
(
cur
,
ItemAddedEv
);
return
VLC_SUCCESS
;
}
int
PlaylistEventManager
::
itemRemovedCb
(
vlc_object_t
*
obj
,
const
char
*
var
,
vlc_value_t
old
,
vlc_value_t
cur
,
void
*
data
)
{
PlaylistEventManager
*
p_this
=
static_cast
<
PlaylistEventManager
*>
(
data
);
p_this
->
trigger
(
cur
,
ItemRemovedEv
);
return
VLC_SUCCESS
;
}
void
PlaylistEventManager
::
trigger
(
vlc_value_t
val
,
int
type
)
{
if
(
type
==
ItemAddedEv
)
{
playlist_add_t
*
p_add
=
static_cast
<
playlist_add_t
*>
(
val
.
p_address
);
QApplication
::
postEvent
(
this
,
new
PLEMEvent
(
type
,
p_add
->
i_item
,
p_add
->
i_node
)
);
}
else
{
QApplication
::
postEvent
(
this
,
new
PLEMEvent
(
type
,
val
.
i_int
,
0
)
);
}
}
void
PlaylistEventManager
::
customEvent
(
QEvent
*
e
)
{
PLEMEvent
*
ev
=
static_cast
<
PLEMEvent
*>
(
e
);
if
(
(
int
)
ev
->
type
()
==
ItemAddedEv
)
emit
itemAdded
(
ev
->
item
,
ev
->
parent
);
else
emit
itemRemoved
(
ev
->
item
);
}
modules/gui/qt4/components/playlist/playlist.hpp
View file @
4ed4e121
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include "dialogs_provider.hpp"
/* Media Info from ArtLabel */
#include "dialogs_provider.hpp"
/* Media Info from ArtLabel */
#include "components/interface_widgets.hpp"
#include "components/interface_widgets.hpp"
//#include <vlc_playlist.h>
#include <QSplitter>
#include <QSplitter>
#include <QLabel>
#include <QLabel>
...
@@ -75,5 +76,39 @@ public:
...
@@ -75,5 +76,39 @@ public:
}
}
};
};
enum
PLEventType
{
ItemAddedEv
=
QEvent
::
User
,
ItemRemovedEv
};
class
PLEMEvent
:
public
QEvent
{
public:
PLEMEvent
(
int
t
,
int
i
,
int
p
)
:
QEvent
(
(
QEvent
::
Type
)
t
),
item
(
i
),
parent
(
p
)
{}
int
item
;
int
parent
;
};
class
PlaylistEventManager
:
public
QObject
{
Q_OBJECT
;
public:
PlaylistEventManager
(
playlist_t
*
);
~
PlaylistEventManager
();
signals:
void
itemAdded
(
int
,
int
);
void
itemRemoved
(
int
);
private:
static
int
itemAddedCb
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
itemRemovedCb
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
void
trigger
(
vlc_value_t
,
int
);
void
customEvent
(
QEvent
*
);
playlist_t
*
pl
;
};
#endif
#endif
modules/gui/qt4/components/playlist/selector.cpp
View file @
4ed4e121
This diff is collapsed.
Click to expand it.
modules/gui/qt4/components/playlist/selector.hpp
View file @
4ed4e121
...
@@ -32,38 +32,92 @@
...
@@ -32,38 +32,92 @@
#include <QTreeWidget>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QTreeWidgetItem>
#include <QStyledItemDelegate>
#include <QStyledItemDelegate>
#include <QPainter>
#include <QPushButton>
#include <QLabel>
#include <QHBoxLayout>
#include <vlc_playlist.h>
#include <vlc_playlist.h>
#include "qt4.hpp"
#include "qt4.hpp"
class
PlaylistWidget
;
class
PlaylistWidget
;
class
PlaylistEventManager
;
enum
{
enum
SelectorItemType
{
PL_TYPE
,
CATEGORY_TYPE
,
ML_TYPE
,
SD_TYPE
,
SD_TYPE
,
PL_ITEM_TYPE
};
enum
SpecialData
{
IS_PODCAST
=
1
,
IS_PL
,
IS_ML
};
};
enum
{
enum
{
TYPE_ROLE
=
Qt
::
UserRole
,
TYPE_ROLE
=
Qt
::
UserRole
,
PPL_ITEM_ROLE
,
NAME_ROLE
,
//QString
NAME_ROLE
,
LONGNAME_ROLE
,
//QString
LONGNAME_ROLE
,
PL_ITEM_ROLE
,
//playlist_item_t*
PL_ITEM_ID_ROLE
,
//playlist_item_t->i_id
IN_ITEM_ROLE
,
//input_item_t->i_id
SPECIAL_ROLE
//SpecialData
};
enum
ItemAction
{
ADD_ACTION
,
RM_ACTION
};
class
PLSelItem
:
public
QWidget
{
Q_OBJECT
;
public:
PLSelItem
(
QTreeWidgetItem
*
,
const
QString
&
);
void
setText
(
const
QString
&
);
void
addAction
(
ItemAction
,
const
QString
&
toolTip
=
0
);
QTreeWidgetItem
*
treeItem
()
{
return
qitem
;
}
QString
text
()
{
return
lbl
->
text
();
}
public
slots
:
void
showAction
();
void
hideAction
();
private
slots
:
void
triggerAction
()
{
emit
action
(
this
);
}
signals:
void
action
(
PLSelItem
*
);
private:
void
enterEvent
(
QEvent
*
);
void
leaveEvent
(
QEvent
*
);
QTreeWidgetItem
*
qitem
;
QPushButton
*
btnAction
;
QLabel
*
lbl
;
QHBoxLayout
*
layout
;
};
};
class
PLSelectorDelegate
:
public
QStyledItemDelegate
class
PLSelectorDelegate
:
public
QStyledItemDelegate
{
{
private:
private:
/*void paint ( QPainter * painter,
const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
if( index.data( TYPE_ROLE ).toInt() == CATEGORY_TYPE )
painter->fillRect( option.rect, QColor( 200,200,200 ) );
QRect r = option.rect;
r.setLeft( r.left() + 5 );
painter->drawText( r, Qt::AlignLeft | Qt::AlignVCenter, index.data().toString() );
}*/
QSize
sizeHint
(
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
QSize
sizeHint
(
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
{
{
QSize
sz
=
QStyledItemDelegate
::
sizeHint
(
option
,
index
);
QSize
sz
=
QStyledItemDelegate
::
sizeHint
(
option
,
index
);
if
(
sz
.
height
()
<
25
)
sz
.
setHeight
(
25
);
if
(
sz
.
height
()
<
23
)
sz
.
setHeight
(
23
);
return
sz
;
return
sz
;
}
}
};
};
Q_DECLARE_METATYPE
(
playlist_item_t
*
);
Q_DECLARE_METATYPE
(
playlist_item_t
*
);
Q_DECLARE_METATYPE
(
input_item_t
*
);
class
PLSelector
:
public
QTreeWidget
class
PLSelector
:
public
QTreeWidget
{
{
Q_OBJECT
;
Q_OBJECT
;
...
@@ -74,12 +128,25 @@ protected:
...
@@ -74,12 +128,25 @@ protected:
friend
class
PlaylistWidget
;
friend
class
PlaylistWidget
;
private:
private:
QStringList
mimeTypes
()
const
;
QStringList
mimeTypes
()
const
;
void
makeStandardItem
(
QTreeWidgetItem
*
,
const
QString
&
);
bool
dropMimeData
(
QTreeWidgetItem
*
parent
,
int
index
,
const
QMimeData
*
data
,
Qt
::
DropAction
action
);
bool
dropMimeData
(
QTreeWidgetItem
*
parent
,
int
index
,
const
QMimeData
*
data
,
Qt
::
DropAction
action
);
void
createItems
();
void
createItems
();
PLSelItem
*
addItem
(
SelectorItemType
type
,
const
QString
&
str
,
bool
drop
,
QTreeWidgetItem
*
parentItem
=
0
);
PLSelItem
*
addPodcastItem
(
playlist_item_t
*
p_item
);
inline
PLSelItem
*
itemWidget
(
QTreeWidgetItem
*
);
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
PlaylistEventManager
*
plEM
;
QTreeWidgetItem
*
podcastsParent
;
int
podcastsParentId
;
private
slots
:
private
slots
:
void
setSource
(
QTreeWidgetItem
*
item
);
void
setSource
(
QTreeWidgetItem
*
item
);
void
plItemAdded
(
int
,
int
);
void
plItemRemoved
(
int
);
void
inputItemUpdate
(
input_item_t
*
);
void
podcastAdd
(
PLSelItem
*
);
void
podcastRemove
(
PLSelItem
*
);
signals:
signals:
void
activated
(
playlist_item_t
*
);
void
activated
(
playlist_item_t
*
);
};
};
...
...
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
4ed4e121
...
@@ -295,7 +295,8 @@ void StandardPLPanel::setRoot( playlist_item_t *p_item )
...
@@ -295,7 +295,8 @@ void StandardPLPanel::setRoot( playlist_item_t *p_item )
QPL_LOCK
;
QPL_LOCK
;
assert
(
p_item
);
assert
(
p_item
);
p_item
=
playlist_GetPreferredNode
(
THEPL
,
p_item
);
playlist_item_t
*
p_pref_item
=
playlist_GetPreferredNode
(
THEPL
,
p_item
);
if
(
p_pref_item
)
p_item
=
p_pref_item
;
/* needed for popupAdd() */
/* needed for popupAdd() */
currentRootId
=
p_item
->
i_id
;
currentRootId
=
p_item
->
i_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