mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Remove unnecessary custom types from info system
This commit is contained in:
parent
52bb303ffa
commit
d73800bd5f
@ -402,8 +402,8 @@ ChartsPlugin::chartReturned()
|
||||
|
||||
/// SO we have a result, parse it!
|
||||
QVariantList chartResponse = res.value( "list" ).toList();
|
||||
QList<ArtistTrackPair> top_tracks;
|
||||
QList<ArtistAlbumPair> top_albums;
|
||||
QList<InfoCriteriaHash> top_tracks;
|
||||
QList<InfoCriteriaHash> 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;
|
||||
|
||||
}
|
||||
|
@ -565,11 +565,11 @@ LastFmPlugin::chartReturned()
|
||||
if ( url.contains( tracks_rx ) )
|
||||
{
|
||||
QList<lastfm::Track> tracks = parseTrackList( reply );
|
||||
QList<ArtistTrackPair> top_tracks;
|
||||
QList<InfoCriteriaHash> 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";
|
||||
|
@ -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<Tomahawk::InfoSystem::ArtistTrackPair> );
|
||||
Q_DECLARE_METATYPE( QList<Tomahawk::InfoSystem::ArtistAlbumPair> );
|
||||
Q_DECLARE_METATYPE( QList<Tomahawk::InfoSystem::InfoCriteriaHash> );
|
||||
Q_DECLARE_METATYPE( QList<Tomahawk::InfoSystem::Chart> );
|
||||
|
||||
#endif // TOMAHAWK_INFOSYSTEM_H
|
||||
|
@ -190,15 +190,15 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
||||
else if( type == "albums" )
|
||||
{
|
||||
QList<album_ptr> al;
|
||||
const QList<Tomahawk::InfoSystem::ArtistAlbumPair> albums = returnedData["albums"].value<QList<Tomahawk::InfoSystem::ArtistAlbumPair> >();
|
||||
const QList<Tomahawk::InfoSystem::InfoCriteriaHash> albums = returnedData[ "albums" ].value<QList<Tomahawk::InfoSystem::InfoCriteriaHash> >();
|
||||
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<Tomahawk::InfoSystem::ArtistTrackPair> tracks = returnedData["tracks"].value<QList<Tomahawk::InfoSystem::ArtistTrackPair> >();
|
||||
const QList<Tomahawk::InfoSystem::InfoCriteriaHash> tracks = returnedData[ "tracks" ].value<QList<Tomahawk::InfoSystem::InfoCriteriaHash> >();
|
||||
tDebug( LOGVERBOSE ) << "WhatsHot: got tracks! " << tracks.size();
|
||||
|
||||
PlaylistModel* trackModel = new PlaylistModel( ui->tracksViewLeft );
|
||||
trackModel->setStyle( TrackModel::Short );
|
||||
QList<query_ptr> 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 );
|
||||
|
@ -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<Tomahawk::InfoSystem::ArtistTrackPair> >("QList<Tomahawk::InfoSystem::ArtistTrackPair>");
|
||||
qRegisterMetaType< QList<Tomahawk::InfoSystem::ArtistAlbumPair> >("QList<Tomahawk::InfoSystem::ArtistAlbumPair>");
|
||||
qRegisterMetaType< QList<Tomahawk::InfoSystem::InfoCriteriaHash> >("QList<Tomahawk::InfoSystem::InfoCriteriaHash>");
|
||||
qRegisterMetaType< Tomahawk::InfoSystem::Chart>("Tomahawk::InfoSystem::Chart");
|
||||
qRegisterMetaType< QList<Tomahawk::InfoSystem::Chart> >("QList<Tomahawk::InfoSystem::Chart>");
|
||||
qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user