1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 13:17:34 +02:00

* Coding-style fixes for DropJob.

This commit is contained in:
Christian Muehlhaeuser
2011-11-24 13:57:25 +01:00
parent 5929adfa57
commit f38f6b2eed

View File

@@ -239,6 +239,7 @@ void
DropJob::parseMimeData( const QMimeData *data ) DropJob::parseMimeData( const QMimeData *data )
{ {
QList< query_ptr > results; QList< query_ptr > results;
if ( data->hasFormat( "application/tomahawk.query.list" ) ) if ( data->hasFormat( "application/tomahawk.query.list" ) )
results = tracksFromQueryList( data ); results = tracksFromQueryList( data );
else if ( data->hasFormat( "application/tomahawk.result.list" ) ) else if ( data->hasFormat( "application/tomahawk.result.list" ) )
@@ -254,7 +255,8 @@ DropJob::parseMimeData( const QMimeData *data )
const QString plainData = QString::fromUtf8( data->data( "text/plain" ) ); const QString plainData = QString::fromUtf8( data->data( "text/plain" ) );
handleAllUrls( plainData ); handleAllUrls( plainData );
}else if ( data->hasFormat( "text/uri-list" ) ) }
else if ( data->hasFormat( "text/uri-list" ) )
{ {
const QString plainData = QString::fromUtf8( data->data( "text/uri-list" ).trimmed() ); const QString plainData = QString::fromUtf8( data->data( "text/uri-list" ).trimmed() );
handleAllUrls( plainData ); handleAllUrls( plainData );
@@ -367,6 +369,7 @@ DropJob::tracksFromAlbumMetaData( const QMimeData *data )
else else
queries << getAlbum( artist, album ); queries << getAlbum( artist, album );
} }
return queries; return queries;
} }
@@ -441,19 +444,20 @@ DropJob::tracksFromMixedData( const QMimeData *data )
singleMimeData.setData( mimeType, singleData ); singleMimeData.setData( mimeType, singleData );
parseMimeData( &singleMimeData ); parseMimeData( &singleMimeData );
} }
return queries; return queries;
} }
void void
DropJob::handleM3u( const QString& fileUrls ) DropJob::handleM3u( const QString& fileUrls )
{ {
tDebug() << Q_FUNC_INFO << "Got M3u playlist!!" << fileUrls; tDebug() << Q_FUNC_INFO << "Got M3U playlist!" << fileUrls;
QStringList urls = fileUrls.split( QRegExp( "\n" ), QString::SkipEmptyParts ); QStringList urls = fileUrls.split( QRegExp( "\n" ), QString::SkipEmptyParts );
if ( dropAction() == Default ) if ( dropAction() == Default )
setDropAction( Create ); setDropAction( Create );
tDebug() << "Got a M3U playlist url to parse!" << urls; tDebug() << "Got a M3U playlist url to parse!" << urls;
M3uLoader* m = new M3uLoader( urls, dropAction() == Create, this ); M3uLoader* m = new M3uLoader( urls, dropAction() == Create, this );
@@ -463,11 +467,11 @@ DropJob::handleM3u( const QString& fileUrls )
connect( m, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ) ); connect( m, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ) );
} }
m_queryCount++; m_queryCount++;
} }
void void
DropJob::handleXspfs( const QString& fileUrls ) DropJob::handleXspfs( const QString& fileUrls )
{ {
@@ -507,6 +511,7 @@ DropJob::handleXspfs( const QString& fileUrls )
connect( l, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ) ); connect( l, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ) );
} }
m_queryCount++; m_queryCount++;
} }
} }
@@ -516,7 +521,7 @@ void
DropJob::handleSpotifyUrls( const QString& urlsRaw ) DropJob::handleSpotifyUrls( const QString& urlsRaw )
{ {
QStringList urls = urlsRaw.split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); QStringList urls = urlsRaw.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
qDebug() << "Got spotify browse uris!!" << urls; qDebug() << "Got spotify browse uris!" << urls;
/// Lets allow parsing all spotify uris here, if parse server is not available /// Lets allow parsing all spotify uris here, if parse server is not available
/// fallback to spotify metadata for tracks /hugo /// fallback to spotify metadata for tracks /hugo
@@ -542,7 +547,7 @@ void
DropJob::handleRdioUrls( const QString& urlsRaw ) DropJob::handleRdioUrls( const QString& urlsRaw )
{ {
QStringList urls = urlsRaw.split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); QStringList urls = urlsRaw.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
qDebug() << "Got Rdio urls!!" << urls; qDebug() << "Got Rdio urls!" << urls;
if ( dropAction() == Default ) if ( dropAction() == Default )
setDropAction( Create ); setDropAction( Create );
@@ -668,6 +673,7 @@ DropJob::removeDuplicates()
if ( !contains ) if ( !contains )
list.append( item ); list.append( item );
} }
m_resultList = list; m_resultList = list;
} }