]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Qt: Menus: Don't repeat context for playlist view modes
[vlc] / modules / gui / qt4 / main_interface.cpp
index f479e4ecaaaa799f57dbde8eb542cbc93d5d78ac..2f2ca1a28ef7de2fca10be73a27d4f454f80c6a9 100644 (file)
@@ -59,6 +59,7 @@
 #include <QStatusBar>
 #include <QLabel>
 #include <QStackedWidget>
+#include <QFileInfo>
 
 #include <vlc_keys.h>                       /* Wheel event */
 #include <vlc_vout_display.h>               /* vout_thread_t and VOUT_ events */
@@ -171,7 +172,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 #ifdef WIN32
     himl = NULL;
     p_taskbl = NULL;
-    taskbar_wmsg = RegisterWindowMessage("TaskbarButtonCreated");
+    taskbar_wmsg = RegisterWindowMessage(TEXT("TaskbarButtonCreated"));
 #endif
 
     /*********************************
@@ -1263,7 +1264,7 @@ void MainInterface::dropEvent(QDropEvent *event)
  */
 void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playlist )
 {
-    if( event->possibleActions() & ( Qt::CopyAction | Qt::MoveAction ) )
+    if( event->possibleActions() & ( Qt::CopyAction | Qt::MoveAction | Qt::LinkAction ) )
        event->setDropAction( Qt::CopyAction );
     else
         return;
@@ -1288,11 +1289,29 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playli
         if( url.isValid() )
         {
             QString mrl = toURI( url.toEncoded().constData() );
-            playlist_Add( THEPL, qtu(mrl), NULL,
+            QFileInfo info( url.toLocalFile() );
+            if( info.exists() && info.isSymLink() )
+            {
+                QString target = info.symLinkTarget();
+                QUrl url;
+                if( QFile::exists( target ) )
+                {
+                    url = QUrl::fromLocalFile( target );
+                }
+                else
+                {
+                    url.setUrl( target );
+                }
+                mrl = toURI( url.toEncoded().constData() );
+            }
+            if( mrl.length() > 0 )
+            {
+                playlist_Add( THEPL, qtu(mrl), NULL,
                           PLAYLIST_APPEND | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE),
                           PLAYLIST_END, b_playlist, pl_Unlocked );
-            first = false;
-            RecentsMRL::getInstance( p_intf )->addRecent( mrl );
+                first = false;
+                RecentsMRL::getInstance( p_intf )->addRecent( mrl );
+            }
         }
     }