]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.cpp
Fix the '@' disappearance in UDP addresses.
[vlc] / modules / gui / qt4 / components / open_panels.cpp
index a7bd2fc0a115383da7074be5e26b878f25f4566e..c187aa7b5948e52983350c670607f58712048944 100644 (file)
@@ -104,7 +104,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 **/
 
@@ -161,7 +161,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 ) );
@@ -248,6 +248,7 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     BUTTONACT( ui.audioCDRadioButton, updateButtons() );
     BUTTONACT( ui.dvdsimple, updateButtons() );
     BUTTONACT( ui.browseDiscButton, browseDevice() );
+    BUTTONACT( ui.ejectButton, eject() );
 
     CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
     CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
@@ -390,6 +391,11 @@ void DiscOpenPanel::browseDevice()
     updateMRL();
 }
 
+void DiscOpenPanel::eject()
+{
+    intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) );
+}
+
 void DiscOpenPanel::accept()
 {}
 
@@ -446,11 +452,15 @@ void NetOpenPanel::updateProtocol( int idx ) {
 void NetOpenPanel::updateMRL() {
     QString mrl = "";
     QString addr = ui.addressText->text();
+    addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
     int proto = ui.protocolCombo->currentIndex();
 
-    if( addr.contains( "://") && proto != 5 ) {
+    if( addr.contains( "://") && ( proto != 5 || proto != 6 ) )
+    {
         mrl = addr;
-    } else {
+    }
+    else
+    {
         switch( proto ) {
         case 0:
             mrl = "http://" + addr;
@@ -474,7 +484,8 @@ void NetOpenPanel::updateMRL() {
             break;
         case 5:
             mrl = "udp://@";
-            if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) {
+            if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() )
+            {
                 mrl += "[::]";
             }
             mrl += QString(":%1").arg( ui.portSpin->value() );
@@ -483,16 +494,18 @@ void NetOpenPanel::updateMRL() {
         case 6: /* UDP multicast */
             mrl = "udp://@";
             /* Add [] to IPv6 */
-            if ( addr.contains(':') && !addr.contains('[') ) {
+            if ( addr.contains(':') && !addr.contains('[') )
+            {
                 mrl += "[" + addr + "]";
-            } else mrl += addr;
+            }
+            else mrl += addr;
             mrl += QString(":%1").arg( ui.portSpin->value() );
             emit methodChanged("udp-caching");
         }
     }
 
     // Encode the boring stuffs
-    mrl = QUrl( mrl ).toEncoded();
+
     if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
         mrl += " :access-filter=timeshift";
     }
@@ -539,14 +552,14 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
     /* dshow Main */
     int line = 0;
-    module_config_t *p_config = 
+    module_config_t *p_config =
         config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" );
-    vdevDshowW = new StringListConfigControl( 
+    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( 
+    adevDshowW = new StringListConfigControl(
         VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
     line++;
 
@@ -630,6 +643,41 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     }
 
 #else /* WIN32 */
+    /*******
+     * V4L2*
+     *******/
+    if( module_Exists( p_intf, "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 ) );
+    }
+
     /*******
      * V4L *
      *******/
@@ -675,41 +723,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     CuMRL( v4lNormBox,  currentIndexChanged ( int ) );
     }
 
-    /*******
-     * V4L2*
-     *******/
-    if( module_Exists( p_intf, "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 *
      *******/
@@ -934,10 +947,10 @@ void CaptureOpenPanel::updateMRL()
         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(); 
+        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:
@@ -1068,12 +1081,17 @@ void CaptureOpenPanel::advancedDialog()
 
     /* 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++ )