[vlc-devel] commit: Fixed QT4 teletext buttons. (Laurent Aimar )

git version control git at videolan.org
Fri Feb 13 23:07:51 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Feb 13 23:05:45 2009 +0100| [ed2ceb36cdac4b997549726ccfc087c080c46185] | committer: Laurent Aimar 

Fixed QT4 teletext buttons.

The page value is not yet correctly synchronized.

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

 modules/gui/qt4/components/controller.cpp |    6 +++++-
 modules/gui/qt4/input_manager.cpp         |   29 ++++++++++++++---------------
 2 files changed, 19 insertions(+), 16 deletions(-)

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




More information about the vlc-devel mailing list