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