Commit a3694386 authored by Laurent Aimar's avatar Laurent Aimar

Update qt4 interface to use new "teletex-es". It fixes the unwanted display

of teletext buttons every time there was a subtitle track.
parent 0e3098c5
...@@ -539,7 +539,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -539,7 +539,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
CONNECT( THEMIM->getIM(), toggleTelexTransparency(), CONNECT( THEMIM->getIM(), toggleTelexTransparency(),
this, toggleTeletextTransparency() ); this, toggleTeletextTransparency() );
CONNECT( THEMIM->getIM(), teletextEnabled( bool ), CONNECT( THEMIM->getIM(), teletextEnabled( bool ),
telexFrame, setVisible( bool ) ); this, enableTeletext( bool ) );
/** Play Buttons **/ /** Play Buttons **/
QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
...@@ -684,6 +684,16 @@ void ControlsWidget::toggleTeletext() ...@@ -684,6 +684,16 @@ void ControlsWidget::toggleTeletext()
b_telexEnabled = true; b_telexEnabled = true;
} }
} }
void ControlsWidget::enableTeletext( bool b_enable )
{
telexFrame->setVisible( b_enable );
bool b_on = THEMIM->teletextState();
telexOn->setChecked( b_on );
telexTransparent->setEnabled( b_on );
telexPage->setEnabled( b_on );
b_telexEnabled = b_on;
}
void ControlsWidget::toggleTeletextTransparency() void ControlsWidget::toggleTeletextTransparency()
{ {
......
...@@ -228,6 +228,7 @@ protected slots: ...@@ -228,6 +228,7 @@ protected slots:
void toggleAdvanced(); void toggleAdvanced();
void toggleTeletext(); void toggleTeletext();
void toggleTeletextTransparency(); void toggleTeletextTransparency();
void enableTeletext( bool );
signals: signals:
void advancedControlsToggled( bool ); void advancedControlsToggled( bool );
}; };
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
static int ChangeSPU( vlc_object_t *p_this, const char *var, vlc_value_t o, static int ChangeSPU( vlc_object_t *p_this, const char *var, vlc_value_t o,
vlc_value_t n, void *param ); vlc_value_t n, void *param );
static int ChangeTeletext( vlc_object_t *p_this, const char *var, vlc_value_t o,
vlc_value_t n, void *param );
static int ItemChanged( vlc_object_t *, const char *, static int ItemChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int PLItemChanged( vlc_object_t *, const char *, static int PLItemChanged( vlc_object_t *, const char *,
...@@ -85,6 +89,7 @@ void InputManager::setInput( input_thread_t *_p_input ) ...@@ -85,6 +89,7 @@ void InputManager::setInput( input_thread_t *_p_input )
UpdateMeta(); UpdateMeta();
UpdateArt(); UpdateArt();
UpdateSPU(); UpdateSPU();
UpdateTeletext();
UpdateNavigation(); UpdateNavigation();
addCallbacks(); addCallbacks();
i_input_id = input_GetItem( p_input )->i_id; i_input_id = input_GetItem( p_input )->i_id;
...@@ -118,6 +123,7 @@ void InputManager::delInput() ...@@ -118,6 +123,7 @@ void InputManager::delInput()
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = NULL; p_input = NULL;
UpdateSPU(); UpdateSPU();
UpdateTeletext();
} }
} }
...@@ -136,6 +142,8 @@ void InputManager::addCallbacks() ...@@ -136,6 +142,8 @@ void InputManager::addCallbacks()
var_AddCallback( p_input, "state", ItemStateChanged, this ); var_AddCallback( p_input, "state", ItemStateChanged, this );
/* src/input/es-out.c:552 */ /* src/input/es-out.c:552 */
var_AddCallback( p_input, "spu-es", ChangeSPU, this ); var_AddCallback( p_input, "spu-es", ChangeSPU, this );
/* src/input/es-out.c: */
var_AddCallback( p_input, "teletext-es", ChangeTeletext, this );
/* src/input/input.c:1765 */ /* src/input/input.c:1765 */
var_AddCallback( p_input, "rate-change", ItemRateChanged, this ); var_AddCallback( p_input, "rate-change", ItemRateChanged, this );
/* src/input/input.c:2003 */ /* src/input/input.c:2003 */
...@@ -148,6 +156,7 @@ void InputManager::addCallbacks() ...@@ -148,6 +156,7 @@ void InputManager::addCallbacks()
void InputManager::delCallbacks() void InputManager::delCallbacks()
{ {
var_DelCallback( p_input, "spu-es", ChangeSPU, this ); var_DelCallback( p_input, "spu-es", ChangeSPU, this );
var_DelCallback( p_input, "teletext-es", ChangeTeletext, this );
var_DelCallback( p_input, "state", ItemStateChanged, this ); var_DelCallback( p_input, "state", ItemStateChanged, this );
var_DelCallback( p_input, "rate-change", ItemRateChanged, this ); var_DelCallback( p_input, "rate-change", ItemRateChanged, this );
var_DelCallback( p_input, "title", ItemTitleChanged, this ); var_DelCallback( p_input, "title", ItemTitleChanged, this );
...@@ -165,6 +174,7 @@ void InputManager::customEvent( QEvent *event ) ...@@ -165,6 +174,7 @@ void InputManager::customEvent( QEvent *event )
type != ItemRateChanged_Type && type != ItemRateChanged_Type &&
type != ItemTitleChanged_Type && type != ItemTitleChanged_Type &&
type != ItemSpuChanged_Type && type != ItemSpuChanged_Type &&
type != ItemTeletextChanged_Type &&
type != ItemStateChanged_Type ) type != ItemStateChanged_Type )
return; return;
...@@ -173,6 +183,7 @@ void InputManager::customEvent( QEvent *event ) ...@@ -173,6 +183,7 @@ void InputManager::customEvent( QEvent *event )
if( ( type != PositionUpdate_Type && if( ( type != PositionUpdate_Type &&
type != ItemRateChanged_Type && type != ItemRateChanged_Type &&
type != ItemSpuChanged_Type && type != ItemSpuChanged_Type &&
type != ItemTeletextChanged_Type &&
type != ItemStateChanged_Type type != ItemStateChanged_Type
) )
&& ( i_input_id != ple->i_id ) ) && ( i_input_id != ple->i_id ) )
...@@ -207,6 +218,9 @@ void InputManager::customEvent( QEvent *event ) ...@@ -207,6 +218,9 @@ void InputManager::customEvent( QEvent *event )
case ItemSpuChanged_Type: case ItemSpuChanged_Type:
UpdateSPU(); UpdateSPU();
break; break;
case ItemTeletextChanged_Type:
UpdateTeletext();
break;
} }
} }
...@@ -327,19 +341,20 @@ bool InputManager::hasVideo() ...@@ -327,19 +341,20 @@ bool InputManager::hasVideo()
} }
void InputManager::UpdateSPU() void InputManager::UpdateSPU()
{
UpdateTeletext();
}
void InputManager::UpdateTeletext()
{ {
if( hasInput() ) if( hasInput() )
{ telexToggle( var_GetInteger( p_input, "teletext-es" ) >= 0 );
vlc_value_t val;
var_Change( p_input, "spu-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
telexToggle( val.i_int > 0 );
}
else else
{
telexToggle( false ); telexToggle( false );
}
} }
void InputManager::UpdateArt() void InputManager::UpdateArt()
{ {
/* Update Art meta */ /* Update Art meta */
...@@ -409,13 +424,19 @@ void InputManager::telexGotoPage( int page ) ...@@ -409,13 +424,19 @@ void InputManager::telexGotoPage( int page )
{ {
if( hasInput() ) if( hasInput() )
{ {
vlc_object_t *p_vbi; const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
p_vbi = (vlc_object_t *) vlc_object_find_name( p_input, const int i_spu_es = var_GetInteger( p_input, "spu-es" );
"zvbi", FIND_ANYWHERE );
if( p_vbi ) if( i_teletext_es >= 0 && i_teletext_es == i_spu_es )
{ {
var_SetInteger( p_vbi, "vbi-page", page ); vlc_object_t *p_vbi;
vlc_object_release( p_vbi ); p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
"zvbi", FIND_ANYWHERE );
if( p_vbi )
{
var_SetInteger( p_vbi, "vbi-page", page );
vlc_object_release( p_vbi );
}
} }
} }
emit setNewTelexPage( page ); emit setNewTelexPage( page );
...@@ -427,18 +448,22 @@ void InputManager::telexToggle( bool b_enabled ) ...@@ -427,18 +448,22 @@ void InputManager::telexToggle( bool b_enabled )
if( hasInput() ) if( hasInput() )
{ {
vlc_value_t val; const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
vlc_object_t *p_vbi; const int i_spu_es = var_GetInteger( p_input, "spu-es" );
var_Change( p_input, "spu-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
b_enabled = (val.i_int > 0); b_enabled = i_teletext_es >= 0;
p_vbi = (vlc_object_t *) vlc_object_find_name( p_input, if( b_enabled && i_teletext_es == i_spu_es )
"zvbi", FIND_ANYWHERE );
if( p_vbi )
{ {
i_page = var_GetInteger( p_vbi, "vbi-page" ); vlc_object_t *p_vbi;
vlc_object_release( p_vbi ); p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
i_page = b_enabled ? i_page : 0; "zvbi", FIND_ANYWHERE );
telexGotoPage( i_page ); if( p_vbi )
{
i_page = var_GetInteger( p_vbi, "vbi-page" );
vlc_object_release( p_vbi );
i_page = b_enabled ? i_page : 0;
telexGotoPage( i_page );
}
} }
} }
emit teletextEnabled( b_enabled ); emit teletextEnabled( b_enabled );
...@@ -446,7 +471,21 @@ void InputManager::telexToggle( bool b_enabled ) ...@@ -446,7 +471,21 @@ void InputManager::telexToggle( bool b_enabled )
void InputManager::telexToggleButtons() void InputManager::telexToggleButtons()
{ {
emit toggleTelexButtons(); if( hasInput() )
{
const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
if( i_teletext_es >= 0 )
{
const int i_spu_es = var_GetInteger( p_input, "spu-es" );
if( i_teletext_es == i_spu_es )
var_SetInteger( p_input, "spu-es", -1 );
else
var_SetInteger( p_input, "spu-es", i_teletext_es );
emit toggleTelexButtons();
}
}
} }
void InputManager::telexSetTransparency() void InputManager::telexSetTransparency()
...@@ -628,17 +667,10 @@ bool MainInputManager::teletextState() ...@@ -628,17 +667,10 @@ bool MainInputManager::teletextState()
im = getIM(); im = getIM();
if( im->hasInput() ) if( im->hasInput() )
{ {
vlc_value_t val; const int i_teletext_es = var_GetInteger( getInput(), "teletext-es" );
vlc_object_t *p_vbi; const int i_spu_es = var_GetInteger( getInput(), "spu-es" );
p_vbi = (vlc_object_t *) vlc_object_find_name( getInput(),
"zvbi", FIND_ANYWHERE ); return i_teletext_es >= 0 && i_teletext_es == i_spu_es;
if( p_vbi )
{
vlc_object_release( p_vbi );
return true;
}
var_Change( getInput(), "spu-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
return (val.i_int > 0);
} }
return false; return false;
} }
...@@ -707,7 +739,16 @@ static int ChangeSPU( vlc_object_t *p_this, const char *var, vlc_value_t o, ...@@ -707,7 +739,16 @@ static int ChangeSPU( vlc_object_t *p_this, const char *var, vlc_value_t o,
IMEvent *event = new IMEvent( ItemSpuChanged_Type, 0 ); IMEvent *event = new IMEvent( ItemSpuChanged_Type, 0 );
QApplication::postEvent( im, static_cast<QEvent*>(event) ); QApplication::postEvent( im, static_cast<QEvent*>(event) );
return VLC_SUCCESS; return VLC_SUCCESS;
}
static int ChangeTeletext( vlc_object_t *p_this, const char *var, vlc_value_t o,
vlc_value_t n, void *param )
{
InputManager *im = (InputManager*)param;
IMEvent *event = new IMEvent( ItemTeletextChanged_Type, 0 );
QApplication::postEvent( im, static_cast<QEvent*>(event) );
return VLC_SUCCESS;
} }
/* MIM */ /* MIM */
......
...@@ -36,13 +36,14 @@ ...@@ -36,13 +36,14 @@
#include <QObject> #include <QObject>
#include <QEvent> #include <QEvent>
static int const PositionUpdate_Type = QEvent::User + IMEventType + 1; static int const PositionUpdate_Type = QEvent::User + IMEventType + 1;
static int const ItemChanged_Type = QEvent::User + IMEventType + 2; static int const ItemChanged_Type = QEvent::User + IMEventType + 2;
static int const ItemStateChanged_Type = QEvent::User + IMEventType + 3; static int const ItemStateChanged_Type = QEvent::User + IMEventType + 3;
static int const ItemTitleChanged_Type = QEvent::User + IMEventType + 4; static int const ItemTitleChanged_Type = QEvent::User + IMEventType + 4;
static int const ItemRateChanged_Type = QEvent::User + IMEventType + 5; static int const ItemRateChanged_Type = QEvent::User + IMEventType + 5;
static int const VolumeChanged_Type = QEvent::User + IMEventType + 6; static int const VolumeChanged_Type = QEvent::User + IMEventType + 6;
static int const ItemSpuChanged_Type = QEvent::User + IMEventType + 7; static int const ItemSpuChanged_Type = QEvent::User + IMEventType + 7;
static int const ItemTeletextChanged_Type= QEvent::User + IMEventType + 8;
static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 10; static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 10;
static int const FullscreenControlHide_Type = QEvent::User + IMEventType + 11; static int const FullscreenControlHide_Type = QEvent::User + IMEventType + 11;
...@@ -89,6 +90,7 @@ private: ...@@ -89,6 +90,7 @@ private:
void UpdateNavigation(); void UpdateNavigation();
void UpdatePosition(); void UpdatePosition();
void UpdateSPU(); void UpdateSPU();
void UpdateTeletext();
void UpdateArt(); void UpdateArt();
public slots: public slots:
......
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