Commit 69afa855 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Fix behaviour of the button logic for teletext and use the images.

parent 9497e5ca
......@@ -460,6 +460,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
sectionNext() );
CONNECT( menuButton, clicked(), THEMIM->getIM(),
sectionMenu() );
/**
* Telextext QFrame
* TODO: Merge with upper menu in a StackLayout
......@@ -469,17 +470,16 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
telexLayout->setSpacing( 0 );
telexLayout->setMargin( 0 );
QToolButton *telexOn = new QToolButton;
telexOn->setText( qtr( "On" ) );
QPushButton *telexOn = new QPushButton;
setupSmallButton( telexOn );
telexLayout->addWidget( telexOn );
QToolButton *telexTransparent = new QToolButton;
telexTransparent->setText( qtr( "Transparent" ) );
telexTransparent = new QPushButton;
setupSmallButton( telexTransparent );
telexLayout->addWidget( telexTransparent );
b_telexTransparent = false;
QSpinBox *telexPage = new QSpinBox;
telexPage = new QSpinBox;
telexPage->setRange( 0, 999 );
telexPage->setValue( 100 );
telexPage->setAccelerated( true );
......@@ -489,12 +489,20 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
telexLayout->addWidget( telexPage );
controlLayout->addWidget( telexFrame, 1, 10, 2, 3, Qt::AlignBottom );
telexFrame->hide();
telexFrame->hide(); /* default hidden */
CONNECT( telexPage, valueChanged( int ), THEMIM->getIM(),
telexGotoPage( int ) );
BUTTON_SET_ACT_I( telexOn, "", tv.png, qtr( "Teletext on" ),
toggleTeletext() );
CONNECT( telexOn, clicked( bool ), THEMIM->getIM(),
telexToggle( bool ) );
telexTransparent->setEnabled( false );
telexPage->setEnabled( false );
BUTTON_SET_ACT_I( telexTransparent, "", tvtelx.png, qtr( "Teletext" ),
toggleTeletextTransparency() );
CONNECT( telexTransparent, clicked( bool ),
THEMIM->getIM(), telexSetTransparency( bool ) );
CONNECT( THEMIM->getIM(), teletextEnabled( bool ),
......@@ -627,6 +635,39 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
ControlsWidget::~ControlsWidget()
{}
void ControlsWidget::toggleTeletext()
{
bool b_enabled = THEMIM->teletextState();
if( b_telexEnabled )
{
telexTransparent->setEnabled( false );
telexPage->setEnabled( false );
b_telexEnabled = false;
}
else if( b_enabled )
{
telexTransparent->setEnabled( true );
telexPage->setEnabled( true );
b_telexEnabled = true;
}
}
void ControlsWidget::toggleTeletextTransparency()
{
if( b_telexTransparent )
{
telexTransparent->setIcon( QIcon( ":/pixmaps/tvtelx.png" ) );
telexTransparent->setToolTip( qtr( "Teletext" ) );
b_telexTransparent = false;
}
else
{
telexTransparent->setIcon( QIcon( ":/pixmaps/tvtelx-transparent.png" ) );
telexTransparent->setToolTip( qtr( "Transparent" ) );
b_telexTransparent = true;
}
}
void ControlsWidget::stop()
{
THEMIM->stop();
......
......@@ -195,6 +195,8 @@ protected:
InputSlider *slider;
QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
QPushButton *playButton, *fullscreenButton, *extSettingsButton;
QPushButton *telexTransparent;
QSpinBox *telexPage;
QToolButton *slowerButton, *fasterButton;
QHBoxLayout *controlButLayout;
AdvControlsWidget *advControls;
......@@ -203,6 +205,8 @@ protected:
VolumeClickHandler *hVolLabel;
bool b_advancedVisible;
bool b_telexTransparent;
bool b_telexEnabled;
protected slots:
void play();
void stop();
......@@ -216,6 +220,8 @@ protected slots:
void faster();
void slower();
void toggleAdvanced();
void toggleTeletext();
void toggleTeletextTransparency();
signals:
void advancedControlsToggled( bool );
};
......
......@@ -610,6 +610,26 @@ void MainInputManager::togglePlayPause()
getIM()->togglePlayPause();
}
bool MainInputManager::teletextState()
{
im = getIM();
if( im->hasInput() )
{
vlc_value_t val;
vlc_object_t *p_vbi;
p_vbi = (vlc_object_t *) vlc_object_find_name( getInput(),
"zvbi", FIND_ANYWHERE );
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;
}
/* Static callbacks */
/* IM */
......
......@@ -149,6 +149,7 @@ private:
intf_thread_t *p_intf;
static MainInputManager *instance;
public slots:
bool teletextState();
void togglePlayPause();
void stop();
void next();
......
modules/gui/qt4/pixmaps/tvtelx.png

274 Bytes | W: | H:

modules/gui/qt4/pixmaps/tvtelx.png

325 Bytes | W: | H:

modules/gui/qt4/pixmaps/tvtelx.png
modules/gui/qt4/pixmaps/tvtelx.png
modules/gui/qt4/pixmaps/tvtelx.png
modules/gui/qt4/pixmaps/tvtelx.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -43,6 +43,9 @@
<file>pixmaps/playlist_shuffle_off.png</file>
<file>pixmaps/playlist_shuffle_on.png</file>
<file>pixmaps/play.png</file>
<file>pixmaps/tvtelx-transparent.png</file>
<file>pixmaps/tvtelx.png</file>
<file>pixmaps/tv.png</file>
<file>pixmaps/previous_16px.png</file>
<file>pixmaps/previous.png</file>
<file>pixmaps/record_16px.png</file>
......
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