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

git version control git at videolan.org
Sun Sep 21 10:06:09 CEST 2008


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

Qt4: D&D behaviour fix.

When dropping on the main controller => Play
When dropping on the playlist => Enqueue.

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

 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 6731356..8089e81 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 017bf22..017f586 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -1068,6 +1068,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 */
@@ -1085,14 +1090,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