From 3deab0a1d0214a403c26548170837846fcde9085 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Kempf <jb@videolan.org>
Date: Wed, 5 Dec 2007 17:08:45 +0000
Subject: [PATCH] =?UTF-8?q?Qt4=20-=20When=20adding=20a=20file=20to=20the?=
 =?UTF-8?q?=20playlist=20by=20clicking=20on=20"Read"=20in=20the=20OpenFile?=
 =?UTF-8?q?=20dialog,=20the=20first=20time=20it's=20ok=20but=20the=20next?=
 =?UTF-8?q?=20click=20you=20add=202=20times=20and=20then=20more=20times=20?=
 =?UTF-8?q?the=20same=20file.=20Patch=20from=20R=C3=A9mi=20Duraffort.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 modules/gui/qt4/dialogs/open.cpp | 49 +++++++++++++++++++++-----------
 modules/gui/qt4/dialogs/open.hpp |  1 +
 2 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp
index 8c3b105008dd..d511c00e1458 100644
--- a/modules/gui/qt4/dialogs/open.cpp
+++ b/modules/gui/qt4/dialogs/open.cpp
@@ -126,7 +126,7 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
     BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
 
     /* Buttons action */
-    BUTTONACT( playButton, play());
+    BUTTONACT( playButton, selectSlots());
     BUTTONACT( cancelButton, cancel());
 
     /* At creation time, modify the default buttons */
@@ -148,22 +148,18 @@ void OpenDialog::setMenuAction()
 {
     switch ( i_action_flag )
     {
-        case OPEN_AND_STREAM:
-            playButton->setText( qtr("&Stream") );
-            BUTTONACT( playButton, stream() );
-            break;
-        case OPEN_AND_SAVE:
-            playButton->setText( qtr("&Convert / Save") );
-            BUTTONACT( playButton, transcode() );
-            break;
-        case OPEN_AND_ENQUEUE:
-            playButton->setText( qtr("&Enqueue") );
-            BUTTONACT( playButton, enqueue() );
-            break;
-        case OPEN_AND_PLAY:
-        default:
-            playButton->setText( qtr("&Play") );
-            BUTTONACT( playButton, play() );
+    case OPEN_AND_STREAM:
+        playButton->setText( qtr("&Stream") );
+        break;
+    case OPEN_AND_SAVE:
+        playButton->setText( qtr("&Convert / Save") );
+        break;
+    case OPEN_AND_ENQUEUE:
+        playButton->setText( qtr("&Enqueue") );
+        break;
+    case OPEN_AND_PLAY:
+    default:
+        playButton->setText( qtr("&Play") );
    }
 }
 
@@ -231,6 +227,25 @@ void OpenDialog::close()
 }
 
 /* Play button */
+void OpenDialog::selectSlots()
+{
+    switch ( i_action_flag )
+    {
+    case OPEN_AND_STREAM:
+        stream();
+        break;
+    case OPEN_AND_SAVE:
+        transcode();
+        break;
+    case OPEN_AND_ENQUEUE:
+        enqueue();
+        break;
+    case OPEN_AND_PLAY:
+    default:
+        play();
+    }
+}
+
 void OpenDialog::play()
 {
     finish( false );
diff --git a/modules/gui/qt4/dialogs/open.hpp b/modules/gui/qt4/dialogs/open.hpp
index 782a60d3fa5a..39aabb23f287 100644
--- a/modules/gui/qt4/dialogs/open.hpp
+++ b/modules/gui/qt4/dialogs/open.hpp
@@ -61,6 +61,7 @@ public:
     QString mainMRL;
 
 public slots:
+    void selectSlots();
     void play();
     void stream( bool b_transode_only = false );
     void enqueue();
-- 
GitLab