]> git.sesse.net Git - vlc/commitdiff
Fix behaviour of the button logic for teletext and use the images.
authorJean-Paul Saman <jpsaman@videolan.org>
Fri, 20 Jun 2008 11:55:54 +0000 (13:55 +0200)
committerJean-Paul Saman <jpsaman@videolan.org>
Fri, 20 Jun 2008 14:39:02 +0000 (16:39 +0200)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/pixmaps/tvtelx-transparent.png [new file with mode: 0644]
modules/gui/qt4/pixmaps/tvtelx.png
modules/gui/qt4/vlc.qrc

index d5cdcf6b0adc45046d0830e87ff0c30ab2df1360..e01ea529f8dc78e57b7c82bfc8d5f532c62de8d7 100644 (file)
@@ -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();
index 1c50464c2a8bf10989b416f2a613fc08695fcd85..a64d266c4e369e7b30c6bfdf518670fcf42c19b5 100644 (file)
@@ -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 );
 };
index a5140a96580b399f4a236659640aee39e6ca599b..b7b510cba70181b868b008d9cbc31cfd1e32ea99 100644 (file)
@@ -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 */
index b5ea638038a05a34c3c1738034d6e5be61d2f468..402dfe6f7dccb02d33fcb1ce1d1c178787f6a55d 100644 (file)
@@ -149,6 +149,7 @@ private:
     intf_thread_t           *p_intf;
     static MainInputManager *instance;
 public slots:
+    bool teletextState();
     void togglePlayPause();
     void stop();
     void next();
diff --git a/modules/gui/qt4/pixmaps/tvtelx-transparent.png b/modules/gui/qt4/pixmaps/tvtelx-transparent.png
new file mode 100644 (file)
index 0000000..4b3c164
Binary files /dev/null and b/modules/gui/qt4/pixmaps/tvtelx-transparent.png differ
index 0a26f09b728a02d80d71833b23be435971732a34..34a6a23f50048e560047681991ebb9cfab32ac9a 100644 (file)
Binary files a/modules/gui/qt4/pixmaps/tvtelx.png and b/modules/gui/qt4/pixmaps/tvtelx.png differ
index 1857650e2265aa9a14f765f47b01bd750038e4a8..4d27d37bd754271bb94f6e54bd311d4c2f482216 100644 (file)
@@ -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>