Commit df7724ac authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

qt4: input_manager: Remove duplicated checks

parent 28639b28
...@@ -443,8 +443,7 @@ void InputManager::UpdateNavigation() ...@@ -443,8 +443,7 @@ void InputManager::UpdateNavigation()
vlc_value_t val; val.i_int = 0; vlc_value_t val; val.i_int = 0;
vlc_value_t val2; val2.i_int = 0; vlc_value_t val2; val2.i_int = 0;
if( hasInput() ) var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int > 0 ) if( val.i_int > 0 )
{ {
...@@ -488,8 +487,6 @@ void InputManager::UpdateRate() ...@@ -488,8 +487,6 @@ void InputManager::UpdateRate()
void InputManager::UpdateName() void InputManager::UpdateName()
{ {
assert( p_input );
/* Update text, name and nowplaying */ /* Update text, name and nowplaying */
QString name; QString name;
...@@ -568,99 +565,82 @@ bool InputManager::hasVisualisation() ...@@ -568,99 +565,82 @@ bool InputManager::hasVisualisation()
void InputManager::UpdateTeletext() void InputManager::UpdateTeletext()
{ {
if( hasInput() ) const bool b_enabled = var_CountChoices( p_input, "teletext-es" ) > 0;
{ const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
const bool b_enabled = var_CountChoices( p_input, "teletext-es" ) > 0;
const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
/* Teletext is possible. Show the buttons */ /* Teletext is possible. Show the buttons */
emit teletextPossible( b_enabled ); emit teletextPossible( b_enabled );
/* If Teletext is selected */ /* If Teletext is selected */
if( b_enabled && i_teletext_es >= 0 ) if( b_enabled && i_teletext_es >= 0 )
{ {
/* Then, find the current page */ /* Then, find the current page */
int i_page = 100; int i_page = 100;
bool b_transparent = false; bool b_transparent = false;
if( p_input_vbi )
{
var_DelCallback( p_input_vbi, "vbi-page", VbiEvent, this );
vlc_object_release( p_input_vbi );
}
if( input_GetEsObjects( p_input, i_teletext_es, &p_input_vbi, NULL, NULL ) ) if( p_input_vbi )
p_input_vbi = NULL; {
var_DelCallback( p_input_vbi, "vbi-page", VbiEvent, this );
vlc_object_release( p_input_vbi );
}
if( p_input_vbi ) if( input_GetEsObjects( p_input, i_teletext_es, &p_input_vbi, NULL, NULL ) )
{ p_input_vbi = NULL;
/* This callback is not remove explicitly, but interfaces
* are guaranted to outlive input */
var_AddCallback( p_input_vbi, "vbi-page", VbiEvent, this );
i_page = var_GetInteger( p_input_vbi, "vbi-page" ); if( p_input_vbi )
b_transparent = !var_GetBool( p_input_vbi, "vbi-opaque" ); {
} /* This callback is not remove explicitly, but interfaces
emit newTelexPageSet( i_page ); * are guaranted to outlive input */
emit teletextTransparencyActivated( b_transparent ); var_AddCallback( p_input_vbi, "vbi-page", VbiEvent, this );
i_page = var_GetInteger( p_input_vbi, "vbi-page" );
b_transparent = !var_GetBool( p_input_vbi, "vbi-opaque" );
} }
emit teletextActivated( b_enabled && i_teletext_es >= 0 ); emit newTelexPageSet( i_page );
} emit teletextTransparencyActivated( b_transparent );
else
{
emit teletextActivated( false );
emit teletextPossible( false );
} }
emit teletextActivated( b_enabled && i_teletext_es >= 0 );
} }
void InputManager::UpdateEPG() void InputManager::UpdateEPG()
{ {
if( hasInput() ) emit epgChanged();
{
emit epgChanged();
}
} }
void InputManager::UpdateVout() void InputManager::UpdateVout()
{ {
if( hasInput() ) /* Get current vout lists from input */
size_t i_vout;
vout_thread_t **pp_vout;
if( input_Control( p_input, INPUT_GET_VOUTS, &pp_vout, &i_vout ) )
{ {
/* Get current vout lists from input */ i_vout = 0;
size_t i_vout; pp_vout = NULL;
vout_thread_t **pp_vout; }
if( input_Control( p_input, INPUT_GET_VOUTS, &pp_vout, &i_vout ) )
{
i_vout = 0;
pp_vout = NULL;
}
/* */ /* */
emit voutListChanged( pp_vout, i_vout ); emit voutListChanged( pp_vout, i_vout );
/* */ /* */
bool b_old_video = b_video; bool b_old_video = b_video;
b_video = i_vout > 0; b_video = i_vout > 0;
if( !!b_old_video != !!b_video ) if( !!b_old_video != !!b_video )
emit voutChanged( b_video ); emit voutChanged( b_video );
/* Release the vout list */ /* Release the vout list */
for( size_t i = 0; i < i_vout; i++ ) for( size_t i = 0; i < i_vout; i++ )
vlc_object_release( (vlc_object_t*)pp_vout[i] ); vlc_object_release( (vlc_object_t*)pp_vout[i] );
free( pp_vout ); free( pp_vout );
}
} }
void InputManager::UpdateAout() void InputManager::UpdateAout()
{ {
if( hasInput() ) /* TODO */
{
/* TODO */
}
} }
void InputManager::UpdateCaching() void InputManager::UpdateCaching()
{ {
if(!hasInput()) return;
float f_newCache = var_GetFloat ( p_input, "cache" ); float f_newCache = var_GetFloat ( p_input, "cache" );
if( f_newCache != f_cache ) if( f_newCache != f_cache )
{ {
...@@ -724,10 +704,7 @@ const QString InputManager::decodeArtURL( input_item_t *p_item ) ...@@ -724,10 +704,7 @@ const QString InputManager::decodeArtURL( input_item_t *p_item )
void InputManager::UpdateArt() void InputManager::UpdateArt()
{ {
QString url; QString url = decodeArtURL( input_GetItem( p_input ) );
if( hasInput() )
url = decodeArtURL( input_GetItem( p_input ) );
/* the art hasn't changed, no need to update */ /* the art hasn't changed, no need to update */
if(artUrl == url) if(artUrl == url)
...@@ -758,7 +735,6 @@ void InputManager::setArt( input_item_t *p_item, QString fileUrl ) ...@@ -758,7 +735,6 @@ void InputManager::setArt( input_item_t *p_item, QString fileUrl )
inline void InputManager::UpdateStats() inline void InputManager::UpdateStats()
{ {
assert( p_input );
emit statisticsUpdated( input_GetItem( p_input ) ); emit statisticsUpdated( input_GetItem( p_input ) );
} }
...@@ -770,7 +746,6 @@ inline void InputManager::UpdateMeta( input_item_t *p_item_ ) ...@@ -770,7 +746,6 @@ inline void InputManager::UpdateMeta( input_item_t *p_item_ )
inline void InputManager::UpdateMeta() inline void InputManager::UpdateMeta()
{ {
assert( p_input );
emit currentMetaChanged( input_GetItem( p_input ) ); emit currentMetaChanged( input_GetItem( p_input ) );
} }
...@@ -782,19 +757,13 @@ inline void InputManager::UpdateInfo() ...@@ -782,19 +757,13 @@ inline void InputManager::UpdateInfo()
void InputManager::UpdateRecord() void InputManager::UpdateRecord()
{ {
if( hasInput() ) emit recordingStateChanged( var_GetBool( p_input, "record" ) );
{
emit recordingStateChanged( var_GetBool( p_input, "record" ) );
}
} }
void InputManager::UpdateProgramEvent() void InputManager::UpdateProgramEvent()
{ {
if( hasInput() ) bool b_scrambled = var_GetBool( p_input, "program-scrambled" );
{ emit encryptionChanged( b_scrambled );
bool b_scrambled = var_GetBool( p_input, "program-scrambled" );
emit encryptionChanged( b_scrambled );
}
} }
/* User update of the slider */ /* User update of the slider */
......
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