1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-19 23:41:51 +02:00

fix dropping of top 10 for albums and tracks

This commit is contained in:
Michael Zanetti 2011-08-27 17:24:12 +02:00
parent eaca242277
commit 16e77cb144
2 changed files with 51 additions and 28 deletions

View File

@ -207,18 +207,25 @@ DropJob::tracksFromResultList( const QMimeData* data )
tDebug() << "Dropped result item:" << result->data()->artist()->name() << "-" << result->data()->track();
query_ptr q = result->data()->toQuery();
if ( m_getWholeArtists )
if ( m_top10 )
{
queries << getArtist( q->artist() );
}
else if ( m_getWholeAlbums )
{
queries << getAlbum( q->artist(), q->album() );
getTopTen( q->artist() );
}
else
{
q->addResults( QList< result_ptr >() << *result );
queries << q;
if ( m_getWholeArtists )
{
queries << getArtist( q->artist() );
}
else if ( m_getWholeAlbums )
{
queries << getAlbum( q->artist(), q->album() );
}
else
{
q->addResults( QList< result_ptr >() << *result );
queries << q;
}
}
}
}
@ -240,10 +247,17 @@ DropJob::tracksFromAlbumMetaData( const QMimeData *data )
QString album;
stream >> album;
if ( m_getWholeArtists )
queries << getArtist( artist );
if ( m_top10 )
{
getTopTen( artist );
}
else
queries << getAlbum( artist, album );
{
if ( m_getWholeArtists )
queries << getArtist( artist );
else
queries << getAlbum( artist, album );
}
}
return queries;
}
@ -266,23 +280,7 @@ DropJob::tracksFromArtistMetaData( const QMimeData *data )
}
else
{
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
Tomahawk::InfoSystem::InfoCriteriaHash artistInfo;
artistInfo["artist"] = artist;
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = "changeme";
requestData.customData = QVariantMap();
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo );
requestData.type = Tomahawk::InfoSystem::InfoArtistSongs;
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
m_queryCount++;
getTopTen( artist );
}
}
return queries;
@ -493,3 +491,26 @@ DropJob::getAlbum(const QString &artist, const QString &album)
else
return albumPtr->tracks();
}
void
DropJob::getTopTen( const QString &artist )
{
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
Tomahawk::InfoSystem::InfoCriteriaHash artistInfo;
artistInfo["artist"] = artist;
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = "changeme";
requestData.customData = QVariantMap();
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo );
requestData.type = Tomahawk::InfoSystem::InfoArtistSongs;
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
m_queryCount++;
}

View File

@ -75,6 +75,8 @@ private:
QList< Tomahawk::query_ptr > getArtist( const QString& artist );
QList< Tomahawk::query_ptr > getAlbum( const QString& artist, const QString& album );
void getTopTen( const QString& artist );
void removeDuplicates();
void removeRemoteSources();