mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Create a new playlist from a spotify playlist if dropped anywhere on the sourcetree
Only generate the tracks directly if dragged into a playlist contents
This commit is contained in:
@@ -370,6 +370,9 @@ DropJob::handleXspf( const QString& fileUrl )
|
|||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO << "Got xspf playlist!!" << fileUrl;
|
tDebug() << Q_FUNC_INFO << "Got xspf playlist!!" << fileUrl;
|
||||||
|
|
||||||
|
if ( dropAction() == Default )
|
||||||
|
setDropAction( Create );
|
||||||
|
|
||||||
// Doing like so on *nix, dont know really how files are
|
// Doing like so on *nix, dont know really how files are
|
||||||
// passed on others.
|
// passed on others.
|
||||||
// TODO look in to!
|
// TODO look in to!
|
||||||
@@ -395,6 +398,9 @@ DropJob::handleSpPlaylist( const QString& url )
|
|||||||
playlistUri = "spotify:" + playlistUri;
|
playlistUri = "spotify:" + playlistUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( dropAction() == Default )
|
||||||
|
setDropAction( Create );
|
||||||
|
|
||||||
tDebug() << "Got a spotify playlist uri in dropjob!" << playlistUri;
|
tDebug() << "Got a spotify playlist uri in dropjob!" << playlistUri;
|
||||||
SpotifyParser* spot = new SpotifyParser( playlistUri, dropAction() == Create, this );
|
SpotifyParser* spot = new SpotifyParser( playlistUri, dropAction() == Create, this );
|
||||||
|
|
||||||
|
@@ -56,7 +56,8 @@ public:
|
|||||||
Q_DECLARE_FLAGS(DropTypes, DropType)
|
Q_DECLARE_FLAGS(DropTypes, DropType)
|
||||||
|
|
||||||
enum DropAction {
|
enum DropAction {
|
||||||
Append = 0,
|
Default = 0,
|
||||||
|
Append,
|
||||||
Create
|
Create
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -366,6 +366,8 @@ PlaylistModel::dropMimeData( const QMimeData* data, Qt::DropAction action, int r
|
|||||||
m_dropStorage.parent = QPersistentModelIndex( parent );
|
m_dropStorage.parent = QPersistentModelIndex( parent );
|
||||||
m_dropStorage.action = action;
|
m_dropStorage.action = action;
|
||||||
DropJob *dj = new DropJob();
|
DropJob *dj = new DropJob();
|
||||||
|
dj->setDropAction( DropJob::Append );
|
||||||
|
|
||||||
connect( dj, SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ), this, SLOT( parsedDroppedTracks( QList< Tomahawk::query_ptr > ) ) );
|
connect( dj, SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ), this, SLOT( parsedDroppedTracks( QList< Tomahawk::query_ptr > ) ) );
|
||||||
dj->tracksFromMimeData( data );
|
dj->tracksFromMimeData( data );
|
||||||
|
|
||||||
|
@@ -529,7 +529,7 @@ SourceTreeView::dropEvent( QDropEvent* event )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// In current event, parse sourceTreeView mime instead of playlistitems
|
// 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 );
|
||||||
|
Reference in New Issue
Block a user