[vlc-devel] commit: Qt: react to caching Event from input to display Buffering. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Jan 2 16:03:04 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jan  2 15:31:10 2009 +0100| [c5e715f78c8ff8c418eafb8bb1e8709b8d6dc5a7] | committer: Jean-Baptiste Kempf 

Qt: react to caching Event from input to display Buffering.

This doesn't work yet, however, since p_input == NULL in the input_manager at the time this is displayed...
A fix is needed.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c5e715f78c8ff8c418eafb8bb1e8709b8d6dc5a7
---

 modules/gui/qt4/components/interface_widgets.cpp |   13 ++++-------
 modules/gui/qt4/components/interface_widgets.hpp |    2 +-
 modules/gui/qt4/input_manager.cpp                |   25 ++++++++++++++++++++-
 modules/gui/qt4/input_manager.hpp                |    4 +++
 4 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 7807fa5..2d47104 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -521,8 +521,8 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf  ) :QLabel(), p_intf( _p_intf )
    setToolTip( qtr( "Toggle between elapsed and remaining time" ) );
 
 
-/*   CONNECT( THEMIM->getIM(), statusChanged( int ),
-            this, setStatus( int ) ); Remove */
+   CONNECT( THEMIM->getIM(), cachingChanged( float ),
+            this, setCaching( float ) );
    CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
              this, setDisplayPosition( float, int, int ) );
 }
@@ -547,13 +547,10 @@ void TimeLabel::toggleTimeDisplay()
 {
     b_remainingTime = !b_remainingTime;
 }
-/* This is wrong remove */
-void TimeLabel::setStatus( int i_status )
-{
-    msg_Warn( p_intf, "Status: %i", i_status );
 
-    if( i_status == OPENING_S )
-        setText( "Buffering" );
+void TimeLabel::setCaching( float f_cache )
+{
+    setText( "Buffering" );
 }
 
 
diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp
index 619c7c5..09ec267 100644
--- a/modules/gui/qt4/components/interface_widgets.hpp
+++ b/modules/gui/qt4/components/interface_widgets.hpp
@@ -147,7 +147,7 @@ signals:
     void timeLabelDoubleClicked();
 private slots:
     void setDisplayPosition( float pos, int time, int length );
-    void setStatus( int i_status );
+    void setCaching( float );
 };
 
 class SpeedLabel : public QLabel
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 4ce1dd7..86e8547 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -164,9 +164,13 @@ void InputManager::customEvent( QEvent *event )
          i_type != MetaChanged_Type &&
          i_type != NameChanged_Type &&
          i_type != InfoChanged_Type &&
-         i_type != SynchroChanged_Type )
+         i_type != SynchroChanged_Type &&
+         i_type != CachingEvent_Type )
         return;
 
+    if( i_type == CachingEvent_Type )
+        UpdateCaching();
+
     if( !hasInput() ) return;
 
     if( ( i_type != PositionUpdate_Type  &&
@@ -241,6 +245,9 @@ void InputManager::customEvent( QEvent *event )
     case SynchroChanged_Type:
         emit synchroChanged();
         break;
+    case CachingEvent_Type:
+        UpdateCaching();
+        break;
     default:
         msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
     }
@@ -387,6 +394,17 @@ void InputManager::UpdateVout()
     }
 }
 
+void InputManager::UpdateCaching()
+{
+    float f_newCache = var_GetFloat( p_input, "cache" );
+    if( f_newCache != f_cache )
+    {
+        f_newCache = f_cache;
+        /* Update rate */
+        emit cachingChanged( f_cache );
+    }
+}
+
 inline void InputManager::UpdateArt()
 {
     /* Update Art meta */
@@ -814,11 +832,14 @@ static int InputEvent( vlc_object_t *p_this, const char *,
         event = new IMEvent( SynchroChanged_Type, 0 );
         break;
 
+    case INPUT_EVENT_CACHE:
+        event = new IMEvent( CachingEvent_Type, 0 );
+        break;
+
     case INPUT_EVENT_PROGRAM:
     case INPUT_EVENT_RECORD:
     case INPUT_EVENT_SIGNAL:
     case INPUT_EVENT_BOOKMARK:
-    case INPUT_EVENT_CACHE:
     default:
         event = NULL;
         break;
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 426e090..057a0b2 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -52,6 +52,7 @@ enum {
     NameChanged_Type,
     InfoChanged_Type,
     SynchroChanged_Type,
+    CachingEvent_Type,
 
     FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
     FullscreenControlShow_Type,
@@ -102,6 +103,7 @@ private:
     QString         oldName;
     QString         artUrl;
     int             i_rate;
+    float           f_cache;
     bool            b_video;
     mtime_t         timeA, timeB;
 
@@ -121,6 +123,7 @@ private:
     void UpdateMeta();
     void UpdateVout();
     void UpdateStats();
+    void UpdateCaching();
 
     void AtoBLoop( int );
 
@@ -173,6 +176,7 @@ signals:
     /// Vout
     void voutChanged( bool );
     void synchroChanged();
+    void cachingChanged( float );
 };
 
 class MainInputManager : public QObject




More information about the vlc-devel mailing list