diff --git a/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.cpp b/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.cpp index 93430e909..3177a82f4 100644 --- a/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.cpp @@ -402,8 +402,8 @@ ChartsPlugin::chartReturned() /// SO we have a result, parse it! QVariantList chartResponse = res.value( "list" ).toList(); - QList top_tracks; - QList top_albums; + QList top_tracks; + QList top_albums; /// Deside what type, we need to handle it differently /// @todo: We allready know the type, append it to breadcrumb hash @@ -445,9 +445,9 @@ ChartsPlugin::chartReturned() else { qDebug() << Q_FUNC_INFO << album << artist; - ArtistAlbumPair pair; - pair.artist = artist; - pair.album = album; + InfoCriteriaHash pair; + pair["artist"] = artist; + pair["album"] = album; top_albums << pair; } @@ -464,9 +464,9 @@ ChartsPlugin::chartReturned() else { - ArtistTrackPair pair; - pair.artist = artist; - pair.track = title; + InfoCriteriaHash pair; + pair["artist"] = artist; + pair["track"] = title; top_tracks << pair; } diff --git a/src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp b/src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp index 4f8487f7a..4371c8b0e 100644 --- a/src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/generic/lastfmplugin.cpp @@ -565,11 +565,11 @@ LastFmPlugin::chartReturned() if ( url.contains( tracks_rx ) ) { QList tracks = parseTrackList( reply ); - QList top_tracks; + QList top_tracks; foreach( const lastfm::Track &t, tracks ) { - ArtistTrackPair pair; - pair.artist = t.artist().toString(); - pair.track = t.title(); + InfoCriteriaHash pair; + pair[ "artist" ] = t.artist().toString(); + pair[ "track" ] = t.title(); top_tracks << pair; } tDebug() << "LastFmPlugin:" << "\tgot " << top_tracks.size() << " tracks"; diff --git a/src/libtomahawk/infosystem/infosystem.h b/src/libtomahawk/infosystem/infosystem.h index e5563b70a..ec0ff696c 100644 --- a/src/libtomahawk/infosystem/infosystem.h +++ b/src/libtomahawk/infosystem/infosystem.h @@ -130,16 +130,6 @@ struct InfoRequestData { QVariantMap customData; }; -struct ArtistTrackPair { - QString artist; - QString track; -}; - -struct ArtistAlbumPair { - QString artist; - QString album; -}; - struct Chart { Chart(){} Chart(const QString _id, const QString _label, const QString _type) { @@ -286,11 +276,8 @@ inline uint qHash( Tomahawk::InfoSystem::InfoCriteriaHash hash ) Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoRequestData ); Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoCriteriaHash ); Q_DECLARE_METATYPE( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > ); -Q_DECLARE_METATYPE( Tomahawk::InfoSystem::ArtistTrackPair ); -Q_DECLARE_METATYPE( Tomahawk::InfoSystem::ArtistAlbumPair ); Q_DECLARE_METATYPE( Tomahawk::InfoSystem::Chart ); -Q_DECLARE_METATYPE( QList ); -Q_DECLARE_METATYPE( QList ); +Q_DECLARE_METATYPE( QList ); Q_DECLARE_METATYPE( QList ); #endif // TOMAHAWK_INFOSYSTEM_H diff --git a/src/libtomahawk/widgets/whatshotwidget.cpp b/src/libtomahawk/widgets/whatshotwidget.cpp index 9a4a27dcc..2d5ba5864 100644 --- a/src/libtomahawk/widgets/whatshotwidget.cpp +++ b/src/libtomahawk/widgets/whatshotwidget.cpp @@ -190,15 +190,15 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat else if( type == "albums" ) { QList al; - const QList albums = returnedData["albums"].value >(); + const QList albums = returnedData[ "albums" ].value >(); tDebug( LOGVERBOSE ) << "WhatsHot: got albums! " << albums.size(); AlbumModel* albumModel = new AlbumModel( ui->additionsView ); - foreach ( const Tomahawk::InfoSystem::ArtistAlbumPair& album, albums ) + foreach ( const Tomahawk::InfoSystem::InfoCriteriaHash& album, albums ) { - qDebug() << "Getting album" << album.album << "By" << album.artist; - artist_ptr artistPtr = Artist::get( album.artist, false ); - album_ptr albumPtr = Album::get( artistPtr, album.album, false ); + qDebug() << "Getting album" << album[ "album" ] << "By" << album[ "artist" ]; + artist_ptr artistPtr = Artist::get( album[ "artist" ], false ); + album_ptr albumPtr = Album::get( artistPtr, album[ "album" ], false ); al << albumPtr; } @@ -210,15 +210,15 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat } else if( type == "tracks" ) { - const QList tracks = returnedData["tracks"].value >(); + const QList tracks = returnedData[ "tracks" ].value >(); tDebug( LOGVERBOSE ) << "WhatsHot: got tracks! " << tracks.size(); PlaylistModel* trackModel = new PlaylistModel( ui->tracksViewLeft ); trackModel->setStyle( TrackModel::Short ); QList tracklist; - foreach ( const Tomahawk::InfoSystem::ArtistTrackPair& track, tracks ) + foreach ( const Tomahawk::InfoSystem::InfoCriteriaHash& track, tracks ) { - query_ptr query = Query::get( track.artist, track.track, QString(), uuid(), false ); + query_ptr query = Query::get( track[ "artist" ], track[ "track" ], QString(), uuid(), false ); tracklist << query; } Pipeline::instance()->resolve( tracklist ); diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 198db098a..a7196329c 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -413,10 +413,7 @@ TomahawkApp::registerMetaTypes() qRegisterMetaType< Tomahawk::InfoSystem::InfoRequestData >( "Tomahawk::InfoSystem::InfoRequestData" ); qRegisterMetaType< QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > >( "QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache >" ); - qRegisterMetaType< Tomahawk::InfoSystem::ArtistTrackPair >("Tomahawk::InfoSystem::ArtistTrackPair"); - qRegisterMetaType< Tomahawk::InfoSystem::ArtistAlbumPair >("Tomahawk::InfoSystem::ArtistAlbumPair"); - qRegisterMetaType< QList >("QList"); - qRegisterMetaType< QList >("QList"); + qRegisterMetaType< QList >("QList"); qRegisterMetaType< Tomahawk::InfoSystem::Chart>("Tomahawk::InfoSystem::Chart"); qRegisterMetaType< QList >("QList"); qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" );