1
0
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:
Leo Franchi
2011-09-15 21:38:08 -04:00
parent bf009c8854
commit 5b48442006
4 changed files with 11 additions and 2 deletions

View File

@@ -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 );

View File

@@ -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
}; };

View File

@@ -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 );

View File

@@ -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 );