1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02: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() ); QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
Echonest::Artist artist = artistFromReply( reply ); Echonest::Artist artist = artistFromReply( reply );
BiographyList biographies = artist.biographies(); BiographyList biographies = artist.biographies();
InfoGenericMap biographyMap; QVariantMap biographyMap;
Q_FOREACH(const Biography& biography, biographies) Q_FOREACH( const Biography& biography, biographies )
{ {
biographyMap[biography.site()]["site"] = biography.site(); QVariantHash siteData;
biographyMap[biography.site()]["url"] = biography.url().toString(); siteData[ "site" ] = biography.site();
biographyMap[biography.site()]["text"] = biography.text(); siteData[ "url" ] = biography.url().toString();
biographyMap[biography.site()]["attribution"] = biography.license().attribution; siteData[ "text" ] = biography.text();
biographyMap[biography.site()]["licensetype"] = biography.license().type; siteData[ "attribution" ] = biography.license().attribution;
biographyMap[biography.site()]["attribution"] = biography.license().url.toString(); 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 >(); Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
emit info( reply->property( "requestId" ).toUInt(), emit info( reply->property( "requestId" ).toUInt(),
requestData, requestData,
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( biographyMap ) ); biographyMap );
reply->deleteLater(); reply->deleteLater();
} }
@@ -232,17 +233,17 @@ EchoNestPlugin::getArtistTermsSlot()
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() ); QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
Echonest::Artist artist = artistFromReply( reply ); Echonest::Artist artist = artistFromReply( reply );
TermList terms = artist.terms(); TermList terms = artist.terms();
InfoGenericMap termsMap; QVariantMap termsMap;
Q_FOREACH( const Echonest::Term& term, terms ) { Q_FOREACH( const Echonest::Term& term, terms ) {
QMap< QString, QString > termMap; QVariantHash termHash;
termMap[ "weight" ] = QString::number(term.weight()); termHash[ "weight" ] = QString::number( term.weight() );
termMap[ "frequency" ] = QString::number(term.frequency()); termHash[ "frequency" ] = QString::number( term.frequency() );
termsMap[ term.name() ] = termMap; termsMap[ term.name() ] = termHash;
} }
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
emit info( reply->property( "requestId" ).toUInt(), emit info( reply->property( "requestId" ).toUInt(),
requestData, requestData,
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ) ); termsMap );
reply->deleteLater(); reply->deleteLater();
} }
@@ -251,17 +252,17 @@ EchoNestPlugin::getMiscTopSlot()
{ {
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() ); QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
TermList terms = Echonest::Artist::parseTopTerms( reply ); TermList terms = Echonest::Artist::parseTopTerms( reply );
InfoGenericMap termsMap; QVariantMap termsMap;
Q_FOREACH( const Echonest::Term& term, terms ) { Q_FOREACH( const Echonest::Term& term, terms ) {
QMap< QString, QString > termMap; QVariantHash termHash;
termMap[ "weight" ] = QString::number( term.weight() ); termHash[ "weight" ] = QString::number( term.weight() );
termMap[ "frequency" ] = QString::number( term.frequency() ); termHash[ "frequency" ] = QString::number( term.frequency() );
termsMap[ term.name().toLower() ] = termMap; termsMap[ term.name() ] = termHash;
} }
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
emit info( reply->property( "requestId" ).toUInt(), emit info( reply->property( "requestId" ).toUInt(),
requestData, requestData,
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ) ); termsMap );
reply->deleteLater(); reply->deleteLater();
} }

View File

@@ -154,7 +154,6 @@ struct Chart {
typedef QMap< InfoType, QVariant > InfoTypeMap; typedef QMap< InfoType, QVariant > InfoTypeMap;
typedef QMap< InfoType, uint > InfoTimeoutMap; typedef QMap< InfoType, uint > InfoTimeoutMap;
typedef QMap< QString, QMap< QString, QString > > InfoGenericMap;
typedef QHash< QString, QString > InfoCriteriaHash; typedef QHash< QString, QString > InfoCriteriaHash;
class DLLEXPORT InfoPlugin : public QObject 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::InfoRequestData );
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoGenericMap );
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoCriteriaHash ); Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoCriteriaHash );
Q_DECLARE_METATYPE( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > ); Q_DECLARE_METATYPE( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > );
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::ArtistTrackPair ); Q_DECLARE_METATYPE( Tomahawk::InfoSystem::ArtistTrackPair );

View File

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

View File

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