1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Support dropping sources in pl and sourcetree. Append or create

This commit is contained in:
Hugo Lindström 2011-10-03 10:14:18 +02:00
parent 1d54be04e0
commit 5812b2bec1
3 changed files with 20 additions and 6 deletions

View File

@ -368,6 +368,12 @@ PlaylistModel::dropMimeData( const QMimeData* data, Qt::DropAction action, int r
DropJob* dj = new DropJob();
if ( !DropJob::acceptsMimeData( data, DropJob::Track | DropJob::Album | DropJob::Artist ) )
return false;
dj->setDropTypes( DropJob::Track | DropJob::Artist | DropJob::Album );
dj->setDropAction( DropJob::Append );
// On mac, drags from outside the app are still Qt::MoveActions instead of Qt::CopyAction by default
// so check if the drag originated in this playlist to determine whether or not to copy
#ifdef Q_WS_MAC

View File

@ -69,16 +69,24 @@ SpotifyParser::lookupUrl( const QString& link )
{
if( link.contains( "track" ) )
{
qDebug() << "Loooking up track" << link;
m_trackMode = true;
lookupTrack( link );
}
else if( link.contains( "playlist" ) || link.contains( "album" ) || link.contains( "artist" ) )
{
if( !m_createNewPlaylist )
m_trackMode = true;
else
m_trackMode = false;
qDebug() << "Loooking up browse" << link;
if( !m_createNewPlaylist ){
qDebug() << "Do not create new pl!";
m_trackMode = true;
}else{
qDebug() << "create new pl!";
m_trackMode = false;
}
lookupSpotifyBrowse( link );
}
else

View File

@ -417,7 +417,7 @@ SourceTreeView::dragEnterEvent( QDragEnterEvent* event )
qDebug() << Q_FUNC_INFO;
QTreeView::dragEnterEvent( event );
if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Track | DropJob::Playlist, DropJob::Create ) )
if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Track | DropJob::Artist | DropJob::Album | DropJob::Playlist, DropJob::Create ) )
{
m_dragging = true;
m_dropRect = QRect();
@ -491,7 +491,7 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
event->ignore();
}
}
else if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Playlist, DropJob::Create ) )
else if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Playlist | DropJob::Artist | DropJob::Album, DropJob::Create ) )
{
event->setDropAction( Qt::CopyAction );
event->accept();