X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fopen_panels.cpp;h=4c2fcd3a5b7c68c671708fee8cb064f214ca74d0;hb=db8ce6ef046913ed2bc38a9f770fc2bc05fbbc73;hp=8752b444915cc9026c566561ea19db675542d5c5;hpb=193dff8a09e6a3516f1ad4b201e8734e050f8c7f;p=vlc diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index 8752b44491..4c2fcd3a5b 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * open.cpp : Panels for the open dialogs **************************************************************************** - * Copyright (C) 2006-2007 the VideoLAN team + * Copyright (C) 2006-2009 the VideoLAN team * Copyright (C) 2007 Société des arts technologiques * Copyright (C) 2007 Savoir-faire Linux * @@ -26,11 +26,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "qt4.hpp" #include "components/open_panels.hpp" #include "dialogs/open.hpp" -#include "dialogs_provider.hpp" +#include "dialogs_provider.hpp" /* Open Subtitle file */ +#include "util/qt_dirs.hpp" #include #include @@ -40,6 +44,13 @@ #include #include #include +#include +#include + +#define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory") + +static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda", + "dshow", "screen", "jack" }; /************************************************************************** * Open Files and subtitles * @@ -50,6 +61,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /* Classic UI Setup */ ui.setupUi( this ); +#if 0 /** BEGIN QFileDialog tweaking **/ /* Use a QFileDialog and customize it because we don't want to rewrite it all. Be careful to your eyes cause there are a few hacks. @@ -64,26 +76,21 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ADD_FILTER_ALL( fileTypes ); fileTypes.replace( QString(";*"), QString(" *")); - /* retrieve last known path used in file browsing */ - char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" ); - if( EMPTY_STR( psz_filepath ) ) - { - psz_filepath = p_intf->p_libvlc->psz_homedir; - } - // Make this QFileDialog a child of tempWidget from the ui. dialogBox = new FileOpenBox( ui.tempWidget, NULL, - qfu( psz_filepath ), fileTypes ); - delete psz_filepath; + qfu( p_intf->p_sys->psz_filepath ), fileTypes ); dialogBox->setFileMode( QFileDialog::ExistingFiles ); dialogBox->setAcceptMode( QFileDialog::AcceptOpen ); + dialogBox->restoreState( + getSettings()->value( "file-dialog-state" ).toByteArray() ); /* We don't want to see a grip in the middle of the window, do we? */ dialogBox->setSizeGripEnabled( false ); /* Add a tooltip */ - dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ) ); + dialogBox->setToolTip( qtr( "Select one or multiple files" ) ); + dialogBox->setMinimumHeight( 250 ); // But hide the two OK/Cancel buttons. Enable them for debug. QDialogButtonBox *fileDialogAcceptBox = @@ -92,11 +99,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /* Ugly hacks to get the good Widget */ //This lineEdit is the normal line in the fileDialog. -#if HAS_QT43 lineFileEdit = dialogBox->findChildren()[0]; -#else - lineFileEdit = dialogBox->findChildren()[1]; -#endif /* Make a list of QLabel inside the QFileDialog to access the good ones */ QList listLabel = dialogBox->findChildren(); @@ -106,20 +109,22 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : listLabel[2]->setText( qtr( "Filter:" ) ); dialogBox->layout()->setMargin( 0 ); - dialogBox->layout()->setSizeConstraint( QLayout::SetMinimumSize ); + dialogBox->layout()->setSizeConstraint( QLayout::SetNoConstraint ); /** END of QFileDialog tweaking **/ // Add the DialogBox to the layout ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 ); +#endif +/* lineFileEdit = ui.fileEdit; //TODO later: fill the fileCompleteList with previous items played. QCompleter *fileCompleter = new QCompleter( fileCompleteList, this ); fileCompleter->setModel( new QDirModel( fileCompleter ) ); - lineFileEdit->setCompleter( fileCompleter ); + lineFileEdit->setCompleter( fileCompleter );*/ // Hide the subtitles control by default. - ui.subFrame->hide(); + ui.subFrame->setEnabled( false ); /* Build the subs size combo box */ setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf, @@ -129,39 +134,65 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox ); /* Connects */ + BUTTONACT( ui.fileBrowseButton, browseFile() ); BUTTONACT( ui.subBrowseButton, browseFileSub() ); - BUTTONACT( ui.subCheckBox, toggleSubtitleFrame()); + CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) ); - CONNECT( lineFileEdit, textChanged( QString ), this, updateMRL() ); + CONNECT( ui.fileListWidg, itemChanged( QListWidgetItem * ), this, updateMRL() ); CONNECT( ui.subInput, textChanged( QString ), this, updateMRL() ); CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() ); CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() ); } -FileOpenPanel::~FileOpenPanel(){} +FileOpenPanel::~FileOpenPanel() +{ +// getSettings()->setValue( "file-dialog-state", dialogBox->saveState() ); +} + +void FileOpenPanel::browseFile() +{ + QStringList files = QFileDialog::getOpenFileNames( this ); + foreach( const QString &file, files) + { + QListWidgetItem *item = new QListWidgetItem( file, ui.fileListWidg ); + item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled ); + ui.fileListWidg->addItem( item ); + } + updateMRL(); +} /* Show a fileBrowser to select a subtitle */ void FileOpenPanel::browseFileSub() { // TODO Handle selection of more than one subtitles file QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"), - EXT_FILTER_SUBTITLE, - dialogBox->directory().absolutePath() ); + EXT_FILTER_SUBTITLE, p_intf->p_sys->psz_filepath ); + if( files.isEmpty() ) return; ui.subInput->setText( files.join(" ") ); updateMRL(); } +void FileOpenPanel::toggleSubtitleFrame( bool b ) +{ + ui.subFrame->setEnabled( b ); + + /* Update the MRL */ + updateMRL(); +} + + /* Update the current MRL */ void FileOpenPanel::updateMRL() { - QString mrl = ""; - foreach( QString file, dialogBox->selectedFiles() ) { - mrl += "\"" + file + "\" "; - } + QStringList fileList; + QString mrl; + + for( int i = 0; i < ui.fileListWidg->count(); i++ ) + fileList << ui.fileListWidg->item( i )->text(); - if( ui.subCheckBox->isChecked() ) { - mrl.append( " :sub-file=" + ui.subInput->text() ); + if( ui.subCheckBox->isChecked() && !ui.subInput->text().isEmpty() ) { + mrl.append( " :sub-file=\"" + ui.subInput->text() + "\"" ); int align = ui.alignSubComboBox->itemData( ui.alignSubComboBox->currentIndex() ).toInt(); mrl.append( " :subsdec-align=" + QString().setNum( align ) ); @@ -170,45 +201,25 @@ void FileOpenPanel::updateMRL() mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) ); } - emit mrlUpdated( mrl ); + emit mrlUpdated( fileList, mrl ); emit methodChanged( "file-caching" ); } /* Function called by Open Dialog when clicke on Play/Enqueue */ void FileOpenPanel::accept() { - //TODO set the completer - const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" ); - if( ( NULL == psz_filepath ) - || strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) ) - { - /* set dialog box current directory as last known path */ - config_PutPsz( p_intf, "qt-filedialog-path", - qtu( dialogBox->directory().absolutePath() ) ); - } - delete psz_filepath; -} - -void FileOpenBox::accept() -{ - OpenDialog::getInstance( NULL, NULL )->play(); + //FIXME + // p_intf->p_sys->psz_filepath = qtu( dialogBox->directory().absolutePath() ); + ui.fileListWidg->clear(); } /* Function called by Open Dialog when clicked on cancel */ void FileOpenPanel::clear() { - lineFileEdit->clear(); + ui.fileListWidg->clear(); ui.subInput->clear(); } -void FileOpenPanel::toggleSubtitleFrame() -{ - TOGGLEV( ui.subFrame ); - - /* Update the MRL */ - updateMRL(); -} - /************************************************************************** * Open Discs ( DVD, CD, VCD and similar devices ) * **************************************************************************/ @@ -227,7 +238,10 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : b_firstvcd = true; b_firstcdda = true; -#if WIN32 /* Disc drives probing for Windows */ + ui.browseDiscButton->setToolTip( qtr( I_DEVICE_TOOLTIP )); + ui.deviceCombo->setToolTip( I_DEVICE_TOOLTIP ); + +#ifdef WIN32 /* Disc drives probing for Windows */ char szDrives[512]; szDrives[0] = '\0'; if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) ) @@ -256,6 +270,8 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : BUTTONACT( ui.audioCDRadioButton, updateButtons() ); BUTTONACT( ui.dvdsimple, updateButtons() ); BUTTONACT( ui.browseDiscButton, browseDevice() ); + BUTTON_SET_ACT_I( ui.ejectButton, "", eject, qtr( "Eject the disc" ), + eject() ); CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL()); CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL()); @@ -269,15 +285,17 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : DiscOpenPanel::~DiscOpenPanel() { - delete psz_dvddiscpath; - delete psz_vcddiscpath; - delete psz_cddadiscpath; + free( psz_dvddiscpath ); + free( psz_vcddiscpath ); + free( psz_cddadiscpath ); } void DiscOpenPanel::clear() { ui.titleSpin->setValue( 0 ); ui.chapterSpin->setValue( 0 ); + ui.subtitlesSpin->setValue( -1 ); + ui.audioSpin->setValue( -1 ); b_firstcdda = true; b_firstdvd = true; b_firstvcd = true; @@ -306,6 +324,7 @@ void DiscOpenPanel::updateButtons() ui.chapterLabel->show(); ui.chapterSpin->show(); ui.diskOptionBox_2->show(); + ui.dvdsimple->setEnabled( true ); } else if ( ui.vcdRadioButton->isChecked() ) { @@ -318,6 +337,7 @@ void DiscOpenPanel::updateButtons() ui.chapterLabel->hide(); ui.chapterSpin->hide(); ui.diskOptionBox_2->show(); + ui.dvdsimple->setEnabled( false ); } else /* CDDA */ { @@ -330,6 +350,7 @@ void DiscOpenPanel::updateButtons() ui.chapterLabel->hide(); ui.chapterSpin->hide(); ui.diskOptionBox_2->hide(); + ui.dvdsimple->setEnabled( false ); } updateMRL(); @@ -339,8 +360,9 @@ void DiscOpenPanel::updateButtons() void DiscOpenPanel::updateMRL() { QString mrl = ""; + QStringList fileList; - /* CDDAX and VCDX not implemented. TODO ? */ + /* CDDAX and VCDX not implemented. TODO ? No. */ /* DVD */ if( ui.dvdRadioButton->isChecked() ) { if( !ui.dvdsimple->isChecked() ) @@ -370,10 +392,12 @@ void DiscOpenPanel::updateMRL() } else { mrl = "cdda://" + ui.deviceCombo->currentText(); if( ui.titleSpin->value() > 0 ) { - QString("@%1").arg( ui.titleSpin->value() ); + mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() ); } } + fileList << mrl; mrl = ""; + if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() ) { if ( ui.audioSpin->value() >= 0 ) { @@ -385,19 +409,24 @@ void DiscOpenPanel::updateMRL() QString("%1").arg( ui.subtitlesSpin->value() ); } } - emit mrlUpdated( mrl ); + emit mrlUpdated( fileList, mrl ); } void DiscOpenPanel::browseDevice() { - QString dir = QFileDialog::getExistingDirectory( 0, - qtr("Open a device or a VIDEO_TS directory") ); - if (!dir.isEmpty()) { - ui.deviceCombo->setEditText( dir ); - } + QString dir = QFileDialog::getExistingDirectory( this, + qtr( I_DEVICE_TOOLTIP ) ); + if (!dir.isEmpty()) + ui.deviceCombo->setEditText( toNativeSepNoSlash( dir ) ); + updateMRL(); } +void DiscOpenPanel::eject() +{ + intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) ); +} + void DiscOpenPanel::accept() {} @@ -410,42 +439,71 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ui.setupUi( this ); /* CONNECTs */ - CONNECT( ui.protocolCombo, currentIndexChanged( int ), + CONNECT( ui.protocolCombo, activated( int ), this, updateProtocol( int ) ); CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() ); CONNECT( ui.addressText, textChanged( QString ), this, updateMRL()); - CONNECT( ui.timeShift, clicked(), this, updateMRL()); - CONNECT( ui.ipv6, clicked(), this, updateMRL()); + ui.protocolCombo->addItem( "" ); ui.protocolCombo->addItem("HTTP", QVariant("http")); ui.protocolCombo->addItem("HTTPS", QVariant("https")); - ui.protocolCombo->addItem("FTP", QVariant("ftp")); ui.protocolCombo->addItem("MMS", QVariant("mms")); + ui.protocolCombo->addItem("FTP", QVariant("ftp")); ui.protocolCombo->addItem("RTSP", QVariant("rtsp")); - ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp")); - ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp")); + ui.protocolCombo->addItem("RTP", QVariant("rtp")); + ui.protocolCombo->addItem("UDP", QVariant("udp")); + ui.protocolCombo->addItem("RTMP", QVariant("rtmp")); + + updateProtocol( ui.protocolCombo->currentIndex() ); + + if( config_GetInt( p_intf, "qt-recentplay" ) ) + { + mrlList = new QStringListModel( + getSettings()->value( "Open/netMRL" ).toStringList() ); + QCompleter *completer = new QCompleter( mrlList, this ); + ui.addressText->setCompleter( completer ); + + CONNECT( ui.addressText, editingFinished(), this, updateCompleter() ); + } + else + mrlList = NULL; } NetOpenPanel::~NetOpenPanel() -{} +{ + if( !mrlList ) return; + + QStringList tempL = mrlList->stringList(); + while( tempL.size() > 8 ) tempL.removeFirst(); + + getSettings()->setValue( "Open/netMRL", tempL ); +} void NetOpenPanel::clear() {} /* update the widgets according the type of protocol */ -void NetOpenPanel::updateProtocol( int idx ) { +void NetOpenPanel::updateProtocol( int idx_proto ) { QString addr = ui.addressText->text(); - QString proto = ui.protocolCombo->itemData( idx ).toString(); + QString proto = ui.protocolCombo->itemData( idx_proto ).toString(); - ui.timeShift->setEnabled( idx >= 5 ); - ui.ipv6->setEnabled( idx == 5 ); - ui.addressText->setEnabled( idx != 5 ); - ui.portSpin->setEnabled( idx >= 5 ); + ui.portSpin->setEnabled( idx_proto == UDP_PROTO || + idx_proto == RTP_PROTO ); + + if( idx_proto == NO_PROTO ) return; /* If we already have a protocol in the address, replace it */ - if( addr.contains( "://")) { - msg_Err( p_intf, "replace"); - addr.replace( QRegExp("^.*://"), proto + "://"); + if( addr.contains( "://")) + { + if( idx_proto != UDP_PROTO && idx_proto != RTP_PROTO ) + addr.replace( QRegExp("^.*://@*"), proto + "://"); + else if ( ( addr.contains(QRegExp("://((22[4-9])|(23\\d)|(\\[?[fF]{2}[0-9a-fA-F]{2}:))"))) || + ( !addr.contains(QRegExp("^\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}")) && + !addr.contains(QRegExp(":[a-fA-F0-9]{1,4}:")) ) ) + addr.replace( QRegExp("^.*://"), proto + "://@"); + else + addr.replace( QRegExp("^.*://"), proto + "://"); + addr.replace( QRegExp("@+"), "@"); ui.addressText->setText( addr ); } updateMRL(); @@ -454,54 +512,87 @@ void NetOpenPanel::updateProtocol( int idx ) { void NetOpenPanel::updateMRL() { QString mrl = ""; QString addr = ui.addressText->text(); - int proto = ui.protocolCombo->currentIndex(); - - if( addr.contains( "://") && proto != 5 ) { + addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" ); + int idx_proto = ui.protocolCombo->currentIndex(); + int addr_is_multicast = addr.contains(QRegExp("^(22[4-9])|(23\\d)|(\\[?[fF]{2}[0-9a-fA-F]{2}:)"))?1:0; + int addr_is_ipv4 = addr.contains(QRegExp("^\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}"))?1:0; + int addr_is_ipv6 = addr.contains(QRegExp(":[a-fA-F0-9]{1,4}:"))?1:0; + int addr_has_port = addr.contains(QRegExp("[^:]{5}:\\d{1,5}$"))?1:0; + if( addr.contains( "://")) + { + /* Match the correct item in the comboBox */ + ui.protocolCombo->setCurrentIndex( + ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) ); mrl = addr; - } else { - switch( proto ) { - case 0: + } + else + { + switch( idx_proto ) { + case HTTP_PROTO: mrl = "http://" + addr; emit methodChanged("http-caching"); break; - case 1: + case HTTPS_PROTO: mrl = "https://" + addr; emit methodChanged("http-caching"); break; - case 3: + case MMS_PROTO: mrl = "mms://" + addr; emit methodChanged("mms-caching"); break; - case 2: + case FTP_PROTO: mrl = "ftp://" + addr; emit methodChanged("ftp-caching"); break; - case 4: /* RTSP */ + case RTSP_PROTO: mrl = "rtsp://" + addr; emit methodChanged("rtsp-caching"); break; - case 5: - mrl = "udp://@"; - if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) { - mrl += "[::]"; - } - mrl += QString(":%1").arg( ui.portSpin->value() ); - emit methodChanged("udp-caching"); - break; - case 6: /* UDP multicast */ - mrl = "udp://@"; + case UDP_PROTO: + if(( addr_is_multicast ) || ( !addr_is_ipv4 && !addr_is_ipv6 )) + mrl = "udp://@"; + else + mrl = "udp://"; /* Add [] to IPv6 */ - if ( addr.contains(':') && !addr.contains('[') ) { + if ( addr_is_ipv6 && !addr.contains('[') ) + { mrl += "[" + addr + "]"; - } else mrl += addr; - mrl += QString(":%1").arg( ui.portSpin->value() ); + } + else mrl += addr; + if(!addr_has_port) + mrl += QString(":%1").arg( ui.portSpin->value() ); emit methodChanged("udp-caching"); + break; + case RTP_PROTO: + if(( addr_is_multicast ) || ( !addr_is_ipv4 && !addr_is_ipv6 )) + mrl = "rtp://@"; + else + mrl = "rtp://"; + if ( addr_is_ipv6 && !addr.contains('[') ) + mrl += "[" + addr + "]"; /* Add [] to IPv6 */ + else + mrl += addr; + if(!addr_has_port) + mrl += QString(":%1").arg( ui.portSpin->value() ); + emit methodChanged("rtp-caching"); + break; + case RTMP_PROTO: + mrl = "rtmp://" + addr; + emit methodChanged("rtmp-caching"); + break; } } - if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) { - mrl += " :access-filter=timeshift"; - } - emit mrlUpdated( mrl ); + + QStringList qsl; qsl<< mrl; + emit mrlUpdated( qsl, "" ); +} + +void NetOpenPanel::updateCompleter() +{ + assert( mrlList ); + QStringList tempL = mrlList->stringList(); + tempL.append( ui.addressText->text() ); + mrlList->setStringList( tempL ); } /************************************************************************** @@ -510,6 +601,16 @@ void NetOpenPanel::updateMRL() { CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : OpenPanel( _parent, _p_intf ) { + isInitialized = false; +} + +void CaptureOpenPanel::initialize() +{ + if( isInitialized ) return; + + msg_Dbg( p_intf, "Initialization of Capture device panel" ); + isInitialized = true; + ui.setupUi( this ); BUTTONACT( ui.advancedButton, advancedDialog() ); @@ -535,56 +636,114 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() ); -#ifndef WIN32 - /******* - * V4L * - *******/ - if( module_Exists( p_intf, "v4l" ) ){ - addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" ); +#ifdef WIN32 + /********************* + * DirectShow Stuffs * + *********************/ + if( module_exists( "dshow" ) ){ + addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" ); - /* V4l Main panel */ - QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) ); - v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 ); + /* dshow Main */ + 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++; - v4lVideoDevice = new QLineEdit; - v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 ); + p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" ); + adevDshowW = new StringListConfigControl( + VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line ); + line++; - QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) ); - v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 ); + /* dshow Properties */ + QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) ); + dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 ); - v4lAudioDevice = new QLineEdit; - v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 ); + dshowVSizeLine = new QLineEdit; + dshowPropLayout->addWidget( dshowVSizeLine, 0, 1); + dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), + 1, 0, 3, 1 ); - /* V4l Props panel */ - QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) ); - v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 ); + /* dshow CONNECTs */ + CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) ); + CuMRL( adevDshowW->combo, currentIndexChanged ( int ) ); + CuMRL( dshowVSizeLine, textChanged( QString ) ); + } - v4lNormBox = new QComboBox; - setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox ); - v4lPropLayout->addWidget( v4lNormBox, 0 , 1 ); + /************** + * BDA Stuffs * + **************/ + if( module_exists( "bda" ) ){ + addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" ); - QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) ); - v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 ); + /* bda Main */ + QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) ); - v4lFreq = new QSpinBox; - v4lFreq->setAlignment( Qt::AlignRight ); - v4lFreq->setSuffix(" kHz"); - setSpinBoxFreq( v4lFreq ); - v4lPropLayout->addWidget( v4lFreq, 1 , 1 ); - v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), + bdas = new QRadioButton( "DVB-S" ); + bdas->setChecked( true ); + bdac = new QRadioButton( "DVB-C" ); + bdat = new QRadioButton( "DVB-T" ); + bdaa = new QRadioButton( "ATSC" ); + + bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 ); + bdaDevLayout->addWidget( bdas, 0, 1 ); + bdaDevLayout->addWidget( bdac, 0, 2 ); + bdaDevLayout->addWidget( bdat, 0, 3 ); + bdaDevLayout->addWidget( bdaa, 0, 4 ); + + /* bda Props */ + QLabel *bdaFreqLabel = + new QLabel( qtr( "Transponder/multiplex frequency" ) ); + bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 ); + + bdaFreq = new QSpinBox; + bdaFreq->setAlignment( Qt::AlignRight ); + bdaFreq->setSuffix(" kHz"); + bdaFreq->setSingleStep( 1000 ); + setSpinBoxFreq( bdaFreq ) + bdaPropLayout->addWidget( bdaFreq, 0, 1 ); + + bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) ); + bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 ); + + bdaSrate = new QSpinBox; + bdaSrate->setAlignment( Qt::AlignRight ); + bdaSrate->setSuffix(" kHz"); + setSpinBoxFreq( bdaSrate ); + bdaPropLayout->addWidget( bdaSrate, 1, 1 ); + + bdaBandLabel = new QLabel( qtr( "Bandwidth" ) ); + bdaPropLayout->addWidget( bdaBandLabel, 2, 0 ); + + bdaBandBox = new QComboBox; + setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox ); + bdaPropLayout->addWidget( bdaBandBox, 2, 1 ); + + bdaBandLabel->hide(); + bdaBandBox->hide(); + bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 2, 0, 2, 1 ); - /* v4l CONNECTs */ - CuMRL( v4lVideoDevice, textChanged( QString ) ); - CuMRL( v4lAudioDevice, textChanged( QString ) ); - CuMRL( v4lFreq, valueChanged ( int ) ); - CuMRL( v4lNormBox, currentIndexChanged ( int ) ); + /* bda CONNECTs */ + CuMRL( bdaFreq, valueChanged ( int ) ); + CuMRL( bdaSrate, valueChanged ( int ) ); + CuMRL( bdaBandBox, currentIndexChanged ( int ) ); + BUTTONACT( bdas, updateButtons() ); + BUTTONACT( bdat, updateButtons() ); + BUTTONACT( bdac, updateButtons() ); + BUTTONACT( bdaa, updateButtons() ); + BUTTONACT( bdas, updateMRL() ); + BUTTONACT( bdat, updateMRL() ); + BUTTONACT( bdac, updateMRL() ); + BUTTONACT( bdaa, updateMRL() ); } +#else /* WIN32 */ /******* * V4L2* *******/ - if( module_Exists( p_intf, "v4l2" ) ){ + if( module_exists( "v4l2" ) ){ addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" ); /* V4l Main panel */ @@ -616,15 +775,60 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : CuMRL( v4l2StdBox, currentIndexChanged ( int ) ); } + /******* + * V4L * + *******/ + if( module_exists( "v4l" ) ){ + addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" ); + + /* V4l Main panel */ + QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) ); + v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 ); + + v4lVideoDevice = new QLineEdit; + v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 ); + + QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) ); + v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 ); + + v4lAudioDevice = new QLineEdit; + v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 ); + + /* V4l Props panel */ + QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) ); + v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 ); + + v4lNormBox = new QComboBox; + setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox ); + v4lPropLayout->addWidget( v4lNormBox, 0 , 1 ); + + QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) ); + v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 ); + + v4lFreq = new QSpinBox; + v4lFreq->setAlignment( Qt::AlignRight ); + v4lFreq->setSuffix(" kHz"); + setSpinBoxFreq( v4lFreq ); + v4lPropLayout->addWidget( v4lFreq, 1 , 1 ); + v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), + 2, 0, 2, 1 ); + + /* v4l CONNECTs */ + CuMRL( v4lVideoDevice, textChanged( QString ) ); + CuMRL( v4lAudioDevice, textChanged( QString ) ); + CuMRL( v4lFreq, valueChanged ( int ) ); + CuMRL( v4lNormBox, currentIndexChanged ( int ) ); + } + /******* * JACK * *******/ - if( module_Exists( p_intf, "jack" ) ){ + if( module_exists( "jack" ) ){ addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" ); /* Jack Main panel */ /* Channels */ - QLabel *jackChannelsLabel = new QLabel( qtr( "Channels :" ) ); + QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) ); jackDevLayout->addWidget( jackChannelsLabel, 1, 0 ); jackChannels = new QSpinBox; @@ -634,25 +838,25 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : jackChannels->setAlignment( Qt::AlignRight ); jackDevLayout->addWidget( jackChannels, 1, 1 ); - /* Jack Props panel */ - /* Selected ports */ - QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) ); - jackPropLayout->addWidget( jackPortsLabel, 0 , 0 ); + QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports:" ) ); + jackDevLayout->addWidget( jackPortsLabel, 0 , 0 ); jackPortsSelected = new QLineEdit( qtr( ".*") ); jackPortsSelected->setAlignment( Qt::AlignRight ); - jackPropLayout->addWidget( jackPortsSelected, 0, 1 ); + jackDevLayout->addWidget( jackPortsSelected, 0, 1 ); + + /* Jack Props panel */ /* Caching */ - QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) ); + QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) ); jackPropLayout->addWidget( jackCachingLabel, 1 , 0 ); jackCaching = new QSpinBox; setSpinBoxFreq( jackCaching ); jackCaching->setSuffix( " ms" ); jackCaching->setValue(1000); jackCaching->setAlignment( Qt::AlignRight ); - jackPropLayout->addWidget( jackCaching, 1 , 1 ); + jackPropLayout->addWidget( jackCaching, 1 , 2 ); /* Pace */ jackPace = new QCheckBox(qtr( "Use VLC pace" )); @@ -660,7 +864,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /* Auto Connect */ jackConnect = new QCheckBox( qtr( "Auto connnection" )); - jackPropLayout->addWidget( jackConnect, 3, 1 ); + jackPropLayout->addWidget( jackConnect, 2, 2 ); /* Jack CONNECTs */ CuMRL( jackChannels, valueChanged( int ) ); @@ -673,7 +877,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /************ * PVR * ************/ - if( module_Exists( p_intf, "pvr" ) ){ + if( module_exists( "pvr" ) ){ addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" ); /* PVR Main panel */ @@ -729,7 +933,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /************** * DVB Stuffs * **************/ - if( module_Exists( p_intf, "dvb" ) ){ + if( module_exists( "dvb" ) ){ addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" ); /* DVB Main */ @@ -785,105 +989,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : BUTTONACT( dvbc, updateButtons() ); } -#else /*!WIN32 */ - - /********************* - * DirectShow Stuffs * - *********************/ - if( module_Exists( p_intf, "dshow" ) ){ - addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" ); - - /* dshow Main */ - 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 ); - - dshowVSizeLine = new QLineEdit; - dshowPropLayout->addWidget( dshowVSizeLine, 0, 1); - dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), - 1, 0, 3, 1 ); - - /* dshow CONNECTs */ - CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) ); - CuMRL( adevDshowW->combo, currentIndexChanged ( int ) ); - CuMRL( dshowVSizeLine, textChanged( QString ) ); - } - - /************** - * BDA Stuffs * - **************/ - if( module_Exists( p_intf, "bda" ) ){ - addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" ); - - /* bda Main */ - QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) ); - - bdas = new QRadioButton( "DVB-S" ); - bdas->setChecked( true ); - bdac = new QRadioButton( "DVB-C" ); - bdat = new QRadioButton( "DVB-T" ); - - bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 ); - bdaDevLayout->addWidget( bdas, 0, 1 ); - bdaDevLayout->addWidget( bdac, 0, 2 ); - bdaDevLayout->addWidget( bdat, 0, 3 ); - - /* bda Props */ - QLabel *bdaFreqLabel = - new QLabel( qtr( "Transponder/multiplex frequency" ) ); - bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 ); - - bdaFreq = new QSpinBox; - bdaFreq->setAlignment( Qt::AlignRight ); - bdaFreq->setSuffix(" kHz"); - bdaFreq->setSingleStep( 1000 ); - setSpinBoxFreq( bdaFreq ) - bdaPropLayout->addWidget( bdaFreq, 0, 1 ); - - bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) ); - bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 ); - - bdaSrate = new QSpinBox; - bdaSrate->setAlignment( Qt::AlignRight ); - bdaSrate->setSuffix(" kHz"); - setSpinBoxFreq( bdaSrate ); - bdaPropLayout->addWidget( bdaSrate, 1, 1 ); - - bdaBandLabel = new QLabel( qtr( "Bandwidth" ) ); - bdaPropLayout->addWidget( bdaBandLabel, 2, 0 ); - - bdaBandBox = new QComboBox; - setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox ); - bdaPropLayout->addWidget( bdaBandBox, 2, 1 ); - - bdaBandLabel->hide(); - bdaBandBox->hide(); - bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), - 2, 0, 2, 1 ); - - /* bda CONNECTs */ - CuMRL( bdaFreq, valueChanged ( int ) ); - CuMRL( bdaSrate, valueChanged ( int ) ); - CuMRL( bdaBandBox, currentIndexChanged ( int ) ); - BUTTONACT( bdas, updateButtons() ); - BUTTONACT( bdat, updateButtons() ); - BUTTONACT( bdac, updateButtons() ); - BUTTONACT( bdas, updateMRL() ); - BUTTONACT( bdat, updateMRL() ); - BUTTONACT( bdac, updateMRL() ); - } #endif @@ -891,16 +996,25 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : * Screen * **********/ addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" ); - QLabel *screenLabel = new QLabel( "This option will open your own " - "desktop in order to save or stream it."); + QLabel *screenLabel = new QLabel( "Your display will will be " + "opened and played in order to stream or save it." ); screenLabel->setWordWrap( true ); screenDevLayout->addWidget( screenLabel, 0, 0 ); + QLabel *screenFPSLabel = new QLabel( + qtr( "Desired frame rate for the capture." ) ); + screenPropLayout->addWidget( screenFPSLabel, 0, 0 ); + + screenFPS = new QSpinBox; + screenFPS->setValue( 1 ); + screenFPS->setAlignment( Qt::AlignRight ); + screenPropLayout->addWidget( screenFPS, 0, 1 ); + /* General connects */ - connect( ui.deviceCombo, SIGNAL( activated( int ) ), - stackedDevLayout, SLOT( setCurrentIndex( int ) ) ); - connect( ui.deviceCombo, SIGNAL( activated( int ) ), - stackedPropLayout, SLOT( setCurrentIndex( int ) ) ); + CONNECT( ui.deviceCombo, activated( int ) , + stackedDevLayout, setCurrentIndex( int ) ); + CONNECT( ui.deviceCombo, activated( int ), + stackedPropLayout, setCurrentIndex( int ) ); CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() ); CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() ); @@ -909,7 +1023,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : CaptureOpenPanel::~CaptureOpenPanel() { - if( adv ) delete adv; } void CaptureOpenPanel::clear() @@ -920,20 +1033,45 @@ void CaptureOpenPanel::clear() void CaptureOpenPanel::updateMRL() { QString mrl = ""; + QStringList fileList; int i_devicetype = ui.deviceCombo->itemData( ui.deviceCombo->currentIndex() ).toInt(); switch( i_devicetype ) { -#ifndef WIN32 +#ifdef WIN32 + case BDA_DEVICE: + if( bdas->isChecked() ) mrl = "dvb-s://"; + else if( bdat->isChecked() ) mrl = "dvb-t://"; + else if( bdac->isChecked() ) mrl = "dvb-c://"; + else if( bdaa->isChecked() ) mrl = "atsc://"; + else return; + fileList << mrl; mrl = ""; + + mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() ); + if( bdas->isChecked() || bdac->isChecked() ) + mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() ); + else if( bdat->isChecked() ) + mrl += " :dvb-bandwidth=" + + QString("%1").arg( bdaBandBox->itemData( + bdaBandBox->currentIndex() ).toInt() ); + break; + case DSHOW_DEVICE: + fileList << "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; +#else case V4L_DEVICE: - mrl = "v4l://"; + fileList << "v4l://"; mrl += " :v4l-vdev=" + v4lVideoDevice->text(); mrl += " :v4l-adev=" + v4lAudioDevice->text(); mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() ); mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() ); break; case V4L2_DEVICE: - mrl = "v4l2://"; + fileList << "v4l2://"; mrl += " :v4l2-dev=" + v4l2VideoDevice->text(); mrl += " :v4l2-adev=" + v4l2AudioDevice->text(); mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() ); @@ -942,18 +1080,20 @@ void CaptureOpenPanel::updateMRL() mrl = "jack://"; mrl += "channels=" + QString("%1").arg( jackChannels->value() ); mrl += ":ports=" + jackPortsSelected->text(); - mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() ); + fileList << mrl; mrl = ""; + + mrl += " :jack-input-caching=" + QString("%1").arg( jackCaching->value() ); if ( jackPace->isChecked() ) { - mrl += " --jack-input-use-vlc-pace"; + mrl += " :jack-input-use-vlc-pace"; } if ( jackConnect->isChecked() ) { - mrl += " --jack-input-auto-connect"; + mrl += " :jack-input-auto-connect"; } break; case PVR_DEVICE: - mrl = "pvr://"; + fileList << "pvr://"; mrl += " :pvr-device=" + pvrDevice->text(); mrl += " :pvr-radio-device=" + pvrRadioDevice->text(); mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() ); @@ -963,42 +1103,22 @@ void CaptureOpenPanel::updateMRL() mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() ); break; case DVB_DEVICE: - mrl = "dvb://"; + fileList << "dvb://"; mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() ); mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() ); mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() ); break; -#else - case BDA_DEVICE: - if( bdas->isChecked() ) mrl = "dvb-s://"; - else if( bdat->isChecked() ) mrl = "dvb-t://"; - else if( bdac->isChecked() ) mrl = "dvb-c://"; - else return; - mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() ); - if( bdas->isChecked() || bdac->isChecked() ) - mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() ); - else - mrl += " :dvb-bandwidth=" + - QString("%1").arg( bdaBandBox->itemData( - 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: - mrl = "screen://"; + fileList << "screen://"; + mrl = " :screen-fps=" + QString("%1").arg( screenFPS->value() ); updateButtons(); break; } if( !advMRL.isEmpty() ) mrl += advMRL; - emit mrlUpdated( mrl ); + emit mrlUpdated( fileList, mrl ); } /** @@ -1014,15 +1134,9 @@ void CaptureOpenPanel::updateButtons() /* Get the current Device Number */ int i_devicetype = ui.deviceCombo->itemData( ui.deviceCombo->currentIndex() ).toInt(); - msg_Dbg( p_intf, "Capture Type: %i", i_devicetype ); switch( i_devicetype ) { -#ifndef WIN32 - case DVB_DEVICE: - if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz"); - if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz"); - break; -#else +#ifdef WIN32 case BDA_DEVICE: if( bdas->isChecked() || bdac->isChecked() ) { @@ -1031,7 +1145,7 @@ void CaptureOpenPanel::updateButtons() bdaBandBox->hide(); bdaBandLabel->hide(); } - else + else if( bdat->isChecked() ) { bdaSrate->hide(); bdaSrateLabel->hide(); @@ -1039,45 +1153,58 @@ void CaptureOpenPanel::updateButtons() bdaBandLabel->show(); } break; +#else + case DVB_DEVICE: + if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz"); + if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz"); + break; #endif case SCREEN_DEVICE: - ui.optionsBox->hide(); + //ui.optionsBox->hide(); ui.advancedButton->hide(); break; } - if( adv ) - { - delete adv; - advMRL.clear(); - } + advMRL.clear(); } void CaptureOpenPanel::advancedDialog() { + /* Get selected device type */ int i_devicetype = ui.deviceCombo->itemData( ui.deviceCombo->currentIndex() ).toInt(); + + /* Get the corresponding module */ module_t *p_module = - module_Find( VLC_OBJECT(p_intf), psz_devModule[i_devicetype] ); + module_find( psz_devModule[i_devicetype] ); if( NULL == p_module ) return; - unsigned int i_confsize; + /* Init */ QList controls; + /* Get the confsize */ + unsigned int i_confsize; module_config_t *p_config; - p_config = module_GetConfig( p_module, &i_confsize ); + p_config = module_config_get( p_module, &i_confsize ); + /* New Adv Prop dialog */ adv = new QDialog( this ); - adv->setWindowTitle( qtr( "Advanced options..." ) ); + adv->setWindowTitle( qtr( "Advanced Options" ) ); + /* A main Layout with a Frame */ QVBoxLayout *mainLayout = new QVBoxLayout( adv ); - //TODO QScrollArea - QFrame *advFrame = new QFrame; - mainLayout->addWidget( advFrame ); + QScrollArea *scroll = new QScrollArea; + mainLayout->addWidget( scroll ); + QFrame *advFrame = new QFrame; + /* GridLayout inside the Frame */ QGridLayout *gLayout = new QGridLayout( advFrame ); - for( int n = 0; n < i_confsize; n++ ) + scroll->setWidgetResizable( true ); + scroll->setWidget( advFrame ); + + /* Create the options inside the FrameLayout */ + for( int n = 0; n < (int)i_confsize; n++ ) { module_config_t *p_item = p_config + n; ConfigControl *config = ConfigControl::createControl( @@ -1085,19 +1212,9 @@ void CaptureOpenPanel::advancedDialog() controls.append( config ); } - /* QGroupBox *optionGroup = new QGroupBox( qtr( "Advanced options..." ) ); - QHBoxLayout *grLayout = new QHBoxLayout( optionGroup ); - - QLabel *optionLabel = new QLabel( qtr( "Options" ) + ":" ); - grLayout->addWidget( optionLabel ); - - QLineEdit *optionLine = new QLineEdit; - grLayout->addWidget( optionLine ); - - gLayout->addWidget( optionGroup, i_confsize, 0, 1, -1 );*/ - + /* Button stuffs */ QDialogButtonBox *advButtonBox = new QDialogButtonBox( adv ); - QPushButton *closeButton = new QPushButton( qtr( "Ok" ) ); + QPushButton *closeButton = new QPushButton( qtr( "OK" ) ); QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) ); CONNECT( closeButton, clicked(), adv, accept() ); @@ -1106,8 +1223,9 @@ void CaptureOpenPanel::advancedDialog() advButtonBox->addButton( closeButton, QDialogButtonBox::AcceptRole ); advButtonBox->addButton( cancelButton, QDialogButtonBox::RejectRole ); - gLayout->addWidget( advButtonBox, i_confsize + 1, 0, 1, -1 ); + mainLayout->addWidget( advButtonBox ); + /* Creation of the MRL */ if( adv->exec() ) { QString tempMRL = ""; @@ -1123,7 +1241,7 @@ void CaptureOpenPanel::advancedDialog() tempMRL += (i ? " :" : ":"); if( control->getType() == CONFIG_ITEM_BOOL ) - if( !( qobject_cast(control)->getValue() ) ) + if( !(qobject_cast(control)->getValue() ) ) tempMRL += "no-"; tempMRL += control->getName(); @@ -1134,7 +1252,7 @@ void CaptureOpenPanel::advancedDialog() case CONFIG_ITEM_FILE: case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_MODULE: - tempMRL += QString("=\"%1\"").arg( qobject_cast(control)->getValue() ); + tempMRL += QString("=%1").arg( qobject_cast(control)->getValue() ); break; case CONFIG_ITEM_INTEGER: tempMRL += QString("=%1").arg( qobject_cast(control)->getValue() ); @@ -1145,7 +1263,11 @@ void CaptureOpenPanel::advancedDialog() } } advMRL = tempMRL; - msg_Dbg( p_intf, "%s", qtu( advMRL ) ); updateMRL(); + msg_Dbg( p_intf, "%s", qtu( advMRL ) ); } + delete adv; + module_config_free( p_config ); + module_release (p_module); } +