[vlc-devel] [PATCH] Qt4: Enable tabs in sout dialog
Edward Wang
edward.c.wang at compdigitec.com
Thu Dec 29 21:22:49 CET 2011
On 11-12-29 03:14 PM, Rafaël Carré wrote:
> I am not sure if it really fixes that warning. Anyway you should have
> mentioned it in the commit log or made 2 patches; and I think you
> should just remove it
Amended.
---
modules/gui/qt4/Modules.am | 2 ++
modules/gui/qt4/dialogs/sout.cpp | 12 +++++++-----
modules/gui/qt4/dialogs/sout.hpp | 5 ++++-
modules/gui/qt4/ui/sout.ui | 8 +++++++-
4 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am
index 988148a..57439a7 100644
--- a/modules/gui/qt4/Modules.am
+++ b/modules/gui/qt4/Modules.am
@@ -73,6 +73,7 @@ nodist_SOURCES_qt4 = \
util/searchlineedit.moc.cpp \
util/qmenuview.moc.cpp \
util/qvlcapp.moc.cpp \
+ util/qvlctabwidget.moc.cpp \
util/pictureflow.moc.cpp \
util/buttons/RoundButton.moc.cpp \
util/buttons/DeckButtonsLayout.moc.cpp \
@@ -395,6 +396,7 @@ noinst_HEADERS = \
util/searchlineedit.hpp \
util/qvlcframe.hpp \
util/qvlcapp.hpp \
+ util/qvlctabwidget.hpp \
util/qmenuview.hpp \
util/qt_dirs.hpp \
util/registry.hpp \
diff --git a/modules/gui/qt4/dialogs/sout.cpp
b/modules/gui/qt4/dialogs/sout.cpp
index d4a6a1e..13e107f 100644
--- a/modules/gui/qt4/dialogs/sout.cpp
+++ b/modules/gui/qt4/dialogs/sout.cpp
@@ -35,6 +35,7 @@
#include <QFileDialog>
#include <QToolButton>
#include <QSpinBox>
+#include <QtGlobal>
#include <assert.h>
SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf, const
QString& inputMRL )
@@ -60,10 +61,12 @@ 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
+#if QT_VERSION >= 0x040500
/* This needs Qt4.5 to be cool */
ui.destTab->setTabsClosable( true );
+ ui.destTab->getTabBar()->tabButton(0, QTabBar::RightSide)->hide();
CONNECT( ui.destTab, tabCloseRequested( int ), this, closeTab( int
) );
+ closeTabButton = NULL;
#else
closeTabButton = new QToolButton( this );
ui.destTab->setCornerWidget( closeTabButton );
@@ -108,15 +111,14 @@ SoutDialog::SoutDialog( QWidget *parent,
intf_thread_t *_p_intf, const QString&
void SoutDialog::tabChanged( int i )
{
- closeTabButton->setVisible( (i != 0) );
+ if( closeTabButton ) 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..43375db 100644
--- a/modules/gui/qt4/dialogs/sout.hpp
+++ b/modules/gui/qt4/dialogs/sout.hpp
@@ -135,7 +135,10 @@ public slots:
private slots:
void ok();
void cancel();
- void closeTab();
+ void closeTab() {
+ closeTab( ui.destTab->currentIndex() );
+ }
+ void closeTab( int );
void tabChanged( int );
void addDest();
};
diff --git a/modules/gui/qt4/ui/sout.ui b/modules/gui/qt4/ui/sout.ui
index 33b835f..84a8e21 100644
--- a/modules/gui/qt4/ui/sout.ui
+++ b/modules/gui/qt4/ui/sout.ui
@@ -66,7 +66,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
- <widget class="QTabWidget" name="destTab">
+ <widget class="QVLCTabWidget" name="destTab">
<property name="currentIndex">
<number>0</number>
</property>
@@ -243,6 +243,12 @@
<header>components/sout/sout_widgets.hpp</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>QVLCTabWidget</class>
+ <extends>QTabWidget</extends>
+ <header>util/qvlctabwidget.hpp</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
More information about the vlc-devel
mailing list