mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Return the chart list if we receive it after the infosystem request
This commit is contained in:
@@ -222,18 +222,20 @@ ChartsPlugin::notInCacheSlot( uint requestId, QHash<QString, QString> criteria,
|
||||
|
||||
case InfoChartCapabilities:
|
||||
{
|
||||
if( m_result.isEmpty() ){
|
||||
if ( m_allChartsMap.isEmpty() )
|
||||
{
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "InfoChartCapabilities is empty!";
|
||||
qDebug() << Q_FUNC_INFO << "InfoChartCapabilities is empty, probably still fetching!";
|
||||
m_cachedRequests.append( QPair< uint, InfoRequestData >( requestId, requestData ) );;
|
||||
|
||||
dataError( requestId, requestData );
|
||||
// dataError( requestId, requestData );
|
||||
return;
|
||||
}
|
||||
|
||||
emit info(
|
||||
requestId,
|
||||
requestData,
|
||||
m_result
|
||||
m_allChartsMap
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -269,11 +271,12 @@ ChartsPlugin::chartTypes()
|
||||
}
|
||||
|
||||
/// Got types, append!
|
||||
foreach(QVariant chart, res.value( "charts" ).toMap() ){
|
||||
foreach ( QVariant chart, res.value( "charts" ).toMap() )
|
||||
{
|
||||
m_chartTypes.append( chart );
|
||||
|
||||
}
|
||||
|
||||
tDebug() << "Chart types we got:" << m_chartType;
|
||||
/// Itunes have alot of country specified charts,
|
||||
/// Get those for later use
|
||||
QList<QString> geos;
|
||||
@@ -337,7 +340,9 @@ ChartsPlugin::chartTypes()
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Billboard, and maybe others
|
||||
foreach ( QVariant type, m_chartTypes )
|
||||
{
|
||||
@@ -367,9 +372,23 @@ ChartsPlugin::chartTypes()
|
||||
chartName[0] = chartName[0].toUpper();
|
||||
|
||||
/// Add the possible charts and its types to breadcrumb
|
||||
m_result.insert( chartName , QVariant::fromValue<QVariantMap>( charts ) );
|
||||
m_allChartsMap.insert( chartName , QVariant::fromValue<QVariantMap>( charts ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tLog() << "Error fetching charts:" << reply->errorString();
|
||||
}
|
||||
|
||||
if ( !m_cachedRequests.isEmpty() )
|
||||
{
|
||||
QPair< uint, InfoRequestData > request;
|
||||
foreach ( request, m_cachedRequests )
|
||||
{
|
||||
emit info( request.first, request.second, m_allChartsMap );
|
||||
}
|
||||
m_cachedRequests.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -71,9 +71,10 @@ private:
|
||||
QList<Chart> m_charts;
|
||||
ChartType m_chartType;
|
||||
|
||||
QVariantMap m_result;
|
||||
QVariantMap m_chartResult;
|
||||
bool chartHasReturned;
|
||||
QVariantMap m_allChartsMap;
|
||||
|
||||
QList< QPair< uint, InfoRequestData > > m_cachedRequests;
|
||||
|
||||
QWeakPointer< QNetworkAccessManager > m_nam;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user