From 1b751c44e3b129bf7a32ae758a1050a4d88b0713 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Sun, 6 Jan 2008 00:08:02 +0000 Subject: [PATCH] Qt4 - Open Capture: work on DirectShow Capture cards. --- modules/gui/qt4/components/open_panels.cpp | 48 ++++++++----------- modules/gui/qt4/components/open_panels.hpp | 4 ++ .../qt4/components/preferences_widgets.cpp | 1 + .../qt4/components/preferences_widgets.hpp | 2 +- 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index 29d6d23f07..36a42a155a 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -31,7 +31,6 @@ #include "components/open_panels.hpp" #include "dialogs/open.hpp" #include "dialogs_provider.hpp" -#include "components/preferences_widgets.hpp" #include #include @@ -792,44 +791,30 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" ); /* dshow Main */ - - QLabel *dshowVDeviceLabel = new QLabel( qtr( "Video Device Name " ) ); - dshowDevLayout->addWidget( dshowVDeviceLabel, 0, 0 ); - - QLabel *dshowADeviceLabel = new QLabel( qtr( "Audio Device Name " ) ); - dshowDevLayout->addWidget( dshowADeviceLabel, 1, 0 ); - - QComboBox *dshowVDevice = new QComboBox; - dshowDevLayout->addWidget( dshowVDevice, 0, 1 ); - - QComboBox *dshowADevice = new QComboBox; - dshowDevLayout->addWidget( dshowADevice, 1, 1 ); - - QPushButton *dshowVRefresh = new QPushButton( qtr( "Update List" ) ); - dshowDevLayout->addWidget( dshowVRefresh, 0, 2 ); - - QPushButton *dshowARefresh = new QPushButton( qtr( "Update List" ) ); - dshowDevLayout->addWidget( dshowARefresh, 1, 2 ); - - QPushButton *dshowVConfig = new QPushButton( qtr( "Configure" ) ); - dshowDevLayout->addWidget( dshowVConfig, 0, 3 ); - - QPushButton *dshowAConfig = new QPushButton( qtr( "Configure" ) ); - dshowDevLayout->addWidget( dshowAConfig, 1, 3 ); + int line = 0; + module_config_t *p_config = + config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" ); + vdevDshowW = new StringListConfigControl( + VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line ); + line++; + + p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" ); + adevDshowW = new StringListConfigControl( + VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line ); + line++; /* dshow Properties */ - QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) ); dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 ); - QLineEdit *dshowVSizeLine = new QLineEdit; + dshowVSizeLine = new QLineEdit; dshowPropLayout->addWidget( dshowVSizeLine, 0, 1); dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 1, 0, 3, 1 ); /* dshow CONNECTs */ - CuMRL( dshowVDevice, currentIndexChanged ( int ) ); - CuMRL( dshowADevice, currentIndexChanged ( int ) ); + CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) ); + CuMRL( adevDshowW->combo, currentIndexChanged ( int ) ); CuMRL( dshowVSizeLine, textChanged( QString ) ); } @@ -991,6 +976,11 @@ void CaptureOpenPanel::updateMRL() bdaBandBox->currentIndex() ).toInt() ); break; case DSHOW_DEVICE: + mrl = "dshow://"; + mrl += " :dshow-vdev=" + QString("%1").arg( vdevDshowW->getValue() ); + mrl += " :dshow-adev=" + QString("%1").arg( adevDshowW->getValue() ); + if( dshowVSizeLine->isModified() ) + mrl += " :dshow-size=" + dshowVSizeLine->text(); break; #endif case SCREEN_DEVICE: diff --git a/modules/gui/qt4/components/open_panels.hpp b/modules/gui/qt4/components/open_panels.hpp index 3c23a034df..52b1ee7db7 100644 --- a/modules/gui/qt4/components/open_panels.hpp +++ b/modules/gui/qt4/components/open_panels.hpp @@ -37,6 +37,8 @@ #include "ui/open_net.h" #include "ui/open_capture.h" +#include "components/preferences_widgets.hpp" + #ifdef HAVE_LIMITS_H # include #endif @@ -160,6 +162,8 @@ private: QSpinBox *bdaCard, *bdaFreq, *bdaSrate; QLabel *bdaSrateLabel, *bdaBandLabel; QComboBox *bdaBandBox; + StringListConfigControl *vdevDshowW, *adevDshowW; + QLineEdit *dshowVSizeLine; #else QRadioButton *dvbs, *dvbt, *dvbc; QSpinBox *v4lFreq, *pvrFreq, *pvrBitr; diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index e7d8247e8d..ae61dc479b 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -354,6 +354,7 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this, label = new QLabel( qtr(p_item->psz_text) ); combo = new QComboBox(); combo->setMinimumWidth( 80 ); + combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); finish( bycat ); if( !l ) { diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp index bb67adf80a..97971d8096 100644 --- a/modules/gui/qt4/components/preferences_widgets.hpp +++ b/modules/gui/qt4/components/preferences_widgets.hpp @@ -375,10 +375,10 @@ public: virtual QString getValue(); virtual void hide() { combo->hide(); if( label ) label->hide(); } virtual void show() { combo->show(); if( label ) label->show(); } + QComboBox *combo; private: void finish( bool ); QLabel *label; - QComboBox *combo; private slots: void actionRequested( int ); -- 2.39.2