]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.cpp
Qt4: merge unicast and multicast UDP, add RTP - fixes #1706
[vlc] / modules / gui / qt4 / components / open_panels.cpp
index 5f8ec12b17168c3dea2a8ce1f42a3f27ebbe81e9..100e52950fcad58ac7083b629bc2d09b331e4ec5 100644 (file)
@@ -299,6 +299,7 @@ void DiscOpenPanel::updateButtons()
         ui.chapterLabel->show();
         ui.chapterSpin->show();
         ui.diskOptionBox_2->show();
+        ui.dvdsimple->setEnabled( true );
     }
     else if ( ui.vcdRadioButton->isChecked() )
     {
@@ -311,6 +312,7 @@ void DiscOpenPanel::updateButtons()
         ui.chapterLabel->hide();
         ui.chapterSpin->hide();
         ui.diskOptionBox_2->show();
+        ui.dvdsimple->setEnabled( false );
     }
     else /* CDDA */
     {
@@ -323,6 +325,7 @@ void DiscOpenPanel::updateButtons()
         ui.chapterLabel->hide();
         ui.chapterSpin->hide();
         ui.diskOptionBox_2->hide();
+        ui.dvdsimple->setEnabled( false );
     }
 
     updateMRL();
@@ -415,17 +418,18 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     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()
@@ -439,19 +443,16 @@ void NetOpenPanel::updateProtocol( int idx_proto ) {
     QString addr = ui.addressText->text();
     QString proto = ui.protocolCombo->itemData( idx_proto ).toString();
 
-    ui.timeShift->setEnabled( idx_proto == UDP_PROTO ||
-                              idx_proto == UDPM_PROTO );
-    ui.ipv6->setEnabled( idx_proto == UDP_PROTO );
-    ui.addressText->setEnabled( idx_proto != UDP_PROTO );
+    ui.timeShift->setEnabled( idx_proto == UDP_PROTO );
     ui.portSpin->setEnabled( idx_proto == UDP_PROTO ||
-                             idx_proto == UDPM_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( "://"))
     {
-        if( idx_proto != UDPM_PROTO )
+        if( idx_proto != UDP_PROTO && idx_proto != RTP_PROTO )
             addr.replace( QRegExp("^.*://@*"), proto + "://");
         else
              addr.replace( QRegExp("^.*://"), proto + "://@");
@@ -472,7 +473,7 @@ void NetOpenPanel::updateMRL() {
         ui.protocolCombo->setCurrentIndex(
                 ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );
 
-        if( idx_proto != UDP_PROTO || idx_proto != UDPM_PROTO )
+        if( idx_proto != UDP_PROTO || idx_proto != RTP_PROTO )
             mrl = addr;
     }
     else
@@ -499,15 +500,6 @@ void NetOpenPanel::updateMRL() {
             emit methodChanged("rtsp-caching");
             break;
         case UDP_PROTO:
-            mrl = "udp://@";
-            if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() )
-            {
-                mrl += "[::]";
-            }
-            mrl += QString(":%1").arg( ui.portSpin->value() );
-            emit methodChanged("udp-caching");
-            break;
-        case UDPM_PROTO: /* UDP multicast */
             mrl = "udp://@";
             /* Add [] to IPv6 */
             if ( addr.contains(':') && !addr.contains('[') )
@@ -517,11 +509,20 @@ void NetOpenPanel::updateMRL() {
             else mrl += addr;
             mrl += QString(":%1").arg( ui.portSpin->value() );
             emit methodChanged("udp-caching");
+            break;
+        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("rtp-caching");
+            break;
         case RTMP_PROTO:
             mrl = "rtmp://" + addr;
             emit methodChanged("rtmp-caching");
             break;
-
         }
     }
 
@@ -926,10 +927,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() );
 
@@ -1097,7 +1098,7 @@ void CaptureOpenPanel::advancedDialog()
 
     /* 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 );
@@ -1124,7 +1125,7 @@ void CaptureOpenPanel::advancedDialog()
 
     /* 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() );
@@ -1133,7 +1134,7 @@ 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() )