]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open.cpp
Qt4 - Sprefs: cosmetic and string change.
[vlc] / modules / gui / qt4 / components / open.cpp
index 9018e0ed416276b44d804199dd60e30a04e4e23e..c55c6e97f172f83d0b08a36616a25c8bb8f8d3bd 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2006-2007 the VideoLAN team
  * Copyright (C) 2007 Société des arts technologiques
  * Copyright (C) 2007 Savoir-faire Linux
+ *
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
 #include "components/open.hpp"
 #include "dialogs/open.hpp"
 #include "dialogs_provider.hpp"
-#include "util/customwidgets.hpp"
+#include "components/preferences_widgets.hpp"
 
 #include <QFileDialog>
 #include <QDialogButtonBox>
 #include <QLineEdit>
 #include <QStackedLayout>
 #include <QListView>
+#include <QCompleter>
+#include <QDirModel>
 
 /**************************************************************************
  * Open Files and subtitles                                               *
@@ -47,6 +50,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     /* Classic UI Setup */
     ui.setupUi( this );
 
+    /** 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. */
@@ -60,64 +64,59 @@ 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( p_intf->p_libvlc->psz_homedir ), fileTypes );
+            qfu( psz_filepath ), fileTypes );
+    delete psz_filepath;
 
     dialogBox->setFileMode( QFileDialog::ExistingFiles );
     dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
 
-    /* retrieve last known path used in file browsing */
-    char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
-    if( psz_filepath )
-    {
-        dialogBox->setDirectory( qfu( psz_filepath ) );
-        delete psz_filepath;
-    }
-
     /* 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" ) );
 
-    // Add it to the layout
-    ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
-
     // But hide the two OK/Cancel buttons. Enable them for debug.
     QDialogButtonBox *fileDialogAcceptBox =
-                                        findChildren<QDialogButtonBox*>()[0];
+                      dialogBox->findChildren<QDialogButtonBox*>()[0];
     fileDialogAcceptBox->hide();
 
     /* Ugly hacks to get the good Widget */
     //This lineEdit is the normal line in the fileDialog.
-#if QT43
-    lineFileEdit = findChildren<QLineEdit*>()[2];
+#if HAS_QT43
+    lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
 #else
-    lineFileEdit = findChildren<QLineEdit*>()[3];
+    lineFileEdit = dialogBox->findChildren<QLineEdit*>()[1];
 #endif
-//    lineFileEdit->hide();
-
     /* Make a list of QLabel inside the QFileDialog to access the good ones */
-    QList<QLabel *> listLabel = findChildren<QLabel*>();
+    QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
 
     /* Hide the FileNames one. Enable it for debug */
-    listLabel[4]->hide();
+    listLabel[1]->setText( qtr( "File names:" ) );
     /* Change the text that was uncool in the usual box */
-    listLabel[5]->setText( qtr( "Filter:" ) );
-
-
-    QListView *fileListView = findChildren<QListView*>().first();
-#if WIN32
-    /* QFileDialog is quite buggy make it brerable on win32 by tweaking
-       the followin */
-    fileListView->setLayoutMode(QListView::Batched);
-    fileListView->setViewMode(QListView::ListMode);
-    fileListView->setResizeMode(QListView::Adjust);
-    fileListView->setUniformItemSizes(false);
-    fileListView->setFlow(QListView::TopToBottom);
-    fileListView->setWrapping(true);
-#endif
+    listLabel[2]->setText( qtr( "Filter:" ) );
+
+    dialogBox->layout()->setMargin( 0 );
+    dialogBox->layout()->setSizeConstraint( QLayout::SetMinimumSize );
+
+    /** END of QFileDialog tweaking **/
+
+    // Add the DialogBox to the layout
+    ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
+
+    //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->hide();
@@ -133,38 +132,15 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     BUTTONACT( ui.subBrowseButton, browseFileSub() );
     BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
 
-#if QT43
-    CONNECT( fileListView, clicked( QModelIndex ), this, updateMRL() );
-#else
-    CONNECT( ui.fileInput, editTextChanged( QString ), this, updateMRL() );
-#endif
-    CONNECT( ui.subInput, editTextChanged( QString ), this, updateMRL() );
-    CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this,
-                                                            updateMRL() );
-    CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this,
-                                                            updateMRL() );
-
-    CONNECT( lineFileEdit, textChanged( QString ), this, browseFile() );
+    CONNECT( lineFileEdit, textChanged( QString ), 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()
-{}
-
-QStringList FileOpenPanel::browse( QString help )
-{
-    return THEDP->showSimpleOpen( help );
-}
-
-void FileOpenPanel::browseFile()
-{
-    QString fileString = "";
-    foreach( QString file, dialogBox->selectedFiles() ) {
-         fileString += "\"" + file + "\" ";
-    }
-    ui.fileInput->setEditText( fileString );
-    updateMRL();
-}
+FileOpenPanel::~FileOpenPanel(){}
 
+/* Show a fileBrowser to select a subtitle */
 void FileOpenPanel::browseFileSub()
 {
     // FIXME Handle selection of more than one subtitles file
@@ -172,17 +148,20 @@ void FileOpenPanel::browseFileSub()
                             EXT_FILTER_SUBTITLE,
                             dialogBox->directory().absolutePath() );
     if( files.isEmpty() ) return;
-    ui.subInput->setEditText( files.join(" ") );
+    ui.subInput->setText( files.join(" ") );
     updateMRL();
 }
 
+/* Update the current MRL */
 void FileOpenPanel::updateMRL()
 {
-    msg_Dbg( p_intf, "I was here" );
-    QString mrl = ui.fileInput->currentText();
+    QString mrl = "";
+    foreach( QString file, dialogBox->selectedFiles() ) {
+         mrl += "\"" + file + "\" ";
+    }
 
     if( ui.subCheckBox->isChecked() ) {
-        mrl.append( " :sub-file=" + ui.subInput->currentText() );
+        mrl.append( " :sub-file=" + ui.subInput->text() );
         int align = ui.alignSubComboBox->itemData(
                     ui.alignSubComboBox->currentIndex() ).toInt();
         mrl.append( " :subsdec-align=" + QString().setNum( align ) );
@@ -191,6 +170,14 @@ void FileOpenPanel::updateMRL()
         mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
     }
 
+    emit mrlUpdated( 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() )) )
@@ -200,17 +187,6 @@ void FileOpenPanel::updateMRL()
                        qtu( dialogBox->directory().absolutePath() ) );
     }
     delete psz_filepath;
-
-    emit mrlUpdated( mrl );
-    emit methodChanged( "file-caching" );
-}
-
-
-/* Function called by Open Dialog when clicke on Play/Enqueue */
-void FileOpenPanel::accept()
-{
-    ui.fileInput->addItem( ui.fileInput->currentText());
-    if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem( 0 );
 }
 
 void FileOpenBox::accept()
@@ -221,22 +197,13 @@ void FileOpenBox::accept()
 /* Function called by Open Dialog when clicked on cancel */
 void FileOpenPanel::clear()
 {
-    ui.fileInput->setEditText( "" );
-    ui.subInput->setEditText( "" );
+    lineFileEdit->clear();
+    ui.subInput->clear();
 }
 
 void FileOpenPanel::toggleSubtitleFrame()
 {
-    if ( ui.subFrame->isVisible() )
-    {
-        ui.subFrame->hide();
-        updateGeometry();
-    /* FiXME Size */
-    }
-    else
-    {
-        ui.subFrame->show();
-    }
+    TOGGLEV( ui.subFrame );
 
     /* Update the MRL */
     updateMRL();
@@ -250,34 +217,91 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 {
     ui.setupUi( this );
 
-    /*Win 32 Probe  as in WX ? */
+    /* Get the default configuration path for the devices */
+    psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
+    psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
+    psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
+
+    /* State to avoid overwritting the users changes with the configuration */
+    b_firstdvd = true;
+    b_firstvcd = true;
+    b_firstcdda = true;
+
+#if WIN32 /* Disc drives probing for Windows */
+    char szDrives[512];
+    szDrives[0] = '\0';
+    if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
+    {
+        char *drive = szDrives;
+        UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
+        while( *drive )
+        {
+            if( GetDriveTypeA(drive) == DRIVE_CDROM )
+                ui.deviceCombo->addItem( drive );
+
+            /* go to next drive */
+            while( *(drive++) );
+        }
+        SetErrorMode(oldMode);
+    }
+#else /* Use a Completer under Linux */
+    QCompleter *discCompleter = new QCompleter( this );
+    discCompleter->setModel( new QDirModel( discCompleter ) );
+    ui.deviceCombo->setCompleter( discCompleter );
+#endif
 
     /* CONNECTs */
-    BUTTONACT( ui.dvdRadioButton, updateButtons());
-    BUTTONACT( ui.vcdRadioButton, updateButtons());
-    BUTTONACT( ui.audioCDRadioButton, updateButtons());
-    BUTTONACT( ui.dvdsimple,  updateButtons());
+    BUTTONACT( ui.dvdRadioButton, updateButtons() );
+    BUTTONACT( ui.vcdRadioButton, updateButtons() );
+    BUTTONACT( ui.audioCDRadioButton, updateButtons() );
+    BUTTONACT( ui.dvdsimple, updateButtons() );
+    BUTTONACT( ui.browseDiscButton, browseDevice() );
 
     CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
     CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
     CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
     CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
     CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
+
+    /* Run once the updateButtons function in order to fill correctly the comboBoxes */    
+    updateButtons();
 }
 
 DiscOpenPanel::~DiscOpenPanel()
-{}
+{
+    delete psz_dvddiscpath;
+    delete psz_vcddiscpath;
+    delete psz_cddadiscpath;
+}
 
 void DiscOpenPanel::clear()
 {
     ui.titleSpin->setValue( 0 );
     ui.chapterSpin->setValue( 0 );
+    b_firstcdda = true;
+    b_firstdvd = true;
+    b_firstvcd = true;
 }
 
+#ifdef WIN32
+    #define setDrive( psz_name ) {\
+    int index = ui.deviceCombo->findText( qfu( psz_name ) ); \
+    if( index != -1 ) ui.deviceCombo->setCurrentIndex( index );}
+#else
+    #define setDrive( psz_name ) {\
+    ui.deviceCombo->setEditText( qfu( psz_name ) ); }
+#endif
+
+/* update the buttons according the type of device */
 void DiscOpenPanel::updateButtons()
 {
     if ( ui.dvdRadioButton->isChecked() )
     {
+        if( b_firstdvd )
+        {
+            setDrive( psz_dvddiscpath );
+            b_firstdvd = false;
+        }
         ui.titleLabel->setText( qtr("Title") );
         ui.chapterLabel->show();
         ui.chapterSpin->show();
@@ -285,13 +309,23 @@ void DiscOpenPanel::updateButtons()
     }
     else if ( ui.vcdRadioButton->isChecked() )
     {
+        if( b_firstvcd )
+        {
+            setDrive( psz_vcddiscpath );
+            b_firstvcd = false;
+        }
         ui.titleLabel->setText( qtr("Entry") );
         ui.chapterLabel->hide();
         ui.chapterSpin->hide();
         ui.diskOptionBox_2->show();
     }
-    else
+    else /* CDDA */
     {
+        if( b_firstcdda )
+        {
+            setDrive( psz_cddadiscpath );
+            b_firstcdda = false;
+        }
         ui.titleLabel->setText( qtr("Track") );
         ui.chapterLabel->hide();
         ui.chapterSpin->hide();
@@ -301,7 +335,7 @@ void DiscOpenPanel::updateButtons()
     updateMRL();
 }
 
-
+/* Update the current MRL */
 void DiscOpenPanel::updateMRL()
 {
     QString mrl = "";
@@ -354,6 +388,18 @@ void DiscOpenPanel::updateMRL()
     emit mrlUpdated( 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 );
+    }
+    updateMRL();
+}
+
+void DiscOpenPanel::accept()
+{}
 
 /**************************************************************************
  * Open Network streams and URL pages                                     *
@@ -367,7 +413,7 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     CONNECT( ui.protocolCombo, currentIndexChanged( int ),
              this, updateProtocol( int ) );
     CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
-    CONNECT( ui.addressText, textChanged( QString ), this, updateAddress());
+    CONNECT( ui.addressText, textChanged( QString ), this, updateMRL());
     CONNECT( ui.timeShift, clicked(), this, updateMRL());
     CONNECT( ui.ipv6, clicked(), this, updateMRL());
 
@@ -386,6 +432,7 @@ NetOpenPanel::~NetOpenPanel()
 void NetOpenPanel::clear()
 {}
 
+/* update the widgets according the type of protocol */
 void NetOpenPanel::updateProtocol( int idx ) {
     QString addr = ui.addressText->text();
     QString proto = ui.protocolCombo->itemData( idx ).toString();
@@ -404,10 +451,6 @@ void NetOpenPanel::updateProtocol( int idx ) {
     updateMRL();
 }
 
-void NetOpenPanel::updateAddress() {
-    updateMRL();
-}
-
 void NetOpenPanel::updateMRL() {
     QString mrl = "";
     QString addr = ui.addressText->text();
@@ -419,6 +462,8 @@ void NetOpenPanel::updateMRL() {
         switch( proto ) {
         case 0:
             mrl = "http://" + addr;
+            emit methodChanged("http-caching");
+            break;
         case 1:
             mrl = "https://" + addr;
             emit methodChanged("http-caching");
@@ -522,6 +567,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     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 ) );
@@ -529,6 +576,39 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     CuMRL( v4lFreq, valueChanged ( int ) );
     CuMRL( v4lNormBox,  currentIndexChanged ( int ) );
 
+    /*******
+     * V4L2*
+     *******/
+    addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );
+
+    /* V4l Main panel */
+    QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
+    v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
+
+    v4l2VideoDevice = new QLineEdit;
+    v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 );
+
+    QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
+    v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 );
+
+    v4l2AudioDevice = new QLineEdit;
+    v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );
+
+    /* v4l2 Props panel */
+    QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) );
+    v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 );
+
+    v4l2StdBox = new QComboBox;
+    setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox );
+    v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 );
+    v4l2PropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+            1, 0, 3, 1 );
+
+    /* v4l2 CONNECTs */
+    CuMRL( v4l2VideoDevice, textChanged( QString ) );
+    CuMRL( v4l2AudioDevice, textChanged( QString ) );
+    CuMRL( v4l2StdBox,  currentIndexChanged ( int ) );
+
     /*******
      * JACK *
      *******/
@@ -547,7 +627,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     jackDevLayout->addWidget( jackChannels, 1, 1 );
 
     /* Jack Props panel */
-    
+
     /* Selected ports */
     QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
     jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
@@ -555,7 +635,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     jackPortsSelected = new QLineEdit( qtr( ".*") );
     jackPortsSelected->setAlignment( Qt::AlignRight );
     jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
-    
+
     /* Caching */
     QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) );
     jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
@@ -565,15 +645,15 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     jackCaching->setValue(1000);
     jackCaching->setAlignment( Qt::AlignRight );
     jackPropLayout->addWidget( jackCaching, 1 , 1 );
-    
+
     /* Pace */
     jackPace = new QCheckBox(qtr( "Use VLC pace" ));
     jackPropLayout->addWidget( jackPace, 2, 1 );
-    
+
     /* Auto Connect */
     jackConnect = new QCheckBox( qtr( "Auto connnection" ));
     jackPropLayout->addWidget( jackConnect, 3, 1 );
-    
+
     /* Jack CONNECTs */
     CuMRL( jackChannels, valueChanged( int ) );
     CuMRL( jackCaching, valueChanged( int ) );
@@ -624,6 +704,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     pvrBitr->setSuffix(" kHz");
     setSpinBoxFreq( pvrBitr );
     pvrPropLayout->addWidget( pvrBitr, 2, 1 );
+    pvrPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+            3, 0, 1, 1 );
 
     /* PVR CONNECTs */
     CuMRL( pvrDevice, textChanged( QString ) );
@@ -671,6 +753,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
     QLineEdit *dshowVSizeLine = new QLineEdit;
     dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
+    dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+            1, 0, 3, 1 );
 
     /* dshow CONNECTs */
     CuMRL( dshowVDevice, currentIndexChanged ( int ) );
@@ -725,6 +809,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
     bdaBandLabel->hide();
     bdaBandBox->hide();
+    bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+            2, 0, 2, 1 );
 
     /* bda CONNECTs */
     CuMRL( bdaFreq, valueChanged ( int ) );
@@ -782,6 +868,8 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     dvbSrate->setSuffix(" kHz");
     setSpinBoxFreq( dvbSrate );
     dvbPropLayout->addWidget( dvbSrate, 1, 1 );
+    dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+            2, 0, 2, 1 );
 
     /* DVB CONNECTs */
     CuMRL( dvbCard, valueChanged ( int ) );
@@ -795,14 +883,12 @@ 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.");
     screenLabel->setWordWrap( true );
     screenDevLayout->addWidget( screenLabel, 0, 0 );
 
-
     /* General connects */
     connect( ui.deviceCombo, SIGNAL( activated( int ) ),
                      stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
@@ -825,7 +911,6 @@ void CaptureOpenPanel::updateMRL()
     QString mrl = "";
     int i_devicetype = ui.deviceCombo->itemData(
             ui.deviceCombo->currentIndex() ).toInt();
-    msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
     switch( i_devicetype )
     {
     case V4L_DEVICE:
@@ -835,6 +920,12 @@ void CaptureOpenPanel::updateMRL()
         mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
         mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
         break;
+    case V4L2_DEVICE:
+        mrl = "v4l2://";
+        mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
+        mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
+        mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() );
+        break;
     case JACK_DEVICE:
         mrl = "jack://";
         mrl += "channels=" + QString("%1").arg( jackChannels->value() );
@@ -889,7 +980,7 @@ void CaptureOpenPanel::updateMRL()
 }
 
 /**
- * Update the Buttons (show/hide) for the GUI as all device type don't 
+ * Update the Buttons (show/hide) for the GUI as all device type don't
  * use the same ui. elements.
  **/
 void CaptureOpenPanel::updateButtons()