1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Finish making InfoSystem accept a requestId that clients can use for

tracking
This commit is contained in:
Jeff Mitchell 2011-10-26 14:01:03 -04:00
parent 4e71a56b18
commit e341120f64
2 changed files with 12 additions and 3 deletions

View File

@ -127,6 +127,7 @@ enum InfoType { // as items are saved in cache, mark them here to not change the
struct InfoRequestData {
quint64 requestId;
quint64 internalId; //do not assign to this; it may get overwritten by the InfoSystem
QString caller;
Tomahawk::InfoSystem::InfoType type;
QVariant input;
@ -134,6 +135,7 @@ struct InfoRequestData {
InfoRequestData()
: requestId( TomahawkUtils::infosystemRequestId() )
, internalId( TomahawkUtils::infosystemRequestId() )
, caller( QString() )
, type( Tomahawk::InfoSystem::InfoNoInfo )
, input( QVariant() )
@ -142,6 +144,7 @@ struct InfoRequestData {
InfoRequestData( const quint64 rId, const QString &callr, const Tomahawk::InfoSystem::InfoType typ, const QVariant &inputvar, const QVariantMap &custom )
: requestId( rId )
, internalId( TomahawkUtils::infosystemRequestId() )
, caller( callr )
, type( typ )
, input( inputvar )

View File

@ -173,7 +173,7 @@ InfoSystemWorker::determineOrderedMatches( const InfoType type ) const
void
InfoSystemWorker::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData, uint timeoutMillis, bool allSources )
{
// qDebug() << Q_FUNC_INFO;
//qDebug() << Q_FUNC_INFO << "type is " << requestData.type << " and allSources = " << (allSources ? "true" : "false" );
QList< InfoPluginPtr > providers = determineOrderedMatches( requestData.type );
if ( providers.isEmpty() )
@ -193,7 +193,13 @@ InfoSystemWorker::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData, ui
continue;
foundOne = true;
quint64 requestId = requestData.requestId;
if ( allSources )
requestData.internalId = TomahawkUtils::infosystemRequestId();
else
requestData.internalId = requestData.requestId;
quint64 requestId = requestData.internalId;
m_requestSatisfiedMap[ requestId ] = false;
if ( timeoutMillis != 0 )
{
@ -240,7 +246,7 @@ InfoSystemWorker::infoSlot( Tomahawk::InfoSystem::InfoRequestData requestData, Q
{
// qDebug() << Q_FUNC_INFO << "with requestId" << requestId;
quint64 requestId = requestData.requestId;
quint64 requestId = requestData.internalId;
if ( m_dataTracker[ requestData.caller ][ requestData.type ] == 0 )
{