[vlc-devel] [PATCH] Qt4: Enable tabs in sout dialog

Edward Wang edward.c.wang at compdigitec.com
Fri Dec 30 02:44:47 CET 2011


On 11-12-29 08:41 PM, Jean-Baptiste Kempf wrote:
> Do we really need those 2? Best regards, 
Done

Thanks,
     Edward Wang
---
  modules/gui/qt4/dialogs/sout.cpp |   24 ++++--------------------
  modules/gui/qt4/dialogs/sout.hpp |    3 +--
  2 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/modules/gui/qt4/dialogs/sout.cpp 
b/modules/gui/qt4/dialogs/sout.cpp
index d4a6a1e..c091744 100644
--- a/modules/gui/qt4/dialogs/sout.cpp
+++ b/modules/gui/qt4/dialogs/sout.cpp
@@ -60,20 +60,10 @@ SoutDialog::SoutDialog( QWidget *parent, 
intf_thread_t *_p_intf, const QString&
                   "when you change the above settings,\n"
                   "but you can change it manually." ) ) ;

-#if 0
-    /* This needs Qt4.5 to be cool */
      ui.destTab->setTabsClosable( true );
+    QTabBar* tb = ui.destTab->findChild<QTabBar*>();
+    if( tb != NULL ) tb->tabButton(0, QTabBar::RightSide)->hide();
      CONNECT( ui.destTab, tabCloseRequested( int ), this, closeTab( int 
) );
-#else
-    closeTabButton = new QToolButton( this );
-    ui.destTab->setCornerWidget( closeTabButton );
-    closeTabButton->hide();
-    closeTabButton->setAutoRaise( true );
-    closeTabButton->setIcon( QIcon( ":/toolbar/clear" ) );
-    closeTabButton->setToolTip( qtr("Clear") );
-    BUTTONACT( closeTabButton, closeTab() );
-#endif
-    CONNECT( ui.destTab, currentChanged( int ), this, tabChanged( int ) );
      ui.destTab->setTabIcon( 0, QIcon( 
":/buttons/playlist/playlist_add" ) );

      ui.destBox->addItem( qtr( "File" ) );
@@ -106,17 +96,11 @@ SoutDialog::SoutDialog( QWidget *parent, 
intf_thread_t *_p_intf, const QString&
  #undef CB
  }

-void SoutDialog::tabChanged( int i )
-{
-    closeTabButton->setVisible( (i != 0) );
-}
-
-void SoutDialog::closeTab()
+void SoutDialog::closeTab( int i )
  {
-    int i = ui.destTab->currentIndex();
      if( i == 0 ) return;

-    QWidget *temp = ui.destTab->currentWidget();
+    QWidget* temp = ui.destTab->widget( i );
      ui.destTab->removeTab( i );
      delete temp;
      updateMRL();
diff --git a/modules/gui/qt4/dialogs/sout.hpp 
b/modules/gui/qt4/dialogs/sout.hpp
index b15c1ee..40d7242 100644
--- a/modules/gui/qt4/dialogs/sout.hpp
+++ b/modules/gui/qt4/dialogs/sout.hpp
@@ -135,8 +135,7 @@ public slots:
  private slots:
      void ok();
      void cancel();
-    void closeTab();
-    void tabChanged( int );
+    void closeTab( int );
      void addDest();
  };

-- 
1.7.5.4



More information about the vlc-devel mailing list