]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.cpp
add caching emits for dvb, dshow, screen and dvdread
[vlc] / modules / gui / qt4 / components / open_panels.cpp
index e22d4b297e55aef0afa483d41cc3d5da13d52c82..59e42b08fc049823b9a25682677ba6e6b8ed41e3 100644 (file)
@@ -56,29 +56,65 @@ static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
  * Open Files and subtitles                                               *
  **************************************************************************/
 FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
-                                OpenPanel( _parent, _p_intf )
+                                OpenPanel( _parent, _p_intf ), dialogBox( NULL )
 {
     /* 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.
-       Be very careful and test correctly when you modify this. */
-
     /* Set Filters for file selection */
-    QString fileTypes = "";
+/*    QString fileTypes = "";
     ADD_FILTER_MEDIA( fileTypes );
     ADD_FILTER_VIDEO( fileTypes );
     ADD_FILTER_AUDIO( fileTypes );
     ADD_FILTER_PLAYLIST( fileTypes );
     ADD_FILTER_ALL( fileTypes );
-    fileTypes.replace( QString(";*"), QString(" *"));
+    fileTypes.replace( QString(";*"), QString(" *")); */
+
+
+/*    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 );*/
+    if( config_GetInt( p_intf, "qt-embedded-open" ) )
+    {
+        ui.tempWidget->hide();
+        BuildOldPanel();
+    }
+
+    /* Subtitles */
+    /* Deactivate the subtitles control by default. */
+    ui.subFrame->setEnabled( false );
+    /* Build the subs size combo box */
+    setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
+                            ui.sizeSubComboBox );
+    /* Build the subs align combo box */
+    setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
+
+    /* Connects  */
+    BUTTONACT( ui.fileBrowseButton, browseFile() );
+    BUTTONACT( ui.removeFileButton, removeFile() );
+
+    BUTTONACT( ui.subBrowseButton, browseFileSub() );
+    CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) );
+
+    CONNECT( ui.fileListWidg, itemChanged( QListWidgetItem * ), this, updateMRL() );
+    CONNECT( ui.subInput, textChanged( const QString& ), this, updateMRL() );
+    CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
+    CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
+    updateButtons();
+}
 
-    // Make this QFileDialog a child of tempWidget from the ui.
+inline void FileOpenPanel::BuildOldPanel()
+{
+    /** 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.
+       Be very careful and test correctly when you modify this. */
+
+    /* Make this QFileDialog a child of tempWidget from the ui. */
     dialogBox = new FileOpenBox( ui.tempWidget, NULL,
-            qfu( p_intf->p_sys->psz_filepath ), fileTypes );
+                                 p_intf->p_sys->filepath, "" );
 
     dialogBox->setFileMode( QFileDialog::ExistingFiles );
     dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
@@ -99,7 +135,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.
-    lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
+    QLineEdit *lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
     /* Make a list of QLabel inside the QFileDialog to access the good ones */
     QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
 
@@ -115,61 +151,54 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
     // 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 );*/
-
-    // Hide the subtitles control by default.
-    ui.subFrame->setEnabled( false );
-
-    /* Build the subs size combo box */
-    setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
-                            ui.sizeSubComboBox );
-
-    /* Build the subs align combo box */
-    setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
-
-    /* Connects  */
-    BUTTONACT( ui.fileBrowseButton, browseFile() );
-    BUTTONACT( ui.subBrowseButton, browseFileSub() );
-    CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) );
-
-    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() );
+    CONNECT( lineFileEdit, textChanged( const QString& ), this, updateMRL() );
+    dialogBox->installEventFilter( this );
 }
 
 FileOpenPanel::~FileOpenPanel()
 {
-//  getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
+    if( dialogBox )
+        getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
 }
 
 void FileOpenPanel::browseFile()
 {
-    QStringList files = QFileDialog::getOpenFileNames( this );
-    foreach( const QString &file, files)
+    QStringList files = QFileDialog::getOpenFileNames( this, qtr( "Select one or multiple files" ), p_intf->p_sys->filepath) ;
+    foreach( const QString &file, files )
     {
-        QListWidgetItem *item = new QListWidgetItem( file, ui.fileListWidg );
+        QListWidgetItem *item =
+            new QListWidgetItem( toNativeSeparators( file ), ui.fileListWidg );
         item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled );
         ui.fileListWidg->addItem( item );
+        savedirpathFromFile( file );
     }
+    updateButtons();
     updateMRL();
 }
 
+void FileOpenPanel::removeFile()
+{
+    int i = ui.fileListWidg->currentRow();
+    if( i != -1 )
+    {
+        QListWidgetItem *temp = ui.fileListWidg->takeItem( i );
+        delete temp;
+    }
+
+    updateMRL();
+    updateButtons();
+}
+
 /* 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, p_intf->p_sys->psz_filepath );
+                           EXT_FILTER_SUBTITLE, p_intf->p_sys->filepath );
 
     if( files.isEmpty() ) return;
-    ui.subInput->setText( files.join(" ") );
+    ui.subInput->setText( toNativeSeparators( files.join(" ") ) );
     updateMRL();
 }
 
@@ -188,9 +217,17 @@ void FileOpenPanel::updateMRL()
     QStringList fileList;
     QString mrl;
 
-    for( int i = 0; i < ui.fileListWidg->count(); i++ )
-        fileList << ui.fileListWidg->item( i )->text();
+    /* File Listing */
+    if( dialogBox == NULL )
+        for( int i = 0; i < ui.fileListWidg->count(); i++ )
+        {
+            if( !ui.fileListWidg->item( i )->text().isEmpty() )
+                fileList << ui.fileListWidg->item( i )->text();
+        }
+    else
+        fileList = dialogBox->selectedFiles();
 
+    /* Options */
     if( ui.subCheckBox->isChecked() &&  !ui.subInput->text().isEmpty() ) {
         mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) );
         int align = ui.alignSubComboBox->itemData(
@@ -208,8 +245,8 @@ void FileOpenPanel::updateMRL()
 /* Function called by Open Dialog when clicke on Play/Enqueue */
 void FileOpenPanel::accept()
 {
-    //FIXME
//   p_intf->p_sys->psz_filepath = qtu( dialogBox->directory().absolutePath() );
+    if( dialogBox )
       p_intf->p_sys->filepath = dialogBox->directory().absolutePath();
     ui.fileListWidg->clear();
 }
 
@@ -220,6 +257,14 @@ void FileOpenPanel::clear()
     ui.subInput->clear();
 }
 
+/* Update buttons depending on current selection */
+void FileOpenPanel::updateButtons()
+{
+    bool b_has_files = ( ui.fileListWidg->count() > 0 );
+    ui.removeFileButton->setEnabled( b_has_files );
+    ui.subCheckBox->setEnabled( b_has_files );
+}
+
 /**************************************************************************
  * Open Discs ( DVD, CD, VCD and similar devices )                        *
  **************************************************************************/
@@ -239,7 +284,7 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     b_firstcdda = true;
 
     ui.browseDiscButton->setToolTip( qtr( I_DEVICE_TOOLTIP ));
-    ui.deviceCombo->setToolTip( I_DEVICE_TOOLTIP );
+    ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) );
 
 #ifdef WIN32 /* Disc drives probing for Windows */
     char szDrives[512];
@@ -270,7 +315,7 @@ 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" ),
+    BUTTON_SET_ACT_I( ui.ejectButton, "", toolbar/eject, qtr( "Eject the disc" ),
             eject() );
 
     CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
@@ -356,6 +401,8 @@ void DiscOpenPanel::updateButtons()
     updateMRL();
 }
 
+#undef setDrive
+
 /* Update the current MRL */
 void DiscOpenPanel::updateMRL()
 {
@@ -370,7 +417,10 @@ void DiscOpenPanel::updateMRL()
         else
             mrl = "dvdsimple://";
         mrl += ui.deviceCombo->currentText();
-        emit methodChanged( "dvdnav-caching" );
+        if( !ui.dvdsimple->isChecked() )
+            emit methodChanged( "dvdnav-caching" );
+        else
+            emit methodChanged( "dvdread-caching" );
 
         if ( ui.titleSpin->value() > 0 ) {
             mrl += QString("@%1").arg( ui.titleSpin->value() );
@@ -391,9 +441,7 @@ void DiscOpenPanel::updateMRL()
     /* CDDA */
     } else {
         mrl = "cdda://" + ui.deviceCombo->currentText();
-        if( ui.titleSpin->value() > 0 ) {
-            mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() );
-        }
+        emit methodChanged( "cdda-caching" );
     }
 
     fileList << mrl; mrl = "";
@@ -409,6 +457,11 @@ void DiscOpenPanel::updateMRL()
                 QString("%1").arg( ui.subtitlesSpin->value() );
         }
     }
+    else
+    {
+        if( ui.titleSpin->value() > 0 )
+            mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() );
+    }
     emit mrlUpdated( fileList, mrl );
 }
 
@@ -442,7 +495,7 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     CONNECT( ui.protocolCombo, activated( int ),
              this, updateProtocol( int ) );
     CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
-    CONNECT( ui.addressText, textChanged( QString ), this, updateMRL());
+    CONNECT( ui.addressText, textChanged( const QString& ), this, updateMRL());
 
     ui.protocolCombo->addItem( "" );
     ui.protocolCombo->addItem("HTTP", QVariant("http"));
@@ -477,6 +530,8 @@ NetOpenPanel::~NetOpenPanel()
     while( tempL.size() > 8 ) tempL.removeFirst();
 
     getSettings()->setValue( "Open/netMRL", tempL );
+
+    delete mrlList;
 }
 
 void NetOpenPanel::clear()
@@ -512,12 +567,7 @@ void NetOpenPanel::updateProtocol( int idx_proto ) {
 void NetOpenPanel::updateMRL() {
     QString mrl = "";
     QString addr = ui.addressText->text();
-    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 */
@@ -548,33 +598,40 @@ void NetOpenPanel::updateMRL() {
             mrl = "rtsp://" + addr;
             emit methodChanged("rtsp-caching");
             break;
+        case RTP_PROTO:
         case UDP_PROTO:
-            if(( addr_is_multicast ) || ( !addr_is_ipv4 && !addr_is_ipv6 ))
-                mrl = "udp://@";
-        else
-                    mrl = "udp://";
-            /* Add [] to IPv6 */
-            if ( addr_is_ipv6  && !addr.contains('[') )
+            mrl = qfu(((idx_proto == RTP_PROTO) ? "rtp" : "udp"));
+            mrl += qfu( "://" );
+            if( addr[0] == ':' ) /* Port number without address */
+                mrl += addr;
+            else
             {
-                mrl += "[" + addr + "]";
+                mrl += qfu( "@" );
+                switch( addr.count( ":" ) )
+                {
+                    case 0: /* DNS or IPv4 literal, no port number */
+                        mrl += addr;
+                        mrl += QString(":%1").arg( ui.portSpin->value() );
+                        break;
+                    case 1: /* DNS or IPv4 literal plus port number */
+                        mrl += addr;
+                        break;
+                    default: /* IPv6 literal */
+                        if( !addr.contains( "]:" ) )
+                        {
+                            if( addr[0] != '[' ) /* Missing brackets */
+                                mrl += qfu( "[" ) + addr + qfu( "]" );
+                            else
+                                mrl += addr;
+                            mrl += QString(":%1").arg( ui.portSpin->value() );
+                        }
+                        else /* Brackets present, port present */
+                            mrl += addr;
+                        break;
+                }
             }
-            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");
+            emit methodChanged(idx_proto == RTP_PROTO
+                                   ? "rtp-caching" : "udp-caching");
             break;
         case RTMP_PROTO:
             mrl = "rtmp://" + addr;
@@ -591,7 +648,8 @@ void NetOpenPanel::updateCompleter()
 {
     assert( mrlList );
     QStringList tempL = mrlList->stringList();
-    tempL.append( ui.addressText->text() );
+    if( !tempL.contains( ui.addressText->text() ) )
+        tempL.append( ui.addressText->text() );
     mrlList->setStringList( tempL );
 }
 
@@ -623,13 +681,13 @@ void CaptureOpenPanel::initialize()
     ui.optionsBox->setLayout( stackedPropLayout );
 
     /* Creation and connections of the WIdgets in the stacked layout */
-#define addModuleAndLayouts( number, name, label )                    \
+#define addModuleAndLayouts( number, name, label, layout )            \
     QWidget * name ## DevPage = new QWidget( this );                  \
     QWidget * name ## PropPage = new QWidget( this );                 \
     stackedDevLayout->addWidget( name ## DevPage );        \
     stackedPropLayout->addWidget( name ## PropPage );      \
-    QGridLayout * name ## DevLayout = new QGridLayout;                \
-    QGridLayout * name ## PropLayout = new QGridLayout;               \
+    layout * name ## DevLayout = new layout;                \
+    layout * name ## PropLayout = new layout;               \
     name ## DevPage->setLayout( name ## DevLayout );                  \
     name ## PropPage->setLayout( name ## PropLayout );                \
     ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
@@ -641,7 +699,7 @@ void CaptureOpenPanel::initialize()
      * DirectShow Stuffs *
      *********************/
     if( module_exists( "dshow" ) ){
-    addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
+    addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow", QGridLayout );
 
     /* dshow Main */
     int line = 0;
@@ -668,14 +726,14 @@ void CaptureOpenPanel::initialize()
     /* dshow CONNECTs */
     CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) );
     CuMRL( adevDshowW->combo, currentIndexChanged ( int ) );
-    CuMRL( dshowVSizeLine, textChanged( QString ) );
+    CuMRL( dshowVSizeLine, textChanged( const QString& ) );
     }
 
     /**************
      * BDA Stuffs *
      **************/
     if( module_exists( "bda" ) ){
-    addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
+    addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow", QGridLayout );
 
     /* bda Main */
     QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
@@ -744,7 +802,7 @@ void CaptureOpenPanel::initialize()
      * V4L2*
      *******/
     if( module_exists( "v4l2" ) ){
-    addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );
+    addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2", QGridLayout );
 
     /* V4l Main panel */
     QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
@@ -770,8 +828,8 @@ void CaptureOpenPanel::initialize()
             1, 0, 3, 1 );
 
     /* v4l2 CONNECTs */
-    CuMRL( v4l2VideoDevice, textChanged( QString ) );
-    CuMRL( v4l2AudioDevice, textChanged( QString ) );
+    CuMRL( v4l2VideoDevice, textChanged( const QString& ) );
+    CuMRL( v4l2AudioDevice, textChanged( const QString& ) );
     CuMRL( v4l2StdBox,  currentIndexChanged ( int ) );
     }
 
@@ -779,7 +837,7 @@ void CaptureOpenPanel::initialize()
      * V4L *
      *******/
     if( module_exists( "v4l" ) ){
-    addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
+    addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux", QGridLayout );
 
     /* V4l Main panel */
     QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
@@ -814,8 +872,8 @@ void CaptureOpenPanel::initialize()
             2, 0, 2, 1 );
 
     /* v4l CONNECTs */
-    CuMRL( v4lVideoDevice, textChanged( QString ) );
-    CuMRL( v4lAudioDevice, textChanged( QString ) );
+    CuMRL( v4lVideoDevice, textChanged( const QString& ) );
+    CuMRL( v4lAudioDevice, textChanged( const QString& ) );
     CuMRL( v4lFreq, valueChanged ( int ) );
     CuMRL( v4lNormBox,  currentIndexChanged ( int ) );
     }
@@ -824,7 +882,8 @@ void CaptureOpenPanel::initialize()
      * JACK *
      *******/
     if( module_exists( "jack" ) ){
-    addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
+    addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit",
+                         QGridLayout);
 
     /* Jack Main panel */
     /* Channels */
@@ -871,14 +930,14 @@ void CaptureOpenPanel::initialize()
     CuMRL( jackCaching, valueChanged( int ) );
     CuMRL( jackPace, stateChanged( int ) );
     CuMRL( jackConnect, stateChanged( int ) );
-    CuMRL( jackPortsSelected, textChanged( QString ) );
+    CuMRL( jackPortsSelected, textChanged( const QString& ) );
     }
 
     /************
      * PVR      *
      ************/
     if( module_exists( "pvr" ) ){
-    addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
+    addModuleAndLayouts( PVR_DEVICE, pvr, "PVR", QGridLayout );
 
     /* PVR Main panel */
     QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
@@ -922,8 +981,8 @@ void CaptureOpenPanel::initialize()
             3, 0, 1, 1 );
 
     /* PVR CONNECTs */
-    CuMRL( pvrDevice, textChanged( QString ) );
-    CuMRL( pvrRadioDevice, textChanged( QString ) );
+    CuMRL( pvrDevice, textChanged( const QString& ) );
+    CuMRL( pvrRadioDevice, textChanged( const QString& ) );
 
     CuMRL( pvrFreq, valueChanged ( int ) );
     CuMRL( pvrBitr, valueChanged ( int ) );
@@ -934,7 +993,7 @@ void CaptureOpenPanel::initialize()
      * DVB Stuffs *
      **************/
     if( module_exists( "dvb" ) ){
-    addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
+    addModuleAndLayouts( DVB_DEVICE, dvb, "DVB", QGridLayout );
 
     /* DVB Main */
     QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
@@ -965,10 +1024,11 @@ void CaptureOpenPanel::initialize()
     dvbFreq = new QSpinBox;
     dvbFreq->setAlignment( Qt::AlignRight );
     dvbFreq->setSuffix(" kHz");
+    dvbFreq->setSingleStep( 1000 );
     setSpinBoxFreq( dvbFreq  );
     dvbPropLayout->addWidget( dvbFreq, 0, 1 );
 
-    QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
+    dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
     dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
 
     dvbSrate = new QSpinBox;
@@ -976,6 +1036,24 @@ void CaptureOpenPanel::initialize()
     dvbSrate->setSuffix(" kHz");
     setSpinBoxFreq( dvbSrate );
     dvbPropLayout->addWidget( dvbSrate, 1, 1 );
+
+    dvbBandLabel = new QLabel( qtr( "Bandwidth" ) );
+    dvbPropLayout->addWidget( dvbBandLabel, 2, 0 );
+
+    dvbBandBox = new QComboBox;
+    /* This doesn't work since dvb-bandwidth doesn't seem to be a
+       list of Integers
+       setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
+     */
+    dvbBandBox->addItem( qtr( "Auto" ), 0 );
+    dvbBandBox->addItem( qtr( "6 MHz" ), 6 );
+    dvbBandBox->addItem( qtr( "7 MHz" ), 7 );
+    dvbBandBox->addItem( qtr( "8 MHz" ), 8 );
+    dvbPropLayout->addWidget( dvbBandBox, 2, 1 );
+
+    dvbBandLabel->hide();
+    dvbBandBox->hide();
+
     dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
             2, 0, 2, 1 );
 
@@ -983,10 +1061,14 @@ void CaptureOpenPanel::initialize()
     CuMRL( dvbCard, valueChanged ( int ) );
     CuMRL( dvbFreq, valueChanged ( int ) );
     CuMRL( dvbSrate, valueChanged ( int ) );
+    CuMRL( dvbBandBox, currentIndexChanged ( int ) );
 
     BUTTONACT( dvbs, updateButtons() );
     BUTTONACT( dvbt, updateButtons() );
     BUTTONACT( dvbc, updateButtons() );
+    BUTTONACT( dvbs, updateMRL() );
+    BUTTONACT( dvbt, updateMRL() );
+    BUTTONACT( dvbc, updateMRL() );
     }
 
 #endif
@@ -995,9 +1077,9 @@ void CaptureOpenPanel::initialize()
     /**********
      * Screen *
      **********/
-    addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
-    QLabel *screenLabel = new QLabel( "Your display will will be "
-            "opened and played in order to stream or save it." );
+    addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop", QGridLayout );
+    QLabel *screenLabel = new QLabel( qtr( "Your display will be "
+            "opened and played in order to stream or save it." ) );
     screenLabel->setWordWrap( true );
     screenDevLayout->addWidget( screenLabel, 0, 0 );
 
@@ -1010,6 +1092,9 @@ void CaptureOpenPanel::initialize()
     screenFPS->setAlignment( Qt::AlignRight );
     screenPropLayout->addWidget( screenFPS, 0, 1 );
 
+    /* Screen connect */
+    CuMRL( screenFPS, valueChanged( int ) );
+
     /* General connects */
     CONNECT( ui.deviceCombo, activated( int ) ,
              stackedDevLayout, setCurrentIndex( int ) );
@@ -1018,7 +1103,8 @@ void CaptureOpenPanel::initialize()
     CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
     CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
 
-#undef addModule
+#undef CuMRL
+#undef addModuleAndLayouts
 }
 
 CaptureOpenPanel::~CaptureOpenPanel()
@@ -1045,15 +1131,18 @@ void CaptureOpenPanel::updateMRL()
         else if(  bdac->isChecked() ) mrl = "dvb-c://";
         else if(  bdaa->isChecked() ) mrl = "atsc://";
         else return;
+        mrl += "frequency=" + QString::number( bdaFreq->value() );
+        if( bdac->isChecked() || bdat->isChecked() || bdaa->isChecked() )
+            mrl +="000";
         fileList << mrl; mrl = "";
 
-        mrl += " :dvb-frequency=" + QString::number( bdaFreq->value() );
         if( bdas->isChecked() || bdac->isChecked() )
             mrl += " :dvb-srate=" + QString::number( bdaSrate->value() );
-        else if( bdat->isChecked() )
+        else if( bdat->isChecked() || bdaa->isChecked() )
             mrl += " :dvb-bandwidth=" +
                 QString::number( bdaBandBox->itemData(
                     bdaBandBox->currentIndex() ).toInt() );
+        emit methodChanged( "dvb-caching" );
         break;
     case DSHOW_DEVICE:
         fileList << "dshow://";
@@ -1063,19 +1152,19 @@ void CaptureOpenPanel::updateMRL()
             colon_escape( QString("%1").arg( adevDshowW->getValue() ) );
         if( dshowVSizeLine->isModified() )
             mrl += " :dshow-size=" + dshowVSizeLine->text();
+        emit methodChanged( "dshow-caching" );
         break;
 #else
     case V4L_DEVICE:
         fileList << "v4l://";
         mrl += " :v4l-vdev=" + v4lVideoDevice->text();
-        mrl += " :v4l-adev=" + v4lAudioDevice->text();
+        mrl += " :input-slave=alsa://" + v4lAudioDevice->text();
         mrl += " :v4l-norm=" + QString::number( v4lNormBox->currentIndex() );
         mrl += " :v4l-frequency=" + QString::number( v4lFreq->value() );
         break;
     case V4L2_DEVICE:
-        fileList << "v4l2://";
-        mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
-        mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
+        fileList << "v4l2://" + v4l2VideoDevice->text();
+        mrl += " :input-slave=alsa://" + v4l2AudioDevice->text();
         mrl += " :v4l2-standard=" + QString::number( v4l2StdBox->currentIndex() );
         break;
     case JACK_DEVICE:
@@ -1105,15 +1194,26 @@ void CaptureOpenPanel::updateMRL()
             mrl += " :pvr-bitrate=" + QString::number( pvrBitr->value() );
         break;
     case DVB_DEVICE:
-        fileList << "dvb://";
+        mrl = "dvb://";
+        mrl += "frequency=" + QString::number( dvbFreq->value() );
+        if( dvbc->isChecked() || dvbt->isChecked() )
+            mrl +="000";
+        fileList << mrl; mrl= "";
+
         mrl += " :dvb-adapter=" + QString::number( dvbCard->value() );
-        mrl += " :dvb-frequency=" + QString::number( dvbFreq->value() );
-        mrl += " :dvb-srate=" + QString::number( dvbSrate->value() );
+        if( dvbs->isChecked() || dvbc->isChecked() )
+            mrl += " :dvb-srate=" + QString::number( dvbSrate->value() );
+        else if( dvbt->isChecked() )
+            mrl += " :dvb-bandwidth=" +
+                QString::number( dvbBandBox->itemData(
+                    dvbBandBox->currentIndex() ).toInt() );
+
         break;
 #endif
     case SCREEN_DEVICE:
         fileList << "screen://";
         mrl = " :screen-fps=" + QString::number( screenFPS->value() );
+        emit methodChanged( "screen-caching" );
         updateButtons();
         break;
     }
@@ -1147,7 +1247,7 @@ void CaptureOpenPanel::updateButtons()
             bdaBandBox->hide();
             bdaBandLabel->hide();
         }
-        else if( bdat->isChecked() )
+        else if( bdat->isChecked() || bdaa->isChecked() )
         {
             bdaSrate->hide();
             bdaSrateLabel->hide();
@@ -1157,8 +1257,20 @@ void CaptureOpenPanel::updateButtons()
         break;
 #else
     case DVB_DEVICE:
-        if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
-        if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
+        if( dvbs->isChecked() || dvbc->isChecked() )
+        {
+            dvbSrate->show();
+            dvbSrateLabel->show();
+            dvbBandBox->hide();
+            dvbBandLabel->hide();
+        }
+        else if( dvbt->isChecked() )
+        {
+            dvbSrate->hide();
+            dvbSrateLabel->hide();
+            dvbBandBox->show();
+            dvbBandLabel->show();
+        }
         break;
 #endif
     case SCREEN_DEVICE:
@@ -1211,7 +1323,8 @@ void CaptureOpenPanel::advancedDialog()
         module_config_t *p_item = p_config + n;
         ConfigControl *config = ConfigControl::createControl(
                         VLC_OBJECT( p_intf ), p_item, advFrame, gLayout, n );
-        controls.append( config );
+        if ( config )
+            controls.append( config );
     }
 
     /* Button stuffs */
@@ -1234,11 +1347,6 @@ void CaptureOpenPanel::advancedDialog()
         for( int i = 0; i < controls.size(); i++ )
         {
             ConfigControl *control = controls[i];
-            if( !control )
-            {
-                msg_Dbg( p_intf, "This shouldn't happen, please report" );
-                continue;
-            }
 
             tempMRL += (i ? " :" : ":");
 
@@ -1268,6 +1376,11 @@ void CaptureOpenPanel::advancedDialog()
         updateMRL();
         msg_Dbg( p_intf, "%s", qtu( advMRL ) );
     }
+    for( int i = 0; i < controls.size(); i++ )
+    {
+        ConfigControl *control = controls[i];
+        delete control ;
+    }
     delete adv;
     module_config_free( p_config );
     module_release (p_module);