vlc | branch: master | Edward Wang <[email protected]> | Fri Dec 30 02:52:57 2011 +0100| [b79ee3454b1b9584bdc2094a9481f39028b910fe] | committer: Jean-Baptiste Kempf
Qt4: Enable closable tabs in sout dialog Modified-by: Jean-Baptiste Kempf <[email protected]> Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b79ee3454b1b9584bdc2094a9481f39028b910fe --- modules/gui/qt4/dialogs/sout.cpp | 24 ++++-------------------- modules/gui/qt4/dialogs/sout.hpp | 4 +--- 2 files changed, 5 insertions(+), 23 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..b444f37 100644 --- a/modules/gui/qt4/dialogs/sout.hpp +++ b/modules/gui/qt4/dialogs/sout.hpp @@ -125,7 +125,6 @@ private: QString mrl; QPushButton *okButton; - QToolButton *closeTabButton; intf_thread_t* p_intf; @@ -135,8 +134,7 @@ public slots: private slots: void ok(); void cancel(); - void closeTab(); - void tabChanged( int ); + void closeTab( int ); void addDest(); }; _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
