Commit ed2ceb36 authored by Laurent Aimar's avatar Laurent Aimar

Fixed QT4 teletext buttons.

The page value is not yet correctly synchronized.
parent 83010dc8
...@@ -490,12 +490,16 @@ QFrame *AbstractController::telexFrame() ...@@ -490,12 +490,16 @@ QFrame *AbstractController::telexFrame()
QToolButton *telexOn = new QToolButton; QToolButton *telexOn = new QToolButton;
setupButton( telexOn ); setupButton( telexOn );
BUTTON_SET_BAR2( telexOn, tv, qtr( "Teletext Activation" ) ); BUTTON_SET_BAR2( telexOn, tv, qtr( "Teletext Activation" ) );
telexOn->setEnabled( false );
telexOn->setCheckable( true );
telexLayout->addWidget( telexOn ); telexLayout->addWidget( telexOn );
/* Teletext Activation and set */ /* Teletext Activation and set */
CONNECT( telexOn, clicked( bool ), CONNECT( telexOn, clicked( bool ),
THEMIM->getIM(), activateTeletext( bool ) ); THEMIM->getIM(), activateTeletext( bool ) );
CONNECT( THEMIM->getIM(), teletextPossible( bool ),
telexOn, setEnabled( bool ) );
/* Transparency button */ /* Transparency button */
QToolButton *telexTransparent = new QToolButton; QToolButton *telexTransparent = new QToolButton;
......
...@@ -196,7 +196,8 @@ void InputManager::customEvent( QEvent *event ) ...@@ -196,7 +196,8 @@ void InputManager::customEvent( QEvent *event )
UpdateRate(); UpdateRate();
break; break;
case ItemEsChanged_Type: case ItemEsChanged_Type:
// We don't do anything. Why ? UpdateTeletext();
// We don't do anything ES related. Why ?
break; break;
case ItemTeletextChanged_Type: case ItemTeletextChanged_Type:
UpdateTeletext(); UpdateTeletext();
...@@ -455,7 +456,7 @@ bool InputManager::hasAudio() ...@@ -455,7 +456,7 @@ bool InputManager::hasAudio()
void InputManager::UpdateTeletext() void InputManager::UpdateTeletext()
{ {
if( hasInput() ) if( hasInput() )
telexActivation( var_GetInteger( p_input, "teletext-es" ) >= 0 ); telexActivation( var_CountChoices( p_input, "teletext-es" ) > 0 );
else else
telexActivation( false ); telexActivation( false );
} }
...@@ -639,9 +640,8 @@ void InputManager::telexSetPage( int page ) ...@@ -639,9 +640,8 @@ void InputManager::telexSetPage( int page )
if( hasInput() ) if( hasInput() )
{ {
const int i_teletext_es = var_GetInteger( p_input, "teletext-es" ); const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
const int i_spu_es = var_GetInteger( p_input, "spu-es" );
if( i_teletext_es >= 0 && i_teletext_es == i_spu_es ) if( i_teletext_es >= 0 )
{ {
vlc_object_t *p_vbi = (vlc_object_t *) vlc_object_find_name( p_input, vlc_object_t *p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
"zvbi", FIND_ANYWHERE ); "zvbi", FIND_ANYWHERE );
...@@ -664,7 +664,7 @@ void InputManager::telexSetTransparency( bool b_transparentTelextext ) ...@@ -664,7 +664,7 @@ void InputManager::telexSetTransparency( bool b_transparentTelextext )
"zvbi", FIND_ANYWHERE ); "zvbi", FIND_ANYWHERE );
if( p_vbi ) if( p_vbi )
{ {
var_SetBool( p_vbi, "vbi-opaque", b_transparentTelextext ); var_SetBool( p_vbi, "vbi-opaque", !b_transparentTelextext );
vlc_object_release( p_vbi ); vlc_object_release( p_vbi );
emit teletextTransparencyActivated( b_transparentTelextext ); emit teletextTransparencyActivated( b_transparentTelextext );
} }
...@@ -676,18 +676,17 @@ void InputManager::telexActivation( bool b_enabled ) ...@@ -676,18 +676,17 @@ void InputManager::telexActivation( bool b_enabled )
if( hasInput() ) if( hasInput() )
{ {
const int i_teletext_es = var_GetInteger( p_input, "teletext-es" ); const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
const int i_spu_es = var_GetInteger( p_input, "spu-es" );
/* Teletext is possible. Show the buttons */ /* Teletext is possible. Show the buttons */
b_enabled = (i_teletext_es >= 0); b_enabled = var_CountChoices( p_input, "teletext-es" ) > 0;
emit teletextPossible( b_enabled ); emit teletextPossible( b_enabled );
if( !b_enabled ) return; if( !b_enabled ) return;
/* If Teletext is selected */ /* If Teletext is selected */
if( i_teletext_es == i_spu_es ) if( i_teletext_es >= 0 )
{ {
/* Activate the buttons */ /* Activate the buttons */
teletextActivated( true ); emit teletextActivated( true );
/* Then, find the current page */ /* Then, find the current page */
int i_page = 100; int i_page = 100;
...@@ -707,13 +706,13 @@ void InputManager::telexActivation( bool b_enabled ) ...@@ -707,13 +706,13 @@ void InputManager::telexActivation( bool b_enabled )
void InputManager::activateTeletext( bool b_enable ) void InputManager::activateTeletext( bool b_enable )
{ {
if( hasInput() ) vlc_value_t list;
if( hasInput() && !var_Change( p_input, "teletext-es", VLC_VAR_GETLIST, &list, NULL ) )
{ {
const int i_teletext_es = var_GetInteger( p_input, "teletext-es" ); if( list.p_list->i_count > 0 )
if( i_teletext_es >= 0 ) var_SetInteger( p_input, "spu-es", b_enable ? list.p_list->p_values[0].i_int : -1 );
{
var_SetInteger( p_input, "spu-es", b_enable ? i_teletext_es : -1 ); var_Change( p_input, "teletext-es", VLC_VAR_FREELIST, &list, NULL );
}
} }
} }
......
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