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
e9c40e53
Commit
e9c40e53
authored
Nov 09, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: replace Podcast add / remove buttons with plain icons
parent
77ed8c31
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
40 deletions
+74
-40
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/playlist.cpp
+1
-1
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/selector.cpp
+22
-18
modules/gui/qt4/components/playlist/selector.hpp
modules/gui/qt4/components/playlist/selector.hpp
+2
-21
modules/gui/qt4/util/customwidgets.cpp
modules/gui/qt4/util/customwidgets.cpp
+30
-0
modules/gui/qt4/util/customwidgets.hpp
modules/gui/qt4/util/customwidgets.hpp
+19
-0
No files found.
modules/gui/qt4/components/playlist/playlist.cpp
View file @
e9c40e53
...
...
@@ -50,7 +50,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) : p_intf ( _p_i )
/* Source Selector */
selector
=
new
PLSelector
(
this
,
p_intf
);
QVBoxLayout
*
selBox
=
new
QVBoxLayout
();
selBox
->
setContentsMargins
(
0
,
5
,
0
,
0
);
selBox
->
setContentsMargins
(
5
,
5
,
5
,
0
);
selBox
->
addWidget
(
selector
);
QGroupBox
*
selGroup
=
new
QGroupBox
(
qtr
(
"Media Browser"
)
);
selGroup
->
setLayout
(
selBox
);
...
...
modules/gui/qt4/components/playlist/selector.cpp
View file @
e9c40e53
...
...
@@ -33,6 +33,7 @@
#include "qt4.hpp"
#include "../../dialogs_provider.hpp"
#include "playlist.hpp"
#include "util/customwidgets.hpp"
#include <QVBoxLayout>
#include <QHeaderView>
...
...
@@ -44,41 +45,49 @@
#include <vlc_services_discovery.h>
PLSelItem
::
PLSelItem
(
QTreeWidgetItem
*
i
,
const
QString
&
text
)
:
qitem
(
i
),
btnAction
(
NULL
)
:
qitem
(
i
),
lblAction
(
NULL
)
{
layout
=
new
QHBoxLayout
();
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
addSpacing
(
3
);
lbl
=
new
QLabel
(
text
);
lbl
->
setMargin
(
3
);
layout
->
addWidget
(
lbl
);
layout
->
addWidget
(
lbl
,
1
);
setLayout
(
layout
);
setMinimumHeight
(
22
);
//Action icon height plus 6
}
void
PLSelItem
::
addAction
(
ItemAction
act
,
const
QString
&
tooltip
)
{
if
(
btnAction
)
return
;
if
(
lblAction
)
return
;
//might change later
QIcon
icon
;
switch
(
act
)
{
case
ADD_ACTION
:
btnAction
=
new
QPushButton
(
"+"
);
break
;
icon
=
QIcon
(
":/buttons/playlist/playlist_add"
);
break
;
case
RM_ACTION
:
btnAction
=
new
QPushButton
(
"-"
);
break
;
icon
=
QIcon
(
":/buttons/playlist/playlist_remove"
);
break
;
}
if
(
!
tooltip
.
isEmpty
()
)
btnAction
->
setToolTip
(
tooltip
);
btnAction
->
setMaximumWidth
(
23
);
layout
->
addWidget
(
btnAction
);
btnAction
->
hide
();
lblAction
=
new
QVLCIconLabel
(
icon
);
if
(
!
tooltip
.
isEmpty
()
)
lblAction
->
setToolTip
(
tooltip
);
layout
->
addWidget
(
lblAction
,
0
);
lblAction
->
hide
();
layout
->
addSpacing
(
3
);
CONNECT
(
btn
Action
,
clicked
(),
this
,
triggerAction
()
);
CONNECT
(
lbl
Action
,
clicked
(),
this
,
triggerAction
()
);
}
void
PLSelItem
::
showAction
()
{
if
(
btnAction
)
btn
Action
->
show
();
}
void
PLSelItem
::
showAction
()
{
if
(
lblAction
)
lbl
Action
->
show
();
}
void
PLSelItem
::
hideAction
()
{
if
(
btnAction
)
btn
Action
->
hide
();
}
void
PLSelItem
::
hideAction
()
{
if
(
lblAction
)
lbl
Action
->
hide
();
}
void
PLSelItem
::
setText
(
const
QString
&
text
)
{
lbl
->
setText
(
text
);
}
...
...
@@ -89,18 +98,13 @@ void PLSelItem::leaveEvent( QEvent *ev ){ hideAction(); }
PLSelector
::
PLSelector
(
QWidget
*
p
,
intf_thread_t
*
_p_intf
)
:
QTreeWidget
(
p
),
p_intf
(
_p_intf
)
{
/* custom QItemDelegate just to assure the minimum row height,
which otherwise fails when new child item is inserted */
setFrameStyle
(
QFrame
::
NoFrame
);
viewport
()
->
setAutoFillBackground
(
false
);
setIconSize
(
QSize
(
24
,
24
)
);
setIndentation
(
10
);
header
()
->
hide
();
//setHeaderLabel( qtr( "Medias" ) );
//header()->setMovable( false );
setRootIsDecorated
(
false
);
setAlternatingRowColors
(
false
);
setItemDelegate
(
new
PLSelectorDelegate
()
);
podcastsParent
=
NULL
;
podcastsParentId
=
-
1
;
...
...
modules/gui/qt4/components/playlist/selector.hpp
View file @
e9c40e53
...
...
@@ -42,6 +42,7 @@
#include "qt4.hpp"
class
PlaylistWidget
;
class
QVLCIconLabel
;
enum
SelectorItemType
{
CATEGORY_TYPE
,
...
...
@@ -90,31 +91,11 @@ private:
void
enterEvent
(
QEvent
*
);
void
leaveEvent
(
QEvent
*
);
QTreeWidgetItem
*
qitem
;
Q
PushButton
*
btn
Action
;
Q
VLCIconLabel
*
lbl
Action
;
QLabel
*
lbl
;
QHBoxLayout
*
layout
;
};
class
PLSelectorDelegate
:
public
QStyledItemDelegate
{
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
sz
=
QStyledItemDelegate
::
sizeHint
(
option
,
index
);
if
(
sz
.
height
()
<
23
)
sz
.
setHeight
(
23
);
return
sz
;
}
};
Q_DECLARE_METATYPE
(
playlist_item_t
*
);
Q_DECLARE_METATYPE
(
input_item_t
*
);
class
PLSelector
:
public
QTreeWidget
...
...
modules/gui/qt4/util/customwidgets.cpp
View file @
e9c40e53
...
...
@@ -146,6 +146,36 @@ void SearchLineEdit::updateText( const QString& text )
emit
textChanged
(
text
);
}
QVLCIconLabel
::
QVLCIconLabel
(
const
QIcon
&
i
,
QWidget
*
p
)
:
QLabel
(
p
),
icon
(
i
)
{
setPixmap
(
icon
.
pixmap
(
pixmapSize
(
QIcon
::
Normal
),
QIcon
::
Normal
)
);
}
void
QVLCIconLabel
::
setIcon
(
const
QIcon
&
i
)
{
icon
=
i
;
}
void
QVLCIconLabel
::
enterEvent
(
QEvent
*
)
{
setPixmap
(
icon
.
pixmap
(
pixmapSize
(
QIcon
::
Active
),
QIcon
::
Active
)
);
}
void
QVLCIconLabel
::
leaveEvent
(
QEvent
*
)
{
setPixmap
(
icon
.
pixmap
(
pixmapSize
(
QIcon
::
Normal
),
QIcon
::
Normal
)
);
}
void
QVLCIconLabel
::
mouseReleaseEvent
(
QMouseEvent
*
)
{
emit
clicked
();
}
QSize
QVLCIconLabel
::
pixmapSize
(
QIcon
::
Mode
mode
,
QIcon
::
State
state
)
{
QList
<
QSize
>
sizes
=
icon
.
availableSizes
(
mode
,
state
);
if
(
sizes
.
isEmpty
()
)
sizes
=
icon
.
availableSizes
();
return
(
!
sizes
.
isEmpty
()
?
sizes
[
0
]
:
QSize
()
);
}
/***************************************************************************
* Hotkeys converters
***************************************************************************/
...
...
modules/gui/qt4/util/customwidgets.hpp
View file @
e9c40e53
...
...
@@ -28,6 +28,8 @@
#define _CUSTOMWIDGETS_H_
#include <QLineEdit>
#include <QLabel>
#include <QIcon>
/**
This class provides a QLineEdit which contains a greyed-out hinting
...
...
@@ -74,6 +76,23 @@ signals:
void
textChanged
(
const
QString
&
);
};
class
QVLCIconLabel
:
public
QLabel
{
Q_OBJECT
public:
QVLCIconLabel
(
const
QIcon
&
,
QWidget
*
parent
=
0
);
void
setIcon
(
const
QIcon
&
);
signals:
void
clicked
();
protected:
virtual
void
enterEvent
(
QEvent
*
);
virtual
void
leaveEvent
(
QEvent
*
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
);
private:
inline
QSize
pixmapSize
(
QIcon
::
Mode
=
QIcon
::
Normal
,
QIcon
::
State
=
QIcon
::
Off
);
QIcon
icon
;
};
/*****************************************************************
* Custom views
*****************************************************************/
...
...
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