Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
f36e3361
Commit
f36e3361
authored
Sep 09, 2007
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4 - volumeSlider: correct the sliders functions and calculus...
parent
7297ab36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
37 deletions
+19
-37
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+19
-37
No files found.
modules/gui/qt4/components/interface_widgets.cpp
View file @
f36e3361
...
@@ -760,38 +760,24 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
...
@@ -760,38 +760,24 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
speedSlider
->
setMaximumSize
(
QSize
(
80
,
200
)
);
speedSlider
->
setMaximumSize
(
QSize
(
80
,
200
)
);
speedSlider
->
setOrientation
(
Qt
::
Vertical
);
speedSlider
->
setOrientation
(
Qt
::
Vertical
);
speedSlider
->
setTickPosition
(
QSlider
::
TicksRight
);
speedSlider
->
setTickPosition
(
QSlider
::
TicksRight
);
speedSlider
->
setFocusPolicy
(
Qt
::
NoFocus
);
speedSlider
->
setMinimum
(
-
100
);
speedSlider
->
setRange
(
-
100
,
100
);
speedSlider
->
setMaximum
(
100
);
speedSlider
->
setSingleStep
(
10
);
speedSlider
->
setSingleStep
(
10
);
speedSlider
->
setPageStep
(
20
);
speedSlider
->
setPageStep
(
20
);
speedSlider
->
setTickInterval
(
20
);
speedSlider
->
setTickInterval
(
20
);
CONNECT
(
speedSlider
,
valueChanged
(
int
),
this
,
updateRate
(
int
)
);
CONNECT
(
speedSlider
,
valueChanged
(
int
),
this
,
updateRate
(
int
)
);
//QWidgetAction *wa = new QWidgetAction( this );
//wa->setDefaultWidget( playSpeedSlider );
//menu.addAction( wa );
normalSpeedButton
=
new
QPushButton
(
"N"
);
normalSpeedButton
=
new
QPushButton
(
"N"
);
//BUTTON_SET_ACT( revertToNormalButton, "N", qtr( "Normal" ), slower() );
//controlLayout->addWidget( revertToNormalButton, 0, 0 );
normalSpeedButton
->
setMaximumSize
(
QSize
(
26
,
20
)
);
normalSpeedButton
->
setMaximumSize
(
QSize
(
26
,
20
)
);
normalSpeedButton
->
setFlat
(
true
);
normalSpeedButton
->
setFlat
(
true
);
normalSpeedButton
->
setToolTip
(
qtr
(
"Revert to normal play speed"
)
);
CONNECT
(
normalSpeedButton
,
clicked
(),
this
,
resetRate
()
);
CONNECT
(
normalSpeedButton
,
clicked
(),
this
,
resetRate
()
);
QLabel
*
volMuteLabel
=
new
QLabel
(
"N"
);
//volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
volMuteLabel
->
setToolTip
(
qtr
(
"Revert to normal play speed"
)
);
//volMuteLabel->installEventFilter( h );
QVBoxLayout
*
speedControlLayout
=
new
QVBoxLayout
;
QVBoxLayout
*
speedControlLayout
=
new
QVBoxLayout
;
speedControlLayout
->
addWidget
(
speedSlider
);
speedControlLayout
->
addWidget
(
speedSlider
);
speedControlLayout
->
addWidget
(
normalSpeedButton
);
speedControlLayout
->
addWidget
(
normalSpeedButton
);
//speedControlLayout->addWidget(volMuteLabel);
setLayout
(
speedControlLayout
);
setLayout
(
speedControlLayout
);
}
}
...
@@ -799,12 +785,9 @@ SpeedControlWidget::~SpeedControlWidget()
...
@@ -799,12 +785,9 @@ SpeedControlWidget::~SpeedControlWidget()
{
{
}
}
#define RATE_SLIDER_CONSTANT 3.0
#define RATE_SLIDER_MAXIMUM 3.0
#define RATE_SLIDER_MINIMUM 0.3
#define SLIDER_MIN_SPEED 1.0 / RATE_SLIDER_CONSTANT
#define RATE_SLIDER_LENGTH 100.0
#define SLIDER_SLOW_RANGE 1.0 - SLIDER_MIN_SPEED
#define SLIDER_MAX_SPEED RATE_SLIDER_CONSTANT
#define SLIDER_FAST_RANGE 1.0 - SLIDER_MAX_SPEED
void
SpeedControlWidget
::
updateControls
(
int
rate
)
void
SpeedControlWidget
::
updateControls
(
int
rate
)
{
{
...
@@ -819,49 +802,48 @@ void SpeedControlWidget::updateControls( int rate )
...
@@ -819,49 +802,48 @@ void SpeedControlWidget::updateControls( int rate )
if
(
rate
>=
INPUT_RATE_DEFAULT
)
if
(
rate
>=
INPUT_RATE_DEFAULT
)
{
{
if
(
speed
<
SLIDER_MIN_SPEED
)
if
(
speed
<
RATE_SLIDER_MINIMUM
)
{
{
sliderValue
=
speedSlider
->
minimum
();
sliderValue
=
speedSlider
->
minimum
();
}
}
else
else
{
{
double
currPos
=
speed
/
(
double
)(
SLIDER_SLOW_RANGE
);
sliderValue
=
(
int
)(
(
speed
-
1.0
)
*
RATE_SLIDER_LENGTH
sliderValue
=
(
int
)(
currPos
*
speedSlider
->
minimum
(
)
);
/
(
1.0
-
RATE_SLIDER_MAXIMUM
)
);
}
}
}
}
else
else
{
{
if
(
speed
>
SLIDER_MAX_SPEED
)
if
(
speed
>
RATE_SLIDER_MAXIMUM
)
{
{
sliderValue
=
speedSlider
->
maximum
();
sliderValue
=
speedSlider
->
maximum
();
}
}
else
else
{
{
double
currPos
=
(
1.0
-
speed
)
/
(
double
)(
SLIDER_FAST_RANGE
);
sliderValue
=
(
int
)(
(
speed
-
1.0
)
*
RATE_SLIDER_LENGTH
sliderValue
=
(
int
)(
currPos
*
speedSlider
->
maximum
(
)
);
/
(
RATE_SLIDER_MAXIMUM
-
1.0
)
);
}
}
}
}
//Block signals to avoid feedback loop
//Block signals to avoid feedback loop
speedSlider
->
blockSignals
(
true
);
speedSlider
->
blockSignals
(
true
);
speedSlider
->
setValue
(
sliderValue
);
speedSlider
->
setValue
(
sliderValue
);
speedSlider
->
blockSignals
(
false
);
speedSlider
->
blockSignals
(
false
);
}
}
void
SpeedControlWidget
::
updateRate
(
int
sliderValue
)
void
SpeedControlWidget
::
updateRate
(
int
sliderValue
)
{
{
int
rate
;
int
rate
;
double
var
;
if
(
sliderValue
<
0.0
)
if
(
sliderValue
<
0.0
)
{
{
var
=
1.0
+
((
-
sliderValue
/
100.0
)
*
RATE_SLIDER_CONSTANT
-
1.0
);
rate
=
INPUT_RATE_DEFAULT
*
RATE_SLIDER_LENGTH
/
rate
=
INPUT_RATE_DEFAULT
*
var
;
(
sliderValue
*
(
1.0
-
RATE_SLIDER_MINIMUM
)
+
RATE_SLIDER_LENGTH
)
;
}
}
else
else
{
{
var
=
1.0
+
((
sliderValue
/
100.0
)
*
RATE_SLIDER_CONSTANT
-
1.0
);
rate
=
INPUT_RATE_DEFAULT
*
RATE_SLIDER_LENGTH
/
rate
=
INPUT_RATE_DEFAULT
/
var
;
(
sliderValue
*
(
RATE_SLIDER_MAXIMUM
-
1.0
)
+
RATE_SLIDER_LENGTH
)
;
}
}
THEMIM
->
getIM
()
->
setRate
(
rate
);
THEMIM
->
getIM
()
->
setRate
(
rate
);
...
...
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