]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/open.cpp
Qt4 - Codec Information direct access from menu.
[vlc] / modules / gui / qt4 / dialogs / open.cpp
index bf572dc10643455d4443e87415e18046003aa39c..0d519a790304d8e26fd83f339dba7f10be91cbb8 100644 (file)
@@ -42,12 +42,17 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal ) :
     setModal( modal );
     ui.setupUi( this );
     setWindowTitle( qtr("Open" ) );
-    fileOpenPanel = new FileOpenPanel(this , p_intf );
-    diskOpenPanel = new DiskOpenPanel(this , p_intf );
-    netOpenPanel = new NetOpenPanel(this , p_intf );
-    ui.Tab->addTab(fileOpenPanel, qtr("File"));
-    ui.Tab->addTab(diskOpenPanel, qtr("Disk"));
-    ui.Tab->addTab(netOpenPanel, qtr("Network"));
+    resize( 500, 300);
+
+    fileOpenPanel = new FileOpenPanel( this , p_intf );
+    diskOpenPanel = new DiskOpenPanel( this , p_intf );
+    netOpenPanel = new NetOpenPanel( this , p_intf );
+    captureOpenPanel = new CaptureOpenPanel( this, p_intf );
+
+    ui.Tab->addTab( fileOpenPanel, qtr( "&File" ) );
+    ui.Tab->addTab( diskOpenPanel, qtr( "&Disc" ) );
+    ui.Tab->addTab( netOpenPanel, qtr( "&Network" ) );
+    ui.Tab->addTab( captureOpenPanel, qtr( "Capture &Device" ) );
 
     ui.advancedFrame->hide();
 
@@ -57,6 +62,9 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal ) :
     CONNECT( fileOpenPanel, mrlUpdated( QString ), this, updateMRL(QString) );
     CONNECT( netOpenPanel, mrlUpdated( QString ), this, updateMRL(QString) );
     CONNECT( diskOpenPanel, mrlUpdated( QString ), this, updateMRL(QString) );
+    CONNECT( captureOpenPanel, mrlUpdated( QString ), this,
+            updateMRL(QString) );
+
 
     CONNECT( fileOpenPanel, methodChanged( QString ),
              this, newMethod(QString) );
@@ -68,8 +76,9 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal ) :
     CONNECT( ui.slaveText, textChanged(QString), this, updateMRL());
     CONNECT( ui.cacheSpinBox, valueChanged(int), this, updateMRL());
 
-    BUTTONACT( ui.closeButton, ok());
+    BUTTONACT( ui.closeButton, play());
     BUTTONACT( ui.cancelButton, cancel());
+    BUTTONACT( ui.enqueueButton, enqueue());
     BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
 
     /* Initialize caching */
@@ -85,7 +94,6 @@ OpenDialog::~OpenDialog()
 
 void OpenDialog::showTab(int i_tab=0)
 {
-    printf ( "%i" , i_tab);
     this->show();
     ui.Tab->setCurrentIndex(i_tab);
 }
@@ -104,7 +112,17 @@ void OpenDialog::cancel()
         reject();
 }
 
-void OpenDialog::ok()
+void OpenDialog::play()
+{
+    playOrEnqueue( false );
+}
+
+void OpenDialog::enqueue()
+{
+    playOrEnqueue( true );
+}
+
+void OpenDialog::playOrEnqueue( bool b_enqueue = false )
 {
     this->toggleVisible();
     mrl = ui.advancedLineInput->text();
@@ -117,12 +135,23 @@ void OpenDialog::ok()
              QString mrli = tempMRL[i].remove( QRegExp( "^\"" ) ).
                                        remove( QRegExp( "\"\\s+$" ) );
              const char * psz_utf8 = qtu( tempMRL[i] );
-             /* Play the first one, parse and enqueue the other ones */
-             playlist_Add( THEPL, psz_utf8, NULL,
-                           PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
-                           ( i ? PLAYLIST_PREPARSE : 0 ),
-                           PLAYLIST_END, VLC_TRUE );
-         }
+             if ( b_enqueue )
+             {
+                 /* Enqueue and Preparse all items*/
+                 playlist_Add( THEPL, psz_utf8, NULL,
+                                PLAYLIST_APPEND | PLAYLIST_PREPARSE,
+                                PLAYLIST_END, VLC_TRUE, VLC_FALSE );
+
+             }
+             else
+             {
+                 /* Play the first one, parse and enqueue the other ones */
+                 playlist_Add( THEPL, psz_utf8, NULL,
+                                PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
+                                ( i ? PLAYLIST_PREPARSE : 0 ),
+                                PLAYLIST_END, VLC_TRUE, VLC_FALSE );
+             }
+        }
 
     }
     else
@@ -131,6 +160,7 @@ void OpenDialog::ok()
 
 void OpenDialog::toggleAdvancedPanel()
 {
+    //FIXME does not work under Windows
     if (ui.advancedFrame->isVisible()) {
         ui.advancedFrame->hide();
         setMinimumHeight(1);
@@ -146,8 +176,6 @@ void OpenDialog::toggleAdvancedPanel()
         }
         resize( width(), mainHeight + advHeight );
     }
-
-    showTab( 2 );
 }
 
 void OpenDialog::updateMRL() {