Commit c5e715f7 authored by Jean-Baptiste Kempf's avatar 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.
parent f5bf2d94
...@@ -521,8 +521,8 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf ) :QLabel(), p_intf( _p_intf ) ...@@ -521,8 +521,8 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf ) :QLabel(), p_intf( _p_intf )
setToolTip( qtr( "Toggle between elapsed and remaining time" ) ); setToolTip( qtr( "Toggle between elapsed and remaining time" ) );
/* CONNECT( THEMIM->getIM(), statusChanged( int ), CONNECT( THEMIM->getIM(), cachingChanged( float ),
this, setStatus( int ) ); Remove */ this, setCaching( float ) );
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ), CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
this, setDisplayPosition( float, int, int ) ); this, setDisplayPosition( float, int, int ) );
} }
...@@ -547,13 +547,10 @@ void TimeLabel::toggleTimeDisplay() ...@@ -547,13 +547,10 @@ void TimeLabel::toggleTimeDisplay()
{ {
b_remainingTime = !b_remainingTime; 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 ) void TimeLabel::setCaching( float f_cache )
setText( "Buffering" ); {
setText( "Buffering" );
} }
...@@ -147,7 +147,7 @@ signals: ...@@ -147,7 +147,7 @@ signals:
void timeLabelDoubleClicked(); void timeLabelDoubleClicked();
private slots: private slots:
void setDisplayPosition( float pos, int time, int length ); void setDisplayPosition( float pos, int time, int length );
void setStatus( int i_status ); void setCaching( float );
}; };
class SpeedLabel : public QLabel class SpeedLabel : public QLabel
......
...@@ -164,9 +164,13 @@ void InputManager::customEvent( QEvent *event ) ...@@ -164,9 +164,13 @@ void InputManager::customEvent( QEvent *event )
i_type != MetaChanged_Type && i_type != MetaChanged_Type &&
i_type != NameChanged_Type && i_type != NameChanged_Type &&
i_type != InfoChanged_Type && i_type != InfoChanged_Type &&
i_type != SynchroChanged_Type ) i_type != SynchroChanged_Type &&
i_type != CachingEvent_Type )
return; return;
if( i_type == CachingEvent_Type )
UpdateCaching();
if( !hasInput() ) return; if( !hasInput() ) return;
if( ( i_type != PositionUpdate_Type && if( ( i_type != PositionUpdate_Type &&
...@@ -241,6 +245,9 @@ void InputManager::customEvent( QEvent *event ) ...@@ -241,6 +245,9 @@ void InputManager::customEvent( QEvent *event )
case SynchroChanged_Type: case SynchroChanged_Type:
emit synchroChanged(); emit synchroChanged();
break; break;
case CachingEvent_Type:
UpdateCaching();
break;
default: default:
msg_Warn( p_intf, "This shouldn't happen: %i", i_type ); msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
} }
...@@ -387,6 +394,17 @@ void InputManager::UpdateVout() ...@@ -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() inline void InputManager::UpdateArt()
{ {
/* Update Art meta */ /* Update Art meta */
...@@ -814,11 +832,14 @@ static int InputEvent( vlc_object_t *p_this, const char *, ...@@ -814,11 +832,14 @@ static int InputEvent( vlc_object_t *p_this, const char *,
event = new IMEvent( SynchroChanged_Type, 0 ); event = new IMEvent( SynchroChanged_Type, 0 );
break; break;
case INPUT_EVENT_CACHE:
event = new IMEvent( CachingEvent_Type, 0 );
break;
case INPUT_EVENT_PROGRAM: case INPUT_EVENT_PROGRAM:
case INPUT_EVENT_RECORD: case INPUT_EVENT_RECORD:
case INPUT_EVENT_SIGNAL: case INPUT_EVENT_SIGNAL:
case INPUT_EVENT_BOOKMARK: case INPUT_EVENT_BOOKMARK:
case INPUT_EVENT_CACHE:
default: default:
event = NULL; event = NULL;
break; break;
......
...@@ -52,6 +52,7 @@ enum { ...@@ -52,6 +52,7 @@ enum {
NameChanged_Type, NameChanged_Type,
InfoChanged_Type, InfoChanged_Type,
SynchroChanged_Type, SynchroChanged_Type,
CachingEvent_Type,
FullscreenControlToggle_Type = QEvent::User + IMEventType + 20, FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
FullscreenControlShow_Type, FullscreenControlShow_Type,
...@@ -102,6 +103,7 @@ private: ...@@ -102,6 +103,7 @@ private:
QString oldName; QString oldName;
QString artUrl; QString artUrl;
int i_rate; int i_rate;
float f_cache;
bool b_video; bool b_video;
mtime_t timeA, timeB; mtime_t timeA, timeB;
...@@ -121,6 +123,7 @@ private: ...@@ -121,6 +123,7 @@ private:
void UpdateMeta(); void UpdateMeta();
void UpdateVout(); void UpdateVout();
void UpdateStats(); void UpdateStats();
void UpdateCaching();
void AtoBLoop( int ); void AtoBLoop( int );
...@@ -173,6 +176,7 @@ signals: ...@@ -173,6 +176,7 @@ signals:
/// Vout /// Vout
void voutChanged( bool ); void voutChanged( bool );
void synchroChanged(); void synchroChanged();
void cachingChanged( float );
}; };
class MainInputManager : public QObject class MainInputManager : public QObject
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment