]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.cpp
Missing item to translate.
[vlc] / modules / gui / qt4 / components / open_panels.cpp
index 8752b444915cc9026c566561ea19db675542d5c5..488d3f34275d68436fde9e773f2cad7c75037cea 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * open.cpp : Panels for the open dialogs
  ****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright (C) 2006-2008 the VideoLAN team
  * Copyright (C) 2007 Société des arts technologiques
  * Copyright (C) 2007 Savoir-faire Linux
  *
@@ -26,6 +26,9 @@
  * 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"
@@ -40,6 +43,9 @@
 #include <QCompleter>
 #include <QDirModel>
 #include <QScrollArea>
+#include <QUrl>
+
+#define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory")
 
 /**************************************************************************
  * Open Files and subtitles                                               *
@@ -64,26 +70,22 @@ 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 );
+#if HAS_QT43
+    dialogBox->restoreState(
+            getSettings()->value( "file-dialog-state" ).toByteArray() );
+#endif
 
     /* 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" ) );
 
     // But hide the two OK/Cancel buttons. Enable them for debug.
     QDialogButtonBox *fileDialogAcceptBox =
@@ -106,7 +108,7 @@ 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 **/
 
@@ -138,7 +140,12 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
 }
 
-FileOpenPanel::~FileOpenPanel(){}
+FileOpenPanel::~FileOpenPanel()
+{
+#if HAS_QT43
+    getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
+#endif
+}
 
 /* Show a fileBrowser to select a subtitle */
 void FileOpenPanel::browseFileSub()
@@ -161,7 +168,7 @@ void FileOpenPanel::updateMRL()
     }
 
     if( ui.subCheckBox->isChecked() ) {
-        mrl.append( " :sub-file=" + ui.subInput->text() );
+        mrl.append( " :sub-file=\"" + ui.subInput->text() + "\"" );
         int align = ui.alignSubComboBox->itemData(
                     ui.alignSubComboBox->currentIndex() ).toInt();
         mrl.append( " :subsdec-align=" + QString().setNum( align ) );
@@ -178,20 +185,12 @@ void FileOpenPanel::updateMRL()
 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;
+    p_intf->p_sys->psz_filepath = qtu( dialogBox->directory().absolutePath() );
 }
 
 void FileOpenBox::accept()
 {
-    OpenDialog::getInstance( NULL, NULL )->play();
+    OpenDialog::getInstance( NULL, NULL, true )->selectSlots();
 }
 
 /* Function called by Open Dialog when clicked on cancel */
@@ -227,6 +226,9 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     b_firstvcd = true;
     b_firstcdda = true;
 
+    ui.browseDiscButton->setToolTip( I_DEVICE_TOOLTIP );
+    ui.deviceCombo->setToolTip( I_DEVICE_TOOLTIP );
+
 #if WIN32 /* Disc drives probing for Windows */
     char szDrives[512];
     szDrives[0] = '\0';
@@ -256,6 +258,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,9 +273,9 @@ 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()
@@ -306,6 +310,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 +323,7 @@ void DiscOpenPanel::updateButtons()
         ui.chapterLabel->hide();
         ui.chapterSpin->hide();
         ui.diskOptionBox_2->show();
+        ui.dvdsimple->setEnabled( false );
     }
     else /* CDDA */
     {
@@ -330,6 +336,7 @@ void DiscOpenPanel::updateButtons()
         ui.chapterLabel->hide();
         ui.chapterSpin->hide();
         ui.diskOptionBox_2->hide();
+        ui.dvdsimple->setEnabled( false );
     }
 
     updateMRL();
@@ -344,9 +351,9 @@ void DiscOpenPanel::updateMRL()
     /* DVD */
     if( ui.dvdRadioButton->isChecked() ) {
         if( !ui.dvdsimple->isChecked() )
-            mrl = "dvd://";
+            mrl = "\"dvd://";
         else
-            mrl = "dvdsimple://";
+            mrl = "\"dvdsimple://";
         mrl += ui.deviceCombo->currentText();
         emit methodChanged( "dvdnav-caching" );
 
@@ -359,7 +366,7 @@ void DiscOpenPanel::updateMRL()
 
     /* VCD */
     } else if ( ui.vcdRadioButton->isChecked() ) {
-        mrl = "vcd://" + ui.deviceCombo->currentText();
+        mrl = "\"vcd://" + ui.deviceCombo->currentText();
         emit methodChanged( "vcd-caching" );
 
         if( ui.titleSpin->value() > 0 ) {
@@ -368,12 +375,14 @@ void DiscOpenPanel::updateMRL()
 
     /* CDDA */
     } else {
-        mrl = "cdda://" + ui.deviceCombo->currentText();
+        mrl = "\"cdda://" + ui.deviceCombo->currentText();
         if( ui.titleSpin->value() > 0 ) {
             QString("@%1").arg( ui.titleSpin->value() );
         }
     }
 
+    mrl += "\"";
+
     if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
     {
         if ( ui.audioSpin->value() >= 0 ) {
@@ -391,13 +400,18 @@ void DiscOpenPanel::updateMRL()
 void DiscOpenPanel::browseDevice()
 {
     QString dir = QFileDialog::getExistingDirectory( 0,
-            qtr("Open a device or a VIDEO_TS directory") );
+            qtr( I_DEVICE_TOOLTIP ) );
     if (!dir.isEmpty()) {
         ui.deviceCombo->setEditText( dir );
     }
     updateMRL();
 }
 
+void DiscOpenPanel::eject()
+{
+    intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) );
+}
+
 void DiscOpenPanel::accept()
 {}
 
@@ -410,20 +424,23 @@ 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() );
 }
 
 NetOpenPanel::~NetOpenPanel()
@@ -433,19 +450,23 @@ 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.timeShift->setEnabled( idx_proto == UDP_PROTO );
+    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
+             addr.replace( QRegExp("^.*://"), proto + "://@");
         ui.addressText->setText( addr );
     }
     updateMRL();
@@ -454,50 +475,70 @@ void NetOpenPanel::updateProtocol( int idx ) {
 void NetOpenPanel::updateMRL() {
     QString mrl = "";
     QString addr = ui.addressText->text();
-    int proto = ui.protocolCombo->currentIndex();
+    addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
+    int idx_proto = ui.protocolCombo->currentIndex();
 
-    if( addr.contains( "://") && proto != 5 ) {
-        mrl = addr;
-    } else {
-        switch( proto ) {
-        case 0:
+    if( addr.contains( "://"))
+    {
+        /* Match the correct item in the comboBox */
+        ui.protocolCombo->setCurrentIndex(
+                ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );
+
+        if( idx_proto != UDP_PROTO || idx_proto != RTP_PROTO )
+            mrl = addr;
+    }
+    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:
+        case UDP_PROTO:
             mrl = "udp://@";
-            if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
-                mrl += "[::]";
+            /* Add [] to IPv6 */
+            if ( addr.contains(':') && !addr.contains('[') )
+            {
+                mrl += "[" + addr + "]";
             }
+            else mrl += addr;
             mrl += QString(":%1").arg( ui.portSpin->value() );
             emit methodChanged("udp-caching");
             break;
-        case 6: /* UDP multicast */
-            mrl = "udp://@";
-            /* Add [] to IPv6 */
-            if ( addr.contains(':') && !addr.contains('[') ) {
-                mrl += "[" + addr + "]";
-            } else mrl += addr;
+        case RTP_PROTO:
+            mrl = "rtp://@";
+            if ( addr.contains(':') && !addr.contains('[') )
+                mrl += "[" + addr + "]"; /* Add [] to IPv6 */
+            else
+                mrl += addr;
             mrl += QString(":%1").arg( ui.portSpin->value() );
-            emit methodChanged("udp-caching");
+            emit methodChanged("rtp-caching");
+            break;
+        case RTMP_PROTO:
+            mrl = "rtmp://" + addr;
+            emit methodChanged("rtmp-caching");
+            break;
         }
     }
+
+    // Encode the boring stuffs
+
     if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
         mrl += " :access-filter=timeshift";
     }
@@ -535,52 +576,106 @@ 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( p_intf, "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( p_intf, "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" );
+
+    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 );
 
-    /* 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( bdas, updateMRL() );
+    BUTTONACT( bdat, updateMRL() );
+    BUTTONACT( bdac, updateMRL() );
     }
 
+#else /* WIN32 */
     /*******
      * V4L2*
      *******/
@@ -616,6 +711,51 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     CuMRL( v4l2StdBox,  currentIndexChanged ( int ) );
     }
 
+    /*******
+     * V4L *
+     *******/
+    if( module_Exists( p_intf, "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 *
      *******/
@@ -624,7 +764,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
     /* Jack Main panel */
     /* Channels */
-    QLabel *jackChannelsLabel = new QLabel( qtr( "Channels :" ) );
+    QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) );
     jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
 
     jackChannels = new QSpinBox;
@@ -637,7 +777,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     /* Jack Props panel */
 
     /* Selected ports */
-    QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
+    QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports:" ) );
     jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
 
     jackPortsSelected = new QLineEdit( qtr( ".*") );
@@ -645,7 +785,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
 
     /* 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 );
@@ -785,105 +925,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
 
 
@@ -897,10 +938,10 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     screenDevLayout->addWidget( screenLabel, 0, 0 );
 
     /* 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 +950,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
 CaptureOpenPanel::~CaptureOpenPanel()
 {
-    if( adv ) delete adv;
 }
 
 void CaptureOpenPanel::clear()
@@ -924,7 +964,28 @@ void CaptureOpenPanel::updateMRL()
             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 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;
+#else
     case V4L_DEVICE:
         mrl = "v4l://";
         mrl += " :v4l-vdev=" + v4lVideoDevice->text();
@@ -968,27 +1029,6 @@ void CaptureOpenPanel::updateMRL()
         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://";
@@ -1014,15 +1054,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() )
         {
@@ -1039,6 +1073,11 @@ 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();
@@ -1046,37 +1085,47 @@ void CaptureOpenPanel::updateButtons()
         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] );
     if( NULL == p_module ) return;
 
-    unsigned int i_confsize;
+    /* Init */
     QList<ConfigControl *> controls;
 
+    /* Get the confsize  */
+    unsigned int i_confsize;
     module_config_t *p_config;
     p_config = module_GetConfig( 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 );
 
+    /* GridLayout inside the Frame */
     QGridLayout *gLayout = new QGridLayout( advFrame );
+    gLayout->setSizeConstraint( QLayout::SetFixedSize );
 
+    scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
+    scroll->setWidgetResizable( true );
+    scroll->setWidget( advFrame );
+
+    /* Create the options inside the FrameLayout */
     for( int n = 0; n < i_confsize; n++ )
     {
         module_config_t *p_item = p_config + n;
@@ -1085,19 +1134,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 +1145,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 +1163,7 @@ void CaptureOpenPanel::advancedDialog()
             tempMRL += (i ? " :" : ":");
 
             if( control->getType() == CONFIG_ITEM_BOOL )
-                if( !( qobject_cast<VIntConfigControl *>(control)->getValue() ) )
+                if( !(qobject_cast<VIntConfigControl *>(control)->getValue() ) )
                     tempMRL += "no-";
 
             tempMRL += control->getName();
@@ -1145,7 +1185,9 @@ void CaptureOpenPanel::advancedDialog()
             }
         }
         advMRL = tempMRL;
-        msg_Dbg( p_intf, "%s", qtu( advMRL ) );
         updateMRL();
+        msg_Dbg( p_intf, "%s", qtu( advMRL ) );
     }
+    delete adv;
 }
+