]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.cpp
Remove unneeded option now. Screw Qt < 4.3
[vlc] / modules / gui / qt4 / components / open_panels.cpp
index 38635eb83d112b21481787bc3a7293e219140319..14ec54cddce5757569ad4732ffe65e8d80c76f39 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
  *
@@ -44,6 +44,7 @@
 #include <QDirModel>
 #include <QScrollArea>
 #include <QUrl>
+#include <QSettings>
 
 /**************************************************************************
  * Open Files and subtitles                                               *
@@ -74,8 +75,11 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
     dialogBox->setFileMode( QFileDialog::ExistingFiles );
     dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
-    dialogBox->setViewMode( config_GetInt( p_intf, "qt-open-detail" ) ?
-            QFileDialog::Detail : QFileDialog::List );
+#if HAS_QT43
+    QSettings settings( "vlc", "vlc-qt-interface" );
+    dialogBox->restoreState(
+            settings.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 );
@@ -138,6 +142,10 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
 FileOpenPanel::~FileOpenPanel()
 {
+#if HAS_QT43
+    QSettings settings( "vlc", "vlc-qt-interface" );
+    settings.setValue( "file-dialog-state", dialogBox->saveState() );
+#endif
 }
 
 /* Show a fileBrowser to select a subtitle */
@@ -183,7 +191,7 @@ void FileOpenPanel::accept()
 
 void FileOpenBox::accept()
 {
-    OpenDialog::getInstance( NULL, NULL )->play();
+    OpenDialog::getInstance( NULL, NULL, true )->selectSlots();
 }
 
 /* Function called by Open Dialog when clicked on cancel */
@@ -418,7 +426,6 @@ 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"));
@@ -426,8 +433,8 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     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() );
@@ -444,19 +451,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 + "://@");
@@ -477,7 +481,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
@@ -504,15 +508,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('[') )
@@ -523,6 +518,15 @@ void NetOpenPanel::updateMRL() {
             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");
@@ -1129,7 +1133,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() );