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 )
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" );
}
......@@ -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
......
......@@ -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;
......
......@@ -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
......
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