1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +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(); tDebug() << "Dropped result item:" << result->data()->artist()->name() << "-" << result->data()->track();
query_ptr q = result->data()->toQuery(); query_ptr q = result->data()->toQuery();
if ( m_getWholeArtists ) if ( m_top10 )
{ {
queries << getArtist( q->artist() ); getTopTen( q->artist() );
}
else if ( m_getWholeAlbums )
{
queries << getAlbum( q->artist(), q->album() );
} }
else else
{ {
q->addResults( QList< result_ptr >() << *result ); if ( m_getWholeArtists )
queries << q; {
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; QString album;
stream >> album; stream >> album;
if ( m_getWholeArtists ) if ( m_top10 )
queries << getArtist( artist ); {
getTopTen( artist );
}
else else
queries << getAlbum( artist, album ); {
if ( m_getWholeArtists )
queries << getArtist( artist );
else
queries << getAlbum( artist, album );
}
} }
return queries; return queries;
} }
@@ -266,23 +280,7 @@ DropJob::tracksFromArtistMetaData( const QMimeData *data )
} }
else else
{ {
connect( Tomahawk::InfoSystem::InfoSystem::instance(), getTopTen( artist );
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++;
} }
} }
return queries; return queries;
@@ -493,3 +491,26 @@ DropJob::getAlbum(const QString &artist, const QString &album)
else else
return albumPtr->tracks(); 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 > getArtist( const QString& artist );
QList< Tomahawk::query_ptr > getAlbum( const QString& artist, const QString& album ); QList< Tomahawk::query_ptr > getAlbum( const QString& artist, const QString& album );
void getTopTen( const QString& artist );
void removeDuplicates(); void removeDuplicates();
void removeRemoteSources(); void removeRemoteSources();