Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
8b583911
Commit
8b583911
authored
Dec 11, 2007
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4 - Slightly smaller sound slider and fix the padding between mouse and shape.
parent
31178444
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
11 deletions
+14
-11
modules/gui/qt4/pixmaps/volume-slider-inside.png
modules/gui/qt4/pixmaps/volume-slider-inside.png
+0
-0
modules/gui/qt4/pixmaps/volume-slider-outside.png
modules/gui/qt4/pixmaps/volume-slider-outside.png
+0
-0
modules/gui/qt4/util/input_slider.cpp
modules/gui/qt4/util/input_slider.cpp
+12
-10
modules/gui/qt4/util/input_slider.hpp
modules/gui/qt4/util/input_slider.hpp
+2
-1
No files found.
modules/gui/qt4/pixmaps/volume-slider-inside.png
View replaced file @
31178444
View file @
8b583911
263 Bytes
|
W:
|
H:
270 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
modules/gui/qt4/pixmaps/volume-slider-outside.png
View replaced file @
31178444
View file @
8b583911
1.06 KB
|
W:
|
H:
1009 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
modules/gui/qt4/util/input_slider.cpp
View file @
8b583911
...
@@ -75,15 +75,16 @@ void InputSlider::mouseMoveEvent(QMouseEvent *event)
...
@@ -75,15 +75,16 @@ void InputSlider::mouseMoveEvent(QMouseEvent *event)
setToolTip
(
psz_length
);
setToolTip
(
psz_length
);
}
}
#define WLENGTH
10
0 // px
#define WLENGTH
9
0 // px
#define WHEIGHT 2
8
// px
#define WHEIGHT 2
5
// px
#define SOUNDMIN 0 // %
#define SOUNDMIN 0 // %
#define SOUNDMAX 200 // % OR 400 ?
#define SOUNDMAX 200 // % OR 400 ?
SoundSlider
::
SoundSlider
(
QWidget
*
_parent
,
int
_i_step
,
bool
b_hard
)
SoundSlider
::
SoundSlider
(
QWidget
*
_parent
,
int
_i_step
,
bool
b_hard
)
:
QAbstractSlider
(
_parent
)
:
QAbstractSlider
(
_parent
)
{
{
padding
=
3
;
paddingL
=
5
;
paddingR
=
3
;
f_step
=
(
_i_step
*
100
)
/
AOUT_VOLUME_MAX
;
f_step
=
(
_i_step
*
100
)
/
AOUT_VOLUME_MAX
;
setRange
(
SOUNDMIN
,
b_hard
?
(
2
*
SOUNDMAX
)
:
SOUNDMAX
);
setRange
(
SOUNDMIN
,
b_hard
?
(
2
*
SOUNDMAX
)
:
SOUNDMAX
);
...
@@ -97,7 +98,7 @@ SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard )
...
@@ -97,7 +98,7 @@ SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard )
pixGradient
=
QPixmap
(
mask
.
size
()
);
pixGradient
=
QPixmap
(
mask
.
size
()
);
QLinearGradient
gradient
(
padding
,
2
,
WLENGTH
,
2
);
QLinearGradient
gradient
(
padding
L
,
4
,
WLENGTH
+
paddingL
,
4
);
gradient
.
setColorAt
(
0.0
,
Qt
::
white
);
gradient
.
setColorAt
(
0.0
,
Qt
::
white
);
gradient
.
setColorAt
(
0.2
,
QColor
(
20
,
226
,
20
)
);
gradient
.
setColorAt
(
0.2
,
QColor
(
20
,
226
,
20
)
);
gradient
.
setColorAt
(
0.5
,
QColor
(
255
,
176
,
15
)
);
gradient
.
setColorAt
(
0.5
,
QColor
(
255
,
176
,
15
)
);
...
@@ -128,7 +129,7 @@ void SoundSlider::mousePressEvent( QMouseEvent *event )
...
@@ -128,7 +129,7 @@ void SoundSlider::mousePressEvent( QMouseEvent *event )
b_sliding
=
true
;
b_sliding
=
true
;
i_oldvalue
=
value
();
i_oldvalue
=
value
();
emit
sliderPressed
();
emit
sliderPressed
();
changeValue
(
event
->
x
()
-
padding
);
changeValue
(
event
->
x
()
-
padding
L
);
}
}
}
}
...
@@ -150,7 +151,7 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
...
@@ -150,7 +151,7 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
{
{
if
(
b_sliding
)
if
(
b_sliding
)
{
{
QRect
rect
(
padding
-
15
,
padding
-
1
,
QRect
rect
(
padding
L
-
15
,
-
1
,
WLENGTH
+
15
*
2
,
WHEIGHT
+
4
);
WLENGTH
+
15
*
2
,
WHEIGHT
+
4
);
if
(
!
rect
.
contains
(
event
->
pos
()
)
)
if
(
!
rect
.
contains
(
event
->
pos
()
)
)
{
/* We are outside */
{
/* We are outside */
...
@@ -161,7 +162,7 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
...
@@ -161,7 +162,7 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
else
else
{
/* We are inside */
{
/* We are inside */
b_outside
=
false
;
b_outside
=
false
;
changeValue
(
event
->
x
()
-
padding
);
changeValue
(
event
->
x
()
-
padding
L
);
emit
sliderMoved
(
value
()
);
emit
sliderMoved
(
value
()
);
}
}
}
}
...
@@ -171,14 +172,15 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
...
@@ -171,14 +172,15 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
void
SoundSlider
::
changeValue
(
int
x
)
void
SoundSlider
::
changeValue
(
int
x
)
{
{
setValue
(
QStyle
::
sliderValueFromPosition
(
setValue
(
x
*
maximum
()
/
WLENGTH
);
minimum
(),
maximum
(),
x
,
width
()
-
2
*
padding
)
);
}
}
void
SoundSlider
::
paintEvent
(
QPaintEvent
*
e
)
void
SoundSlider
::
paintEvent
(
QPaintEvent
*
e
)
{
{
QPainter
painter
(
this
);
QPainter
painter
(
this
);
const
int
offset
=
int
(
double
(
(
width
()
-
2
*
padding
)
*
value
()
)
/
maximum
()
);
const
int
offset
=
int
(
double
(
WLENGTH
*
value
()
)
/
double
(
maximum
()
)
)
+
paddingL
;
const
QRectF
boundsG
(
0
,
0
,
offset
,
pixGradient
.
height
()
);
const
QRectF
boundsG
(
0
,
0
,
offset
,
pixGradient
.
height
()
);
painter
.
drawPixmap
(
boundsG
,
pixGradient
,
boundsG
);
painter
.
drawPixmap
(
boundsG
,
pixGradient
,
boundsG
);
...
...
modules/gui/qt4/util/input_slider.hpp
View file @
8b583911
...
@@ -57,7 +57,8 @@ public:
...
@@ -57,7 +57,8 @@ public:
SoundSlider
(
QWidget
*
_parent
,
int
_i_step
,
bool
b_softamp
);
SoundSlider
(
QWidget
*
_parent
,
int
_i_step
,
bool
b_softamp
);
virtual
~
SoundSlider
()
{};
virtual
~
SoundSlider
()
{};
protected:
protected:
int
padding
;
int
paddingL
;
int
paddingR
;
virtual
void
paintEvent
(
QPaintEvent
*
);
virtual
void
paintEvent
(
QPaintEvent
*
);
virtual
void
wheelEvent
(
QWheelEvent
*
event
);
virtual
void
wheelEvent
(
QWheelEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
);
virtual
void
mousePressEvent
(
QMouseEvent
*
);
...
...
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