mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
Don't send multiple infosystem requests if one is queued
This commit is contained in:
parent
f95e2ad703
commit
b34037f26f
@ -166,7 +166,9 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
||||
if( !returnedData.contains(type) )
|
||||
break;
|
||||
const QString side = requestData.customData["whatshot_side"].toString();
|
||||
const QString chartId = requestData.input.value< Tomahawk::InfoSystem::InfoCriteriaHash >().value( "chart_id" );
|
||||
|
||||
m_queuedFetches.remove( chartId );
|
||||
tDebug( LOGVERBOSE ) << "WhatsHot: got chart! " << type << " on " << side;
|
||||
if( type == "artists" )
|
||||
{
|
||||
@ -182,7 +184,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
||||
artistPtr = Artist::get( 0, artist );
|
||||
artistsModel->addArtists( artistPtr );
|
||||
}
|
||||
const QString chartId = requestData.input.value< Tomahawk::InfoSystem::InfoCriteriaHash >().value( "chart_id" );
|
||||
|
||||
m_artistModels[ chartId ] = artistsModel;
|
||||
|
||||
setLeftViewArtists( artistsModel );
|
||||
@ -209,7 +211,6 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
||||
qDebug() << "Adding albums to model";
|
||||
albumModel->addAlbums( al );
|
||||
|
||||
const QString chartId = requestData.input.value< Tomahawk::InfoSystem::InfoCriteriaHash >().value( "chart_id" );
|
||||
m_albumModels[ chartId ] = albumModel;
|
||||
setLeftViewAlbums( albumModel );
|
||||
}
|
||||
@ -229,7 +230,6 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
||||
Pipeline::instance()->resolve( tracklist );
|
||||
trackModel->append( tracklist );
|
||||
|
||||
const QString chartId = requestData.input.value< Tomahawk::InfoSystem::InfoCriteriaHash >().value( "chart_id" );
|
||||
m_trackModels[ chartId ] = trackModel;
|
||||
setLeftViewTracks( trackModel );
|
||||
}
|
||||
@ -290,6 +290,11 @@ WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_queuedFetches.contains( chartId ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||
criteria.insert( "chart_id", chartId );
|
||||
/// Remember to lower the source!
|
||||
@ -306,6 +311,8 @@ WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
|
||||
|
||||
qDebug() << "Making infosystem request for chart of type:" <<chartId;
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData, 20000, true );
|
||||
|
||||
m_queuedFetches.insert( chartId );
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,6 +96,7 @@ private:
|
||||
QHash< QString, AlbumModel* > m_albumModels;
|
||||
QHash< QString, TreeModel* > m_artistModels;
|
||||
QHash< QString, PlaylistModel* > m_trackModels;
|
||||
QSet< QString > m_queuedFetches;
|
||||
QTimer* m_timer;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user