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
79bc7d59
Commit
79bc7d59
authored
Jul 07, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logarithmic slider for speed.
parent
162f08d7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
43 deletions
+17
-43
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.cpp
+17
-43
No files found.
modules/gui/qt4/components/interface_widgets.cpp
View file @
79bc7d59
...
@@ -52,6 +52,8 @@
...
@@ -52,6 +52,8 @@
# include <qx11info_x11.h>
# include <qx11info_x11.h>
#endif
#endif
#include <math.h>
/**********************************************************************
/**********************************************************************
* Video Widget. A simple frame on which video is drawn
* Video Widget. A simple frame on which video is drawn
* This class handles resize issues
* This class handles resize issues
...
@@ -1211,22 +1213,24 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
...
@@ -1211,22 +1213,24 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
speedSlider
->
setOrientation
(
Qt
::
Vertical
);
speedSlider
->
setOrientation
(
Qt
::
Vertical
);
speedSlider
->
setTickPosition
(
QSlider
::
TicksRight
);
speedSlider
->
setTickPosition
(
QSlider
::
TicksRight
);
speedSlider
->
setRange
(
-
100
,
100
);
speedSlider
->
setRange
(
-
24
,
24
);
speedSlider
->
setSingleStep
(
1
0
);
speedSlider
->
setSingleStep
(
1
);
speedSlider
->
setPageStep
(
20
);
speedSlider
->
setPageStep
(
1
);
speedSlider
->
setTickInterval
(
20
);
speedSlider
->
setTickInterval
(
12
);
CONNECT
(
speedSlider
,
valueChanged
(
int
),
this
,
updateRate
(
int
)
);
CONNECT
(
speedSlider
,
valueChanged
(
int
),
this
,
updateRate
(
int
)
);
QToolButton
*
normalSpeedButton
=
new
QToolButton
(
this
);
QToolButton
*
normalSpeedButton
=
new
QToolButton
(
this
);
normalSpeedButton
->
setMaximumSize
(
QSize
(
26
,
20
)
);
normalSpeedButton
->
setMaximumSize
(
QSize
(
26
,
20
)
);
normalSpeedButton
->
setAutoRaise
(
true
);
normalSpeedButton
->
setAutoRaise
(
true
);
normalSpeedButton
->
setText
(
"
N
"
);
normalSpeedButton
->
setText
(
"
1x
"
);
normalSpeedButton
->
setToolTip
(
qtr
(
"Revert to normal play speed"
)
);
normalSpeedButton
->
setToolTip
(
qtr
(
"Revert to normal play speed"
)
);
CONNECT
(
normalSpeedButton
,
clicked
(),
this
,
resetRate
()
);
CONNECT
(
normalSpeedButton
,
clicked
(),
this
,
resetRate
()
);
QVBoxLayout
*
speedControlLayout
=
new
QVBoxLayout
;
QVBoxLayout
*
speedControlLayout
=
new
QVBoxLayout
;
speedControlLayout
->
setLayoutMargins
(
4
,
4
,
4
,
4
,
4
);
speedControlLayout
->
setSpacing
(
4
);
speedControlLayout
->
addWidget
(
speedSlider
);
speedControlLayout
->
addWidget
(
speedSlider
);
speedControlLayout
->
addWidget
(
normalSpeedButton
);
speedControlLayout
->
addWidget
(
normalSpeedButton
);
setLayout
(
speedControlLayout
);
setLayout
(
speedControlLayout
);
...
@@ -1240,10 +1244,6 @@ void SpeedControlWidget::setEnable( bool b_enable )
...
@@ -1240,10 +1244,6 @@ void SpeedControlWidget::setEnable( bool b_enable )
speedSlider
->
setEnabled
(
b_enable
);
speedSlider
->
setEnabled
(
b_enable
);
}
}
#define RATE_SLIDER_MAXIMUM 3.0
#define RATE_SLIDER_MINIMUM 0.3
#define RATE_SLIDER_LENGTH 100.0
void
SpeedControlWidget
::
updateControls
(
int
rate
)
void
SpeedControlWidget
::
updateControls
(
int
rate
)
{
{
if
(
speedSlider
->
isSliderDown
()
)
if
(
speedSlider
->
isSliderDown
()
)
...
@@ -1252,33 +1252,17 @@ void SpeedControlWidget::updateControls( int rate )
...
@@ -1252,33 +1252,17 @@ void SpeedControlWidget::updateControls( int rate )
return
;
return
;
}
}
int
sliderValue
;
double
value
=
12
*
log
(
(
double
)
INPUT_RATE_DEFAULT
/
rate
)
/
log
(
2
)
;
double
speed
=
INPUT_RATE_DEFAULT
/
(
double
)
rate
;
int
sliderValue
=
(
int
)
(
(
value
>
0
)
?
value
+
.5
:
value
-
.5
)
;
if
(
rate
>=
INPUT_RATE_DEFAULT
)
if
(
sliderValue
<
speedSlider
->
minimum
()
)
{
if
(
speed
<
RATE_SLIDER_MINIMUM
)
{
{
sliderValue
=
speedSlider
->
minimum
();
sliderValue
=
speedSlider
->
minimum
();
}
}
else
else
if
(
sliderValue
>
speedSlider
->
maximum
()
)
{
sliderValue
=
(
int
)(
(
speed
-
1.0
)
*
RATE_SLIDER_LENGTH
/
(
1.0
-
RATE_SLIDER_MAXIMUM
)
);
}
}
else
{
if
(
speed
>
RATE_SLIDER_MAXIMUM
)
{
{
sliderValue
=
speedSlider
->
maximum
();
sliderValue
=
speedSlider
->
maximum
();
}
}
else
{
sliderValue
=
(
int
)(
(
speed
-
1.0
)
*
RATE_SLIDER_LENGTH
/
(
RATE_SLIDER_MAXIMUM
-
1.0
)
);
}
}
//Block signals to avoid feedback loop
//Block signals to avoid feedback loop
speedSlider
->
blockSignals
(
true
);
speedSlider
->
blockSignals
(
true
);
...
@@ -1288,18 +1272,8 @@ void SpeedControlWidget::updateControls( int rate )
...
@@ -1288,18 +1272,8 @@ void SpeedControlWidget::updateControls( int rate )
void
SpeedControlWidget
::
updateRate
(
int
sliderValue
)
void
SpeedControlWidget
::
updateRate
(
int
sliderValue
)
{
{
int
rate
;
double
speed
=
pow
(
2
,
(
double
)
sliderValue
/
12
);
int
rate
=
INPUT_RATE_DEFAULT
/
speed
;
if
(
sliderValue
<
0.0
)
{
rate
=
(
int
)(
INPUT_RATE_DEFAULT
*
RATE_SLIDER_LENGTH
/
(
sliderValue
*
(
1.0
-
RATE_SLIDER_MINIMUM
)
+
RATE_SLIDER_LENGTH
));
}
else
{
rate
=
(
int
)(
INPUT_RATE_DEFAULT
*
RATE_SLIDER_LENGTH
/
(
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