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
604c1802
Commit
604c1802
authored
Nov 23, 2007
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4 - New kind of volume slider.
Need a lot of graphic tweaking.
parent
d919d75e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
20 deletions
+165
-20
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+10
-16
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/interface_widgets.hpp
+4
-2
modules/gui/qt4/util/customwidgets.cpp
modules/gui/qt4/util/customwidgets.cpp
+2
-1
modules/gui/qt4/util/customwidgets.hpp
modules/gui/qt4/util/customwidgets.hpp
+1
-0
modules/gui/qt4/util/input_slider.cpp
modules/gui/qt4/util/input_slider.cpp
+121
-1
modules/gui/qt4/util/input_slider.hpp
modules/gui/qt4/util/input_slider.hpp
+27
-0
No files found.
modules/gui/qt4/components/interface_widgets.cpp
View file @
604c1802
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include "input_manager.hpp"
#include "input_manager.hpp"
#include "menus.hpp"
#include "menus.hpp"
#include "util/input_slider.hpp"
#include "util/input_slider.hpp"
#include "util/customwidgets.hpp"
#include <vlc_vout.h>
#include <vlc_vout.h>
#include <QLabel>
#include <QLabel>
...
@@ -486,29 +487,20 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
...
@@ -486,29 +487,20 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
controlLayout
->
setColumnStretch
(
14
,
5
);
controlLayout
->
setColumnStretch
(
14
,
5
);
/* Volume */
/* Volume */
VolumeClickHandler
*
h
=
new
VolumeClickHandler
(
p_intf
,
this
);
VolumeClickHandler
*
h
VolLabel
=
new
VolumeClickHandler
(
p_intf
,
this
);
volMuteLabel
=
new
QLabel
;
volMuteLabel
=
new
QLabel
;
volMuteLabel
->
setPixmap
(
QPixmap
(
":/pixmaps/volume-high.png"
)
);
volMuteLabel
->
setPixmap
(
QPixmap
(
":/pixmaps/volume-high.png"
)
);
volMuteLabel
->
setToolTip
(
qtr
(
"Mute"
)
);
volMuteLabel
->
setToolTip
(
qtr
(
"Mute"
)
);
volMuteLabel
->
installEventFilter
(
h
);
volMuteLabel
->
installEventFilter
(
hVolLabel
);
controlLayout
->
addWidget
(
volMuteLabel
,
3
,
15
);
/** TODO:
* Change this slider to use a nice Amarok-like one
* **/
/** FIXME
* THis percerntage thing has to be handled correctly
* This has to match to the OSD
**/
volumeSlider
=
new
QSlider
;
volumeSlider
->
setSizePolicy
(
sizePolicy
);
volumeSlider
->
setMaximumSize
(
QSize
(
80
,
200
)
);
volumeSlider
->
setOrientation
(
Qt
::
Horizontal
);
volumeSlider
=
new
SoundSlider
(
this
);
volumeSlider
->
setMaximumSize
(
QSize
(
200
,
40
)
);
volumeSlider
->
setMinimumSize
(
QSize
(
80
,
20
)
);
controlLayout
->
addWidget
(
volumeSlider
,
3
,
16
,
1
,
2
);
volumeSlider
->
setMaximum
(
VOLUME_MAX
);
volumeSlider
->
setMaximum
(
VOLUME_MAX
);
volumeSlider
->
setFocusPolicy
(
Qt
::
NoFocus
);
volumeSlider
->
setFocusPolicy
(
Qt
::
NoFocus
);
controlLayout
->
addWidget
(
volMuteLabel
,
3
,
15
);
controlLayout
->
addWidget
(
volumeSlider
,
3
,
16
,
1
,
2
);
/* Volume control connection */
/* Volume control connection */
CONNECT
(
volumeSlider
,
valueChanged
(
int
),
this
,
updateVolume
(
int
)
);
CONNECT
(
volumeSlider
,
valueChanged
(
int
),
this
,
updateVolume
(
int
)
);
...
@@ -863,3 +855,5 @@ void SpeedControlWidget::resetRate()
...
@@ -863,3 +855,5 @@ void SpeedControlWidget::resetRate()
{
{
THEMIM
->
getIM
()
->
setRate
(
INPUT_RATE_DEFAULT
);
THEMIM
->
getIM
()
->
setRate
(
INPUT_RATE_DEFAULT
);
}
}
modules/gui/qt4/components/interface_widgets.hpp
View file @
604c1802
...
@@ -140,6 +140,8 @@ class InputSlider;
...
@@ -140,6 +140,8 @@ class InputSlider;
class
QSlider
;
class
QSlider
;
class
QGridLayout
;
class
QGridLayout
;
class
VolumeClickHandler
;
class
VolumeClickHandler
;
class
SoundSlider
;
class
ControlsWidget
:
public
QFrame
class
ControlsWidget
:
public
QFrame
{
{
Q_OBJECT
Q_OBJECT
...
@@ -148,7 +150,7 @@ public:
...
@@ -148,7 +150,7 @@ public:
virtual
~
ControlsWidget
();
virtual
~
ControlsWidget
();
QPushButton
*
playlistButton
;
QPushButton
*
playlistButton
;
Q
Slider
*
volumeSlider
;
Sound
Slider
*
volumeSlider
;
void
setStatus
(
int
);
void
setStatus
(
int
);
void
enableInput
(
bool
);
void
enableInput
(
bool
);
void
enableVideo
(
bool
);
void
enableVideo
(
bool
);
...
@@ -226,6 +228,7 @@ signals:
...
@@ -226,6 +228,7 @@ signals:
void
timeLabelDoubleClicked
();
void
timeLabelDoubleClicked
();
};
};
/******************** Playlist Widgets ****************/
/******************** Playlist Widgets ****************/
#include <QModelIndex>
#include <QModelIndex>
#include <QSplitter>
#include <QSplitter>
...
@@ -273,5 +276,4 @@ private slots:
...
@@ -273,5 +276,4 @@ private slots:
void
resetRate
();
void
resetRate
();
};
};
#endif
#endif
modules/gui/qt4/util/customwidgets.cpp
View file @
604c1802
...
@@ -194,4 +194,5 @@ QString VLCKeyToString( int val )
...
@@ -194,4 +194,5 @@ QString VLCKeyToString( int val )
}
}
}
}
return
r
;
return
r
;
}
}
\ No newline at end of file
modules/gui/qt4/util/customwidgets.hpp
View file @
604c1802
...
@@ -56,6 +56,7 @@ private:
...
@@ -56,6 +56,7 @@ private:
bool
mDrawClickMsg
;
bool
mDrawClickMsg
;
};
};
/*****************************************************************
/*****************************************************************
* Custom views
* Custom views
*****************************************************************/
*****************************************************************/
...
...
modules/gui/qt4/util/input_slider.cpp
View file @
604c1802
...
@@ -24,6 +24,10 @@
...
@@ -24,6 +24,10 @@
#include "qt4.hpp"
#include "qt4.hpp"
#include "util/input_slider.hpp"
#include "util/input_slider.hpp"
#include <QPaintEvent>
#include <QPainter>
#include <QStyle>
InputSlider
::
InputSlider
(
QWidget
*
_parent
)
:
DirectSlider
(
_parent
)
InputSlider
::
InputSlider
(
QWidget
*
_parent
)
:
DirectSlider
(
_parent
)
{
{
InputSlider
::
InputSlider
(
Qt
::
Horizontal
,
_parent
);
InputSlider
::
InputSlider
(
Qt
::
Horizontal
,
_parent
);
...
@@ -66,7 +70,123 @@ void InputSlider::userDrag( int new_value )
...
@@ -66,7 +70,123 @@ void InputSlider::userDrag( int new_value )
void
InputSlider
::
mouseMoveEvent
(
QMouseEvent
*
event
)
void
InputSlider
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
{
char
psz_length
[
MSTRTIME_MAX_SIZE
];
char
psz_length
[
MSTRTIME_MAX_SIZE
];
secstotimestr
(
psz_length
,
(
int
)((
float
)
event
->
x
()
/
size
().
width
()
*
inputLength
)
);
secstotimestr
(
psz_length
,
(
event
->
x
()
*
inputLength
)
/
size
().
width
(
)
);
setToolTip
(
psz_length
);
setToolTip
(
psz_length
);
}
}
#define WLENGTH 100 // px
#define WHEIGHT 25 // px
#define SOUNDMIN 0 // %
#define SOUNDMAX 200 // % OR 400 ?
#define SOUNDSTEP 5 // %
SoundSlider
::
SoundSlider
(
QWidget
*
_parent
)
:
QAbstractSlider
(
_parent
)
{
padding
=
5
;
setRange
(
SOUNDMIN
,
SOUNDMAX
);
pixGradient
=
QPixmap
(
QSize
(
WLENGTH
,
WHEIGHT
)
);
// QBixmap mask = QBitmap( QPixmap );
QPainter
p
(
&
pixGradient
);
QLinearGradient
gradient
(
0
,
0
,
WLENGTH
,
WHEIGHT
);
gradient
.
setColorAt
(
0.0
,
Qt
::
white
);
gradient
.
setColorAt
(
1.0
,
Qt
::
blue
);
p
.
setPen
(
Qt
::
NoPen
);
p
.
setBrush
(
gradient
);
//static const QPointF points[3] = { QPointF( 0.0, WHEIGHT ),
// QPointF( WLENGTH, WHEIGHT ), QPointF( WLENGTH, 0.0 ) };
// p.drawConvexPolygon( points, 3 );
p
.
drawRect
(
pixGradient
.
rect
()
);
p
.
end
();
// pixGradient.setMask( mask );
}
void
SoundSlider
::
wheelEvent
(
QWheelEvent
*
event
)
{
int
newvalue
=
value
()
+
event
->
delta
()
/
(
8
*
15
)
*
SOUNDSTEP
;
setValue
(
__MIN
(
__MAX
(
minimum
(),
newvalue
),
maximum
()
)
);
emit
sliderReleased
();
}
void
SoundSlider
::
mousePressEvent
(
QMouseEvent
*
event
)
{
if
(
event
->
button
()
!=
Qt
::
RightButton
)
{
/* We enter the sliding mode */
b_sliding
=
true
;
i_oldvalue
=
value
();
emit
sliderPressed
();
}
}
void
SoundSlider
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
if
(
event
->
button
()
!=
Qt
::
RightButton
)
{
if
(
!
b_outside
&&
value
()
!=
i_oldvalue
)
{
emit
sliderReleased
();
setValue
(
value
()
);
}
b_sliding
=
false
;
b_outside
=
false
;
}
}
void
SoundSlider
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
if
(
b_sliding
)
{
QRect
rect
(
padding
-
15
,
padding
-
1
,
WLENGTH
+
15
*
2
,
WHEIGHT
+
2
);
if
(
!
rect
.
contains
(
event
->
pos
()
)
)
{
/* We are outside */
if
(
!
b_outside
)
setValue
(
i_oldvalue
);
b_outside
=
true
;
}
else
{
/* We are inside */
b_outside
=
false
;
changeValue
(
event
->
x
()
-
padding
);
emit
sliderMoved
(
value
()
);
}
}
else
event
->
ignore
();
}
void
SoundSlider
::
changeValue
(
int
x
)
{
setValue
(
QStyle
::
sliderValueFromPosition
(
minimum
(),
maximum
(),
x
,
width
()
-
2
*
padding
)
);
}
void
SoundSlider
::
paintEvent
(
QPaintEvent
*
e
)
{
QPainter
painter
(
this
);
const
int
offset
=
int
(
double
(
(
width
()
-
2
*
padding
)
*
value
()
)
/
maximum
()
);
const
QRectF
boundsG
(
padding
,
0
,
offset
,
pixGradient
.
height
()
);
painter
.
drawPixmap
(
boundsG
,
pixGradient
,
boundsG
);
painter
.
end
();
/* QPainter painter( this );
printf( "%i\n", value() );
QLinearGradient gradient( 0.0, 0.0, WLENGTH, WHEIGHT );
gradient.setColorAt( 0.0, Qt::white );
gradient.setColorAt( 1.0, Qt::blue );
painter.setPen( QPen( QBrush( Qt::black ), 0, Qt::SolidLine, Qt::RoundCap ) );
painter.setBrush( gradient );
painter.setRenderHint( QPainter::Antialiasing );
painter.end();*/
}
modules/gui/qt4/util/input_slider.hpp
View file @
604c1802
...
@@ -45,4 +45,31 @@ private slots:
...
@@ -45,4 +45,31 @@ private slots:
signals:
signals:
void
sliderDragged
(
float
);
void
sliderDragged
(
float
);
};
};
class
QPaintEvent
;
#include <QAbstractSlider>
class
SoundSlider
:
public
QAbstractSlider
{
Q_OBJECT
public:
SoundSlider
(
QWidget
*
_parent
);
virtual
~
SoundSlider
()
{};
protected:
int
padding
;
virtual
void
paintEvent
(
QPaintEvent
*
);
virtual
void
wheelEvent
(
QWheelEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
);
private:
bool
b_sliding
;
bool
b_outside
;
int
i_oldvalue
;
void
changeValue
(
int
x
);
QPixmap
pixGradient
;
QPixmap
pixLimit
;
};
#endif
#endif
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