mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 05:07:27 +02:00
Merge pull request #40 from hugolm84/master
Allow dropping sources in to trackview/sourcetree and do appropriate action
This commit is contained in:
@@ -368,6 +368,12 @@ PlaylistModel::dropMimeData( const QMimeData* data, Qt::DropAction action, int r
|
|||||||
|
|
||||||
DropJob* dj = new DropJob();
|
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
|
// 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
|
// so check if the drag originated in this playlist to determine whether or not to copy
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
|
@@ -417,7 +417,7 @@ SourceTreeView::dragEnterEvent( QDragEnterEvent* event )
|
|||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
QTreeView::dragEnterEvent( event );
|
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_dragging = true;
|
||||||
m_dropRect = QRect();
|
m_dropRect = QRect();
|
||||||
@@ -491,7 +491,7 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
|
|||||||
event->ignore();
|
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->setDropAction( Qt::CopyAction );
|
||||||
event->accept();
|
event->accept();
|
||||||
|
Reference in New Issue
Block a user