[vlc-commits] DnD from Internet Explorer to VLC and support of links (*.lnk)
Mario Speiß
git at videolan.org
Mon Feb 11 01:35:05 CET 2013
vlc | branch: master | Mario Speiß <1034-135 at online.de> | Sun Feb 10 22:31:59 2013 +0100| [934eee8ce74843e35fe73e36e956c9c1dc2ec948] | committer: Jean-Baptiste Kempf
DnD from Internet Explorer to VLC and support of links (*.lnk)
On Windows a Drag and Drop seems to be a Qt::LinkAction. And support for
symbolic links is added.
Playlist widget now uses the p_mi->dropEvent (used to have two implementation,
one calling p_mi->dropEvent already, the other had its own body. That body is
removed)
Regards,
Mario
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=934eee8ce74843e35fe73e36e956c9c1dc2ec948
---
modules/gui/qt4/dialogs/playlist.cpp | 10 +---------
modules/gui/qt4/main_interface.cpp | 27 +++++++++++++++++++++++----
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/modules/gui/qt4/dialogs/playlist.cpp b/modules/gui/qt4/dialogs/playlist.cpp
index 2f2b724..0da5c98 100644
--- a/modules/gui/qt4/dialogs/playlist.cpp
+++ b/modules/gui/qt4/dialogs/playlist.cpp
@@ -82,15 +82,7 @@ PlaylistDialog::~PlaylistDialog()
void PlaylistDialog::dropEvent( QDropEvent *event )
{
- const QMimeData *mimeData = event->mimeData();
- foreach( const QUrl &url, mimeData->urls() ) {
- QString s = toNativeSeparators( url.toString() );
- if( s.length() > 0 ) {
- playlist_Add( THEPL, qtu(s), NULL,
- PLAYLIST_APPEND, PLAYLIST_END, true, false );
- }
- }
- event->acceptProposedAction();
+ playlistWidget->dropEvent(event);
}
void PlaylistDialog::dragEnterEvent( QDragEnterEvent *event )
{
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index db52d71..82008cb 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -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 */
@@ -1268,7 +1269,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;
@@ -1293,11 +1294,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 );
+ }
}
}
More information about the vlc-commits
mailing list