Qt4: D&D behaviour fix.
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 21 Sep 2008 04:59:32 +0000 (21:59 -0700)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 21 Sep 2008 08:09:15 +0000 (01:09 -0700)
When dropping on the main controller => Play
When dropping on the playlist => Enqueue.

modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp

index 6731356..8089e81 100644 (file)
@@ -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)
 {
index 017bf22..017f586 100644 (file)
@@ -1067,6 +1067,11 @@ void MainInterface::updateSystrayTooltipStatus( int i_status )
  * D&D Events
  ************************************************************************/
 void MainInterface::dropEvent(QDropEvent *event)
+{
+    dropEventPlay( event, true );
+}
+
+void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
 {
      const QMimeData *mimeData = event->mimeData();
 
@@ -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;
         }
index ca65367..65c61a3 100644 (file)
@@ -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 * );