From 9cbb99e3f84e8976a8b4356371e0361725213f07 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Sat, 8 Sep 2007 13:45:25 +0000 Subject: [PATCH] Qt4 - MainInterface and InputManager: setRate actually shows something in the interface. --- modules/gui/qt4/input_manager.cpp | 5 ++++- modules/gui/qt4/input_manager.hpp | 1 + modules/gui/qt4/main_interface.cpp | 17 ++++++++++++++--- modules/gui/qt4/main_interface.hpp | 4 +++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp index 36459d6744..6f8e175ef1 100644 --- a/modules/gui/qt4/input_manager.cpp +++ b/modules/gui/qt4/input_manager.cpp @@ -100,8 +100,11 @@ void InputManager::update() i_time = var_GetTime( p_input, "time") / 1000000; f_pos = var_GetFloat( p_input, "position" ); emit positionUpdated( f_pos, i_time, i_length ); + + /* Update rate */ + emit rateChanged( var_GetInteger( p_input, "rate") ); - /* Update disc status */ + /* Update navigation status */ vlc_value_t val; val.i_int = 0; var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); if( val.i_int > 0 ) diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp index 816504246c..9e75acbb31 100644 --- a/modules/gui/qt4/input_manager.hpp +++ b/modules/gui/qt4/input_manager.hpp @@ -60,6 +60,7 @@ public slots: signals: /// Send new position, new time and new length void positionUpdated( float , int, int ); + void rateChanged( int ); void nameChanged( QString ); /// Used to signal whether we should show navigation buttons void navigationChanged( int ); diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index 09d88dd6a9..f13303ee4e 100644 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -183,8 +183,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) /* Connect the input manager to the GUI elements it manages */ /* It is also connected to the control->slider, see the ControlsWidget */ CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ), - this, setDisplay( float, int, int ) ); - + this, setDisplayPosition( float, int, int ) ); + + CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) ); + /** Connects on nameChanged() */ /* Naming in the controller statusbar */ CONNECT( THEMIM->getIM(), nameChanged( QString ), this, @@ -655,7 +657,7 @@ bool MainInterface::isAdvancedVisible() /************************************************************************ * Other stuff ************************************************************************/ -void MainInterface::setDisplay( float pos, int time, int length ) +void MainInterface::setDisplayPosition( float pos, int time, int length ) { char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE]; secstotimestr( psz_length, length ); @@ -686,6 +688,15 @@ void MainInterface::setStatus( int status ) updateSystrayMenu( status ); } +void MainInterface::setRate( int rate ) +{ + msg_Dbg( p_intf, "raaahhh %i", rate ); + QString str; + str.setNum( ( 1000/(double)rate), 'f', 2 ); + str.append( "x" ); + speedLabel->setText( str ); +} + void MainInterface::updateOnTimer() { /* \todo Make this event-driven */ diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp index 797ce02b4b..10904f1ed2 100644 --- a/modules/gui/qt4/main_interface.hpp +++ b/modules/gui/qt4/main_interface.hpp @@ -128,10 +128,12 @@ public slots: void toggleAdvanced(); private slots: void updateOnTimer(); + void setStatus( int ); + void setRate( int ); void setName( QString ); void setVLCWindowsTitle( QString title = "" ); - void setDisplay( float, int, int ); + void setDisplayPosition( float, int, int ); void toggleTimeDisplay(); void setElapsedTime(); void setRemainTime(); -- 2.39.5