Qt4 - Open Dialog. Add an enqueue button.
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 13 Mar 2007 21:44:05 +0000 (21:44 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 13 Mar 2007 21:44:05 +0000 (21:44 +0000)
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/dialogs/open.hpp
modules/gui/qt4/ui/open.ui

index 4f5bfb4..d0f3209 100644 (file)
@@ -74,8 +74,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, playOrEnqueue());
     BUTTONACT( ui.cancelButton, cancel());
+    BUTTONACT( ui.enqueueButton, playOrEnqueue( true ));
     BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
 
     /* Initialize caching */
@@ -110,7 +111,7 @@ void OpenDialog::cancel()
         reject();
 }
 
-void OpenDialog::ok()
+void OpenDialog::playOrEnqueue(bool b_enqueue = false )
 {
     this->toggleVisible();
     mrl = ui.advancedLineInput->text();
@@ -123,11 +124,22 @@ 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, VLC_FALSE );
+             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 );
+             }
         }
 
     }
index d9909d9..8198cb3 100644 (file)
@@ -66,7 +66,7 @@ private:
     int advHeight, mainHeight;
 private slots:
     void cancel();
-    void ok();
+    void playOrEnqueue(bool);
     void toggleAdvancedPanel();
     void updateMRL(QString);
     void updateMRL();
index 03439a1..6dd5bb6 100644 (file)
@@ -9,7 +9,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>525</width>
+    <width>440</width>
     <height>231</height>
    </rect>
   </property>
        </property>
       </widget>
      </item>
+     <item>
+      <widget class="QPushButton" name="enqueueButton" >
+       <property name="text" >
+        <string>Enqueue</string>
+       </property>
+      </widget>
+     </item>
      <item>
       <widget class="QPushButton" name="closeButton" >
        <property name="text" >
-        <string>Open</string>
+        <string>Play</string>
        </property>
       </widget>
      </item>