[vlc-commits] commit: Qt: use float for rate and fix a bug when mouseWheeling ( Jean-Baptiste Kempf )
git version control
git at videolan.org
Wed Mar 3 00:08:24 CET 2010
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Mar 3 00:07:10 2010 +0100| [757c699e0961682607f11986a9c442d2ecfb7317] | committer: Jean-Baptiste Kempf
Qt: use float for rate and fix a bug when mouseWheeling
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=757c699e0961682607f11986a9c442d2ecfb7317
---
modules/gui/qt4/components/interface_widgets.cpp | 14 +++++++-------
modules/gui/qt4/components/interface_widgets.hpp | 4 ++--
modules/gui/qt4/input_manager.cpp | 16 ++++++++--------
modules/gui/qt4/input_manager.hpp | 4 ++--
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 07d68e6..932b6bf 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -426,11 +426,11 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, QWidget *parent )
speedControlMenu->addAction( widgetAction );
/* Change the SpeedRate in the Status Bar */
- CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
+ CONNECT( THEMIM->getIM(), rateChanged( float ), this, setRate( float ) );
DCONNECT( THEMIM, inputChanged( input_thread_t * ),
speedControl, activateOnState() );
- setRate( INPUT_RATE_DEFAULT / var_InheritFloat( p_intf, "rate" ) );
+ setRate( var_InheritFloat( p_intf, "rate" ) );
}
SpeedLabel::~SpeedLabel()
@@ -449,10 +449,10 @@ void SpeedLabel::showSpeedMenu( QPoint pos )
+ QPoint( 0, height() ) );
}
-void SpeedLabel::setRate( int rate )
+void SpeedLabel::setRate( float rate )
{
QString str;
- str.setNum( ( 1000 / (double)rate ), 'f', 2 );
+ str.setNum( rate, 'f', 2 );
str.append( "x" );
setText( str );
setToolTip( str );
@@ -480,7 +480,7 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i, QWidget *_parent )
speedSlider->setPageStep( 1 );
speedSlider->setTickInterval( 17 );
- CONNECT( speedSlider, sliderMoved( int ), this, updateRate( int ) );
+ CONNECT( speedSlider, valueChanged( int ), this, updateRate( int ) );
QToolButton *normalSpeedButton = new QToolButton( this );
normalSpeedButton->setMaximumSize( QSize( 26, 20 ) );
@@ -504,7 +504,7 @@ void SpeedControlWidget::activateOnState()
speedSlider->setEnabled( THEMIM->getIM()->hasInput() );
}
-void SpeedControlWidget::updateControls( int rate )
+void SpeedControlWidget::updateControls( float rate )
{
if( speedSlider->isSliderDown() )
{
@@ -512,7 +512,7 @@ void SpeedControlWidget::updateControls( int rate )
return;
}
- double value = 17 * log( (double)INPUT_RATE_DEFAULT / rate ) / log( 2 );
+ double value = 17 * log( rate ) / log( 2 );
int sliderValue = (int) ( ( value > 0 ) ? value + .5 : value - .5 );
if( sliderValue < speedSlider->minimum() )
diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp
index 3d57e08..9802b04 100644
--- a/modules/gui/qt4/components/interface_widgets.hpp
+++ b/modules/gui/qt4/components/interface_widgets.hpp
@@ -172,7 +172,7 @@ protected:
}
private slots:
void showSpeedMenu( QPoint );
- void setRate( int );
+ void setRate( float );
private:
intf_thread_t *p_intf;
QMenu *speedControlMenu;
@@ -185,7 +185,7 @@ class SpeedControlWidget : public QFrame
Q_OBJECT
public:
SpeedControlWidget( intf_thread_t *, QWidget * );
- void updateControls( int );
+ void updateControls( float );
private:
intf_thread_t *p_intf;
QSlider *speedSlider;
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 5a48df9..b589564 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -79,7 +79,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
artUrl = "";
p_input = NULL;
p_input_vbi = NULL;
- i_rate = 0;
+ f_rate = 0;
p_item = NULL;
b_video = false;
timeA = 0;
@@ -111,14 +111,14 @@ void InputManager::setInput( input_thread_t *_p_input )
UpdateVout();
addCallbacks();
p_item = input_GetItem( p_input );
- emit rateChanged( INPUT_RATE_DEFAULT / var_GetFloat( p_input, "rate" ) );
+ emit rateChanged( var_GetFloat( p_input, "rate" ) );
}
else
{
p_input = NULL;
p_item = NULL;
assert( !p_input_vbi );
- emit rateChanged( INPUT_RATE_DEFAULT / var_InheritFloat( p_intf, "rate" ) );
+ emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
}
}
@@ -149,7 +149,7 @@ void InputManager::delInput()
p_input = NULL;
emit positionUpdated( -1.0, 0 ,0 );
- emit rateChanged( INPUT_RATE_DEFAULT / var_InheritFloat( p_intf, "rate" ) );
+ emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
emit nameChanged( "" );
emit chapterChanged( 0 );
emit titleChanged( 0 );
@@ -431,12 +431,12 @@ void InputManager::UpdateStatus()
void InputManager::UpdateRate()
{
/* Update Rate */
- int i_new_rate = INPUT_RATE_DEFAULT / var_GetFloat( p_input, "rate" );
- if( i_new_rate != i_rate )
+ float f_new_rate = var_GetFloat( p_input, "rate" );
+ if( f_new_rate != f_rate )
{
- i_rate = i_new_rate;
+ f_rate = f_new_rate;
/* Update rate */
- emit rateChanged( i_rate );
+ emit rateChanged( f_rate );
}
}
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 6a856f1..d96c0a0 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -144,7 +144,7 @@ private:
int i_old_playing_status;
QString oldName;
QString artUrl;
- int i_rate;
+ float f_rate;
float f_cache;
bool b_video;
mtime_t timeA, timeB;
@@ -204,7 +204,7 @@ signals:
/// Send new position, new time and new length
void positionUpdated( float , int64_t, int );
void seekRequested( float pos );
- void rateChanged( int );
+ void rateChanged( float );
void nameChanged( const QString& );
/// Used to signal whether we should show navigation buttons
void titleChanged( bool );
More information about the vlc-commits
mailing list