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
41b266bf
Commit
41b266bf
authored
Feb 07, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: new volume slider, optionnal. Totem like, for people who use Totem
This is a special request for Laurent ;)
parent
52833ec7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
11 deletions
+67
-11
modules/gui/qt4/components/controller_widget.cpp
modules/gui/qt4/components/controller_widget.cpp
+63
-10
modules/gui/qt4/components/controller_widget.hpp
modules/gui/qt4/components/controller_widget.hpp
+4
-1
No files found.
modules/gui/qt4/components/controller_widget.cpp
View file @
41b266bf
...
...
@@ -35,21 +35,60 @@
#include <QLabel>
#include <QHBoxLayout>
#include <QSpinBox>
#include <QMenu>
#include <QWidgetAction>
SoundWidget
::
SoundWidget
(
QWidget
*
_parent
,
intf_thread_t
*
_p_intf
,
bool
b_shiny
)
:
QWidget
(
_parent
),
b_my_volume
(
false
)
bool
b_shiny
,
bool
b_special
)
:
QWidget
(
_parent
),
b_my_volume
(
false
),
p_intf
(
_p_intf
)
{
p_intf
=
_p_intf
;
/* We need a layout for this widget */
QHBoxLayout
*
layout
=
new
QHBoxLayout
(
this
);
layout
->
setSpacing
(
0
);
layout
->
setMargin
(
0
);
hVolLabel
=
new
VolumeClickHandler
(
p_intf
,
this
);
/* We need a Label for the pix */
volMuteLabel
=
new
QLabel
;
volMuteLabel
->
setPixmap
(
QPixmap
(
":/volume-medium"
)
);
volMuteLabel
->
installEventFilter
(
hVolLabel
);
/* We might need a subLayout too */
QVBoxLayout
*
subLayout
;
/* Normal View, click on icon mutes */
if
(
!
b_special
)
{
hVolLabel
=
new
VolumeClickHandler
(
p_intf
,
this
);
volMuteLabel
->
installEventFilter
(
hVolLabel
);
volumeMenu
=
NULL
;
subLayout
=
NULL
;
}
else
{
/* Special view, click on button shows the slider */
b_shiny
=
false
;
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
QFrame
*
volumeControlWidget
=
new
QFrame
;
subLayout
=
new
QVBoxLayout
(
volumeControlWidget
);
subLayout
->
setLayoutMargins
(
4
,
4
,
4
,
4
,
4
);
volumeMenu
=
new
QMenu
(
this
);
QWidgetAction
*
widgetAction
=
new
QWidgetAction
(
volumeControlWidget
);
widgetAction
->
setDefaultWidget
(
volumeControlWidget
);
volumeMenu
->
addAction
(
widgetAction
);
/* Speed Label behaviour:
- right click gives the vertical speed slider */
CONNECT
(
this
,
customContextMenuRequested
(
QPoint
),
this
,
showVolumeMenu
(
QPoint
)
);
}
/* And add the label */
layout
->
addWidget
(
volMuteLabel
);
/* Slider creation: shiny or clean */
if
(
b_shiny
)
{
volumeSlider
=
new
SoundSlider
(
this
,
...
...
@@ -59,15 +98,23 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
}
else
{
volumeSlider
=
new
QSlider
(
this
);
volumeSlider
->
setOrientation
(
Qt
::
Horizontal
);
volumeSlider
=
new
QSlider
(
NULL
);
volumeSlider
->
setOrientation
(
b_special
?
Qt
::
Vertical
:
Qt
::
Horizontal
);
volumeSlider
->
setMaximum
(
config_GetInt
(
p_intf
,
"qt-volume-complete"
)
?
400
:
200
);
}
volumeSlider
->
setMaximumSize
(
QSize
(
200
,
40
)
);
volumeSlider
->
setMinimumSize
(
QSize
(
85
,
30
)
);
if
(
volumeSlider
->
orientation
()
==
Qt
::
Horizontal
)
{
volumeSlider
->
setMaximumSize
(
QSize
(
200
,
40
)
);
volumeSlider
->
setMinimumSize
(
QSize
(
85
,
30
)
);
}
volumeSlider
->
setFocusPolicy
(
Qt
::
NoFocus
);
layout
->
addWidget
(
volumeSlider
);
if
(
b_special
)
subLayout
->
addWidget
(
volumeSlider
);
else
layout
->
addWidget
(
volumeSlider
);
/* Set the volume from the config */
volumeSlider
->
setValue
(
(
config_GetInt
(
p_intf
,
"volume"
)
)
*
...
...
@@ -81,6 +128,12 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
CONNECT
(
THEMIM
,
volumeChanged
(
void
),
this
,
updateVolume
(
void
)
);
}
void
SoundWidget
::
showVolumeMenu
(
QPoint
pos
)
{
volumeMenu
->
exec
(
QCursor
::
pos
()
-
pos
-
QPoint
(
0
,
volumeMenu
->
height
()
/
2
)
+
QPoint
(
width
(),
height
()
/
2
)
);
}
void
SoundWidget
::
updateVolume
(
int
i_sliderVolume
)
{
if
(
!
b_my_volume
)
...
...
modules/gui/qt4/components/controller_widget.hpp
View file @
41b266bf
...
...
@@ -83,7 +83,8 @@ class SoundWidget : public QWidget
friend
class
VolumeClickHandler
;
public:
SoundWidget
(
QWidget
*
parent
,
intf_thread_t
*
_p_i
,
bool
);
SoundWidget
(
QWidget
*
parent
,
intf_thread_t
*
_p_i
,
bool
,
bool
b_special
=
false
);
private:
intf_thread_t
*
p_intf
;
...
...
@@ -91,10 +92,12 @@ private:
QAbstractSlider
*
volumeSlider
;
VolumeClickHandler
*
hVolLabel
;
bool
b_my_volume
;
QMenu
*
volumeMenu
;
protected
slots
:
void
updateVolume
(
int
);
void
updateVolume
(
void
);
void
showVolumeMenu
(
QPoint
pos
);
};
class
VolumeClickHandler
:
public
QObject
...
...
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