1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 09:19:41 +01:00

Remove InfoGenericMap

This commit is contained in:
Jeff Mitchell 2011-10-11 09:08:55 -04:00
parent 37f5b9114e
commit a520f7bff3
4 changed files with 25 additions and 27 deletions

View File

@ -182,21 +182,22 @@ EchoNestPlugin::getArtistBiographySlot()
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
Echonest::Artist artist = artistFromReply( reply );
BiographyList biographies = artist.biographies();
InfoGenericMap biographyMap;
Q_FOREACH(const Biography& biography, biographies)
QVariantMap biographyMap;
Q_FOREACH( const Biography& biography, biographies )
{
biographyMap[biography.site()]["site"] = biography.site();
biographyMap[biography.site()]["url"] = biography.url().toString();
biographyMap[biography.site()]["text"] = biography.text();
biographyMap[biography.site()]["attribution"] = biography.license().attribution;
biographyMap[biography.site()]["licensetype"] = biography.license().type;
biographyMap[biography.site()]["attribution"] = biography.license().url.toString();
QVariantHash siteData;
siteData[ "site" ] = biography.site();
siteData[ "url" ] = biography.url().toString();
siteData[ "text" ] = biography.text();
siteData[ "attribution" ] = biography.license().attribution;
siteData[ "licensetype" ] = biography.license().type;
siteData[ "attribution" ] = biography.license().url.toString();
biographyMap[ biography.site() ] = siteData;
}
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
emit info( reply->property( "requestId" ).toUInt(),
requestData,
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( biographyMap ) );
biographyMap );
reply->deleteLater();
}
@ -232,17 +233,17 @@ EchoNestPlugin::getArtistTermsSlot()
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
Echonest::Artist artist = artistFromReply( reply );
TermList terms = artist.terms();
InfoGenericMap termsMap;
QVariantMap termsMap;
Q_FOREACH( const Echonest::Term& term, terms ) {
QMap< QString, QString > termMap;
termMap[ "weight" ] = QString::number(term.weight());
termMap[ "frequency" ] = QString::number(term.frequency());
termsMap[ term.name() ] = termMap;
QVariantHash termHash;
termHash[ "weight" ] = QString::number( term.weight() );
termHash[ "frequency" ] = QString::number( term.frequency() );
termsMap[ term.name() ] = termHash;
}
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
emit info( reply->property( "requestId" ).toUInt(),
requestData,
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ) );
termsMap );
reply->deleteLater();
}
@ -251,17 +252,17 @@ EchoNestPlugin::getMiscTopSlot()
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
TermList terms = Echonest::Artist::parseTopTerms( reply );
InfoGenericMap termsMap;
QVariantMap termsMap;
Q_FOREACH( const Echonest::Term& term, terms ) {
QMap< QString, QString > termMap;
termMap[ "weight" ] = QString::number( term.weight() );
termMap[ "frequency" ] = QString::number( term.frequency() );
termsMap[ term.name().toLower() ] = termMap;
QVariantHash termHash;
termHash[ "weight" ] = QString::number( term.weight() );
termHash[ "frequency" ] = QString::number( term.frequency() );
termsMap[ term.name() ] = termHash;
}
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
emit info( reply->property( "requestId" ).toUInt(),
requestData,
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ) );
termsMap );
reply->deleteLater();
}

View File

@ -154,7 +154,6 @@ struct Chart {
typedef QMap< InfoType, QVariant > InfoTypeMap;
typedef QMap< InfoType, uint > InfoTimeoutMap;
typedef QMap< QString, QMap< QString, QString > > InfoGenericMap;
typedef QHash< QString, QString > InfoCriteriaHash;
class DLLEXPORT InfoPlugin : public QObject
@ -285,7 +284,6 @@ inline uint qHash( Tomahawk::InfoSystem::InfoCriteriaHash hash )
}
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoRequestData );
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoGenericMap );
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoCriteriaHash );
Q_DECLARE_METATYPE( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > );
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::ArtistTrackPair );

View File

@ -154,12 +154,12 @@ ArtistInfoWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
{
case InfoSystem::InfoArtistBiography:
{
InfoSystem::InfoGenericMap bmap = output.value< Tomahawk::InfoSystem::InfoGenericMap >();
QVariantMap bmap = output.toMap();
foreach ( const QString& source, bmap.keys() )
{
if ( m_longDescription.isEmpty() || source == "last.fm" )
m_longDescription = bmap[source]["text"];
m_longDescription = bmap[ source ].toHash()[ "text" ].toString();
}
emit longDescriptionChanged( m_longDescription );
break;

View File

@ -399,7 +399,6 @@ TomahawkApp::registerMetaTypes()
qRegisterMetaType< AudioErrorCode >("AudioErrorCode");
qRegisterMetaType< QMap< QString, QMap< QString, QString > > >( "Tomahawk::InfoSystem::InfoGenericMap" );
qRegisterMetaType< QHash< QString, QString > >( "Tomahawk::InfoSystem::InfoCriteriaHash" );
qRegisterMetaType< Tomahawk::InfoSystem::InfoType >( "Tomahawk::InfoSystem::InfoType" );
qRegisterMetaType< Tomahawk::InfoSystem::InfoRequestData >( "Tomahawk::InfoSystem::InfoRequestData" );