mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 18:44:30 +02:00
Don't show drop indicator for playlists in sidebar and always create new ones
This commit is contained in:
@@ -481,6 +481,14 @@ void
|
|||||||
SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
|
SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
|
||||||
{
|
{
|
||||||
bool accept = false;
|
bool accept = false;
|
||||||
|
|
||||||
|
// Don't highlight the drop for a playlist, as it won't get added to the playlist but created generally
|
||||||
|
if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
|
||||||
|
{
|
||||||
|
event->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QTreeView::dragMoveEvent( event );
|
QTreeView::dragMoveEvent( event );
|
||||||
|
|
||||||
if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Track, DropJob::Append ) )
|
if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Track, DropJob::Append ) )
|
||||||
@@ -550,18 +558,9 @@ SourceTreeView::dropEvent( QDropEvent* event )
|
|||||||
qDebug() << Q_FUNC_INFO << "dropType is " << m_delegate->hoveredDropType();
|
qDebug() << Q_FUNC_INFO << "dropType is " << m_delegate->hoveredDropType();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to fake the dropevent because the treeview would reject it if it is outside the item (on the tree)
|
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
|
||||||
if ( pos.x() < 100 )
|
|
||||||
{
|
|
||||||
QDropEvent* newEvent = new QDropEvent( pos + QPoint( 100, 0 ), event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers(), event->type() );
|
|
||||||
QTreeView::dropEvent( newEvent );
|
|
||||||
delete newEvent;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
|
if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
|
||||||
{
|
{
|
||||||
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
|
|
||||||
qDebug() << Q_FUNC_INFO << "Current Event";
|
qDebug() << Q_FUNC_INFO << "Current Event";
|
||||||
DropJob *dropThis = new DropJob;
|
DropJob *dropThis = new DropJob;
|
||||||
dropThis->setDropTypes( DropJob::Playlist );
|
dropThis->setDropTypes( DropJob::Playlist );
|
||||||
@@ -572,6 +571,15 @@ SourceTreeView::dropEvent( QDropEvent* event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Need to fake the dropevent because the treeview would reject it if it is outside the item (on the tree)
|
||||||
|
if ( pos.x() < 100 )
|
||||||
|
{
|
||||||
|
QDropEvent* newEvent = new QDropEvent( pos + QPoint( 100, 0 ), event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers(), event->type() );
|
||||||
|
QTreeView::dropEvent( newEvent );
|
||||||
|
delete newEvent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QTreeView::dropEvent( event );
|
QTreeView::dropEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user