[vlc-devel] commit: Qt4: D&D behaviour fix. (Jean-Baptiste Kempf )

git version control git at videolan.org
Sun Sep 21 10:07:42 CEST 2008


vlc | branch: 0.9-bugfix | Jean-Baptiste Kempf <jb at videolan.org> | Sat Sep 20 21:59:32 2008 -0700| [b29b624152ecf42f6945a5dd604fe52db5a43821] | committer: Jean-Baptiste Kempf 

Qt4: D&D behaviour fix.

When dropping on the main controller => Play
When dropping on the playlist => Enqueue.
(cherry picked from commit e04cc4a812a0edacb4f014d410a3f47b2c6453b0)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b29b624152ecf42f6945a5dd604fe52db5a43821
---

 modules/gui/qt4/components/playlist/playlist.cpp |    2 +-
 modules/gui/qt4/main_interface.cpp               |    9 +++++++--
 modules/gui/qt4/main_interface.hpp               |    1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index a16d39e..e6217de 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -135,7 +135,7 @@ PlaylistWidget::~PlaylistWidget()
 void PlaylistWidget::dropEvent(QDropEvent *event)
 {
     if( p_intf->p_sys->p_mi )
-        p_intf->p_sys->p_mi->dropEvent( event );
+        p_intf->p_sys->p_mi->dropEventPlay( event, false );
 }
 void PlaylistWidget::dragEnterEvent(QDragEnterEvent *event)
 {
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index e013d65..94df454 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -1077,6 +1077,11 @@ void MainInterface::updateSystrayTooltipStatus( int i_status )
  ************************************************************************/
 void MainInterface::dropEvent(QDropEvent *event)
 {
+    dropEventPlay( event, true );
+}
+
+void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
+{
      const QMimeData *mimeData = event->mimeData();
 
      /* D&D of a subtitles file, add it on the fly */
@@ -1094,14 +1099,14 @@ void MainInterface::dropEvent(QDropEvent *event)
             }
         }
      }
-     bool first = true;
+     bool first = b_play;
      foreach( QUrl url, mimeData->urls() )
      {
         QString s = toNativeSeparators( url.toLocalFile() );
 
         if( s.length() > 0 ) {
             playlist_Add( THEPL, qtu(s), NULL,
-                          PLAYLIST_APPEND | (first ? PLAYLIST_GO:0),
+                          PLAYLIST_APPEND | (first ? PLAYLIST_GO: 0),
                           PLAYLIST_END, true, false );
             first = false;
         }
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index ca65367..65c61a3 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -93,6 +93,7 @@ public:
 protected:
 //    void resizeEvent( QResizeEvent * );
     void dropEvent( QDropEvent *);
+    void dropEventPlay( QDropEvent *, bool);
     void dragEnterEvent( QDragEnterEvent * );
     void dragMoveEvent( QDragMoveEvent * );
     void dragLeaveEvent( QDragLeaveEvent * );




More information about the vlc-devel mailing list