mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Remove unnecessary custom types from info system
This commit is contained in:
@@ -402,8 +402,8 @@ ChartsPlugin::chartReturned()
|
|||||||
|
|
||||||
/// SO we have a result, parse it!
|
/// SO we have a result, parse it!
|
||||||
QVariantList chartResponse = res.value( "list" ).toList();
|
QVariantList chartResponse = res.value( "list" ).toList();
|
||||||
QList<ArtistTrackPair> top_tracks;
|
QList<InfoCriteriaHash> top_tracks;
|
||||||
QList<ArtistAlbumPair> top_albums;
|
QList<InfoCriteriaHash> top_albums;
|
||||||
|
|
||||||
/// Deside what type, we need to handle it differently
|
/// Deside what type, we need to handle it differently
|
||||||
/// @todo: We allready know the type, append it to breadcrumb hash
|
/// @todo: We allready know the type, append it to breadcrumb hash
|
||||||
@@ -445,9 +445,9 @@ ChartsPlugin::chartReturned()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << album << artist;
|
qDebug() << Q_FUNC_INFO << album << artist;
|
||||||
ArtistAlbumPair pair;
|
InfoCriteriaHash pair;
|
||||||
pair.artist = artist;
|
pair["artist"] = artist;
|
||||||
pair.album = album;
|
pair["album"] = album;
|
||||||
top_albums << pair;
|
top_albums << pair;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -464,9 +464,9 @@ ChartsPlugin::chartReturned()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ArtistTrackPair pair;
|
InfoCriteriaHash pair;
|
||||||
pair.artist = artist;
|
pair["artist"] = artist;
|
||||||
pair.track = title;
|
pair["track"] = title;
|
||||||
top_tracks << pair;
|
top_tracks << pair;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -565,11 +565,11 @@ LastFmPlugin::chartReturned()
|
|||||||
if ( url.contains( tracks_rx ) )
|
if ( url.contains( tracks_rx ) )
|
||||||
{
|
{
|
||||||
QList<lastfm::Track> tracks = parseTrackList( reply );
|
QList<lastfm::Track> tracks = parseTrackList( reply );
|
||||||
QList<ArtistTrackPair> top_tracks;
|
QList<InfoCriteriaHash> top_tracks;
|
||||||
foreach( const lastfm::Track &t, tracks ) {
|
foreach( const lastfm::Track &t, tracks ) {
|
||||||
ArtistTrackPair pair;
|
InfoCriteriaHash pair;
|
||||||
pair.artist = t.artist().toString();
|
pair[ "artist" ] = t.artist().toString();
|
||||||
pair.track = t.title();
|
pair[ "track" ] = t.title();
|
||||||
top_tracks << pair;
|
top_tracks << pair;
|
||||||
}
|
}
|
||||||
tDebug() << "LastFmPlugin:" << "\tgot " << top_tracks.size() << " tracks";
|
tDebug() << "LastFmPlugin:" << "\tgot " << top_tracks.size() << " tracks";
|
||||||
|
@@ -130,16 +130,6 @@ struct InfoRequestData {
|
|||||||
QVariantMap customData;
|
QVariantMap customData;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ArtistTrackPair {
|
|
||||||
QString artist;
|
|
||||||
QString track;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ArtistAlbumPair {
|
|
||||||
QString artist;
|
|
||||||
QString album;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Chart {
|
struct Chart {
|
||||||
Chart(){}
|
Chart(){}
|
||||||
Chart(const QString _id, const QString _label, const QString _type) {
|
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::InfoRequestData );
|
||||||
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::ArtistAlbumPair );
|
|
||||||
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::Chart );
|
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::Chart );
|
||||||
Q_DECLARE_METATYPE( QList<Tomahawk::InfoSystem::ArtistTrackPair> );
|
Q_DECLARE_METATYPE( QList<Tomahawk::InfoSystem::InfoCriteriaHash> );
|
||||||
Q_DECLARE_METATYPE( QList<Tomahawk::InfoSystem::ArtistAlbumPair> );
|
|
||||||
Q_DECLARE_METATYPE( QList<Tomahawk::InfoSystem::Chart> );
|
Q_DECLARE_METATYPE( QList<Tomahawk::InfoSystem::Chart> );
|
||||||
|
|
||||||
#endif // TOMAHAWK_INFOSYSTEM_H
|
#endif // TOMAHAWK_INFOSYSTEM_H
|
||||||
|
@@ -190,15 +190,15 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
|||||||
else if( type == "albums" )
|
else if( type == "albums" )
|
||||||
{
|
{
|
||||||
QList<album_ptr> al;
|
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();
|
tDebug( LOGVERBOSE ) << "WhatsHot: got albums! " << albums.size();
|
||||||
|
|
||||||
AlbumModel* albumModel = new AlbumModel( ui->additionsView );
|
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;
|
qDebug() << "Getting album" << album[ "album" ] << "By" << album[ "artist" ];
|
||||||
artist_ptr artistPtr = Artist::get( album.artist, false );
|
artist_ptr artistPtr = Artist::get( album[ "artist" ], false );
|
||||||
album_ptr albumPtr = Album::get( artistPtr, album.album, false );
|
album_ptr albumPtr = Album::get( artistPtr, album[ "album" ], false );
|
||||||
al << albumPtr;
|
al << albumPtr;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -210,15 +210,15 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
|||||||
}
|
}
|
||||||
else if( type == "tracks" )
|
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();
|
tDebug( LOGVERBOSE ) << "WhatsHot: got tracks! " << tracks.size();
|
||||||
|
|
||||||
PlaylistModel* trackModel = new PlaylistModel( ui->tracksViewLeft );
|
PlaylistModel* trackModel = new PlaylistModel( ui->tracksViewLeft );
|
||||||
trackModel->setStyle( TrackModel::Short );
|
trackModel->setStyle( TrackModel::Short );
|
||||||
QList<query_ptr> tracklist;
|
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;
|
tracklist << query;
|
||||||
}
|
}
|
||||||
Pipeline::instance()->resolve( tracklist );
|
Pipeline::instance()->resolve( tracklist );
|
||||||
|
@@ -413,10 +413,7 @@ TomahawkApp::registerMetaTypes()
|
|||||||
qRegisterMetaType< Tomahawk::InfoSystem::InfoRequestData >( "Tomahawk::InfoSystem::InfoRequestData" );
|
qRegisterMetaType< Tomahawk::InfoSystem::InfoRequestData >( "Tomahawk::InfoSystem::InfoRequestData" );
|
||||||
qRegisterMetaType< QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > >( "QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache >" );
|
qRegisterMetaType< QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > >( "QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache >" );
|
||||||
|
|
||||||
qRegisterMetaType< Tomahawk::InfoSystem::ArtistTrackPair >("Tomahawk::InfoSystem::ArtistTrackPair");
|
qRegisterMetaType< QList<Tomahawk::InfoSystem::InfoCriteriaHash> >("QList<Tomahawk::InfoSystem::InfoCriteriaHash>");
|
||||||
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< Tomahawk::InfoSystem::Chart>("Tomahawk::InfoSystem::Chart");
|
qRegisterMetaType< Tomahawk::InfoSystem::Chart>("Tomahawk::InfoSystem::Chart");
|
||||||
qRegisterMetaType< QList<Tomahawk::InfoSystem::Chart> >("QList<Tomahawk::InfoSystem::Chart>");
|
qRegisterMetaType< QList<Tomahawk::InfoSystem::Chart> >("QList<Tomahawk::InfoSystem::Chart>");
|
||||||
qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" );
|
qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" );
|
||||||
|
Reference in New Issue
Block a user