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
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 ) :
speedSlider
->
setMaximumSize
(
QSize
(
80
,
200
)
);
speedSlider
->
setOrientation
(
Qt
::
Vertical
);
speedSlider
->
setTickPosition
(
QSlider
::
TicksRight
);
speedSlider
->
setFocusPolicy
(
Qt
::
NoFocus
);
speedSlider
->
setMinimum
(
-
100
);
speedSlider
->
setMaximum
(
100
);
speedSlider
->
setRange
(
-
100
,
100
);
speedSlider
->
setSingleStep
(
10
);
speedSlider
->
setPageStep
(
20
);
speedSlider
->
setTickInterval
(
20
);
CONNECT
(
speedSlider
,
valueChanged
(
int
),
this
,
updateRate
(
int
)
);
//QWidgetAction *wa = new QWidgetAction( this );
//wa->setDefaultWidget( playSpeedSlider );
//menu.addAction( wa );
normalSpeedButton
=
new
QPushButton
(
"N"
);
//BUTTON_SET_ACT( revertToNormalButton, "N", qtr( "Normal" ), slower() );
//controlLayout->addWidget( revertToNormalButton, 0, 0 );
normalSpeedButton
->
setMaximumSize
(
QSize
(
26
,
20
)
);
normalSpeedButton
->
setFlat
(
true
);
normalSpeedButton
->
setFlat
(
true
);
normalSpeedButton
->
setToolTip
(
qtr
(
"Revert to normal play speed"
)
);
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
;
speedControlLayout
->
addWidget
(
speedSlider
);
speedControlLayout
->
addWidget
(
normalSpeedButton
);
//speedControlLayout->addWidget(volMuteLabel);
setLayout
(
speedControlLayout
);
}
...
...
@@ -799,12 +785,9 @@ SpeedControlWidget::~SpeedControlWidget()
{
}
#define RATE_SLIDER_CONSTANT 3.0
#define SLIDER_MIN_SPEED 1.0 / RATE_SLIDER_CONSTANT
#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
#define RATE_SLIDER_MAXIMUM 3.0
#define RATE_SLIDER_MINIMUM 0.3
#define RATE_SLIDER_LENGTH 100.0
void
SpeedControlWidget
::
updateControls
(
int
rate
)
{
...
...
@@ -819,49 +802,48 @@ void SpeedControlWidget::updateControls( int rate )
if
(
rate
>=
INPUT_RATE_DEFAULT
)
{
if
(
speed
<
SLIDER_MIN_SPEED
)
if
(
speed
<
RATE_SLIDER_MINIMUM
)
{
sliderValue
=
speedSlider
->
minimum
();
}
else
{
double
currPos
=
speed
/
(
double
)(
SLIDER_SLOW_RANGE
);
sliderValue
=
(
int
)(
currPos
*
speedSlider
->
minimum
(
)
);
sliderValue
=
(
int
)(
(
speed
-
1.0
)
*
RATE_SLIDER_LENGTH
/
(
1.0
-
RATE_SLIDER_MAXIMUM
)
);
}
}
else
{
if
(
speed
>
SLIDER_MAX_SPEED
)
if
(
speed
>
RATE_SLIDER_MAXIMUM
)
{
sliderValue
=
speedSlider
->
maximum
();
}
else
{
double
currPos
=
(
1.0
-
speed
)
/
(
double
)(
SLIDER_FAST_RANGE
);
sliderValue
=
(
int
)(
currPos
*
speedSlider
->
maximum
(
)
);
sliderValue
=
(
int
)(
(
speed
-
1.0
)
*
RATE_SLIDER_LENGTH
/
(
RATE_SLIDER_MAXIMUM
-
1.0
)
);
}
}
//Block signals to avoid feedback loop
speedSlider
->
blockSignals
(
true
);
speedSlider
->
setValue
(
sliderValue
);
speedSlider
->
blockSignals
(
false
);
speedSlider
->
blockSignals
(
true
);
speedSlider
->
setValue
(
sliderValue
);
speedSlider
->
blockSignals
(
false
);
}
void
SpeedControlWidget
::
updateRate
(
int
sliderValue
)
{
int
rate
;
double
var
;
if
(
sliderValue
<
0.0
)
{
var
=
1.0
+
((
-
sliderValue
/
100.0
)
*
RATE_SLIDER_CONSTANT
-
1.0
);
rate
=
INPUT_RATE_DEFAULT
*
var
;
rate
=
INPUT_RATE_DEFAULT
*
RATE_SLIDER_LENGTH
/
(
sliderValue
*
(
1.0
-
RATE_SLIDER_MINIMUM
)
+
RATE_SLIDER_LENGTH
)
;
}
else
{
var
=
1.0
+
((
sliderValue
/
100.0
)
*
RATE_SLIDER_CONSTANT
-
1.0
);
rate
=
INPUT_RATE_DEFAULT
/
var
;
rate
=
INPUT_RATE_DEFAULT
*
RATE_SLIDER_LENGTH
/
(
sliderValue
*
(
RATE_SLIDER_MAXIMUM
-
1.0
)
+
RATE_SLIDER_LENGTH
)
;
}
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