]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open_panels.cpp
Remember the QFileDialog states.
[vlc] / modules / gui / qt4 / components / open_panels.cpp
index 547b926f6e3a943b7db39518bcd411b1225d6ccf..88294c5d7e7f6df7f37e7fda5aa14bd7d1fe2ea6 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,6 +75,11 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
     dialogBox->setFileMode( QFileDialog::ExistingFiles );
     dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
+#if HAS_QT43
+    QSettings settings( "vlc", "vlc-qt-interface" );
+    dialogBox->restoreState(
+            settings.value( "file-dialog-state" ).toByteArray() );
+#endif
     dialogBox->setViewMode( config_GetInt( p_intf, "qt-open-detail" ) ?
             QFileDialog::Detail : QFileDialog::List );
 
@@ -138,6 +144,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 +193,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 */
@@ -299,6 +309,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 +322,7 @@ void DiscOpenPanel::updateButtons()
         ui.chapterLabel->hide();
         ui.chapterSpin->hide();
         ui.diskOptionBox_2->show();
+        ui.dvdsimple->setEnabled( false );
     }
     else /* CDDA */
     {
@@ -323,6 +335,7 @@ void DiscOpenPanel::updateButtons()
         ui.chapterLabel->hide();
         ui.chapterSpin->hide();
         ui.diskOptionBox_2->hide();
+        ui.dvdsimple->setEnabled( false );
     }
 
     updateMRL();
@@ -415,17 +428,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 +453,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 +483,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 +510,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 +519,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;
-
         }
     }
 
@@ -1097,7 +1108,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 +1135,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() );