mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-02 04:10:20 +02:00
* Don't duplicate a query's results when dropping a result onto another playlist.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
* Copyright 2011, Michael Zanetti <mzanetti@kde.org>
|
* Copyright 2011, Michael Zanetti <mzanetti@kde.org>
|
||||||
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
||||||
* Copyright 2011-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2011-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
|
* Copyright 2011-2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -247,7 +248,7 @@ DropJob::tracksFromMimeData( const QMimeData* data, bool allowDuplicates, bool o
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DropJob::parseMimeData( const QMimeData *data )
|
DropJob::parseMimeData( const QMimeData* data )
|
||||||
{
|
{
|
||||||
QList< query_ptr > results;
|
QList< query_ptr > results;
|
||||||
|
|
||||||
@@ -349,7 +350,6 @@ DropJob::tracksFromResultList( const QMimeData* data )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
q->addResults( QList< result_ptr >() << *result );
|
|
||||||
queries << q;
|
queries << q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,19 +410,16 @@ DropJob::tracksFromArtistMetaData( const QMimeData *data )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList< query_ptr >
|
void
|
||||||
DropJob::tracksFromMixedData( const QMimeData *data )
|
DropJob::tracksFromMixedData( const QMimeData *data )
|
||||||
{
|
{
|
||||||
QList< query_ptr > queries;
|
|
||||||
QByteArray itemData = data->data( "application/tomahawk.mixed" );
|
QByteArray itemData = data->data( "application/tomahawk.mixed" );
|
||||||
QDataStream stream( &itemData, QIODevice::ReadOnly );
|
QDataStream stream( &itemData, QIODevice::ReadOnly );
|
||||||
|
|
||||||
QString mimeType;
|
QString mimeType;
|
||||||
|
|
||||||
while ( !stream.atEnd() )
|
while ( !stream.atEnd() )
|
||||||
{
|
{
|
||||||
stream >> mimeType;
|
stream >> mimeType;
|
||||||
qDebug() << "mimetype is" << mimeType;
|
|
||||||
|
|
||||||
QByteArray singleData;
|
QByteArray singleData;
|
||||||
QDataStream singleStream( &singleData, QIODevice::WriteOnly );
|
QDataStream singleStream( &singleData, QIODevice::WriteOnly );
|
||||||
@@ -442,21 +439,17 @@ DropJob::tracksFromMixedData( const QMimeData *data )
|
|||||||
QString album;
|
QString album;
|
||||||
stream >> album;
|
stream >> album;
|
||||||
singleStream << album;
|
singleStream << album;
|
||||||
qDebug() << "got artist" << artist << "and album" << album;
|
|
||||||
}
|
}
|
||||||
else if ( mimeType == "application/tomahawk.metadata.artist" )
|
else if ( mimeType == "application/tomahawk.metadata.artist" )
|
||||||
{
|
{
|
||||||
QString artist;
|
QString artist;
|
||||||
stream >> artist;
|
stream >> artist;
|
||||||
singleStream << artist;
|
singleStream << artist;
|
||||||
qDebug() << "got artist" << artist;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
singleMimeData.setData( mimeType, singleData );
|
singleMimeData.setData( mimeType, singleData );
|
||||||
parseMimeData( &singleMimeData );
|
parseMimeData( &singleMimeData );
|
||||||
}
|
}
|
||||||
|
|
||||||
return queries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -126,7 +126,7 @@ private:
|
|||||||
QList< Tomahawk::query_ptr > tracksFromResultList( const QMimeData* d );
|
QList< Tomahawk::query_ptr > tracksFromResultList( const QMimeData* d );
|
||||||
QList< Tomahawk::query_ptr > tracksFromArtistMetaData( const QMimeData* d );
|
QList< Tomahawk::query_ptr > tracksFromArtistMetaData( const QMimeData* d );
|
||||||
QList< Tomahawk::query_ptr > tracksFromAlbumMetaData( const QMimeData* d );
|
QList< Tomahawk::query_ptr > tracksFromAlbumMetaData( const QMimeData* d );
|
||||||
QList< Tomahawk::query_ptr > tracksFromMixedData( const QMimeData* d );
|
void tracksFromMixedData( const QMimeData* d );
|
||||||
|
|
||||||
QList< Tomahawk::query_ptr > getArtist( const QString& artist, Tomahawk::ModelMode mode = Tomahawk::Mixed );
|
QList< Tomahawk::query_ptr > getArtist( const QString& artist, Tomahawk::ModelMode mode = Tomahawk::Mixed );
|
||||||
QList< Tomahawk::query_ptr > getAlbum( const QString& artist, const QString& album );
|
QList< Tomahawk::query_ptr > getAlbum( const QString& artist, const QString& album );
|
||||||
|
Reference in New Issue
Block a user