mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Make timeoutMillis invunerable against inconsistent changes
This commit is contained in:
@@ -34,6 +34,34 @@ namespace Tomahawk
|
|||||||
namespace InfoSystem
|
namespace InfoSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static const int DEFAULT_TIMEOUT_MILLIS = 10000;
|
||||||
|
|
||||||
|
InfoRequestData::InfoRequestData()
|
||||||
|
: requestId( TomahawkUtils::infosystemRequestId() )
|
||||||
|
{
|
||||||
|
init( QString() , Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariantMap() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InfoRequestData::InfoRequestData( const quint64 rId, const QString& callr, const InfoType typ, const QVariant& inputvar, const QVariantMap& custom )
|
||||||
|
: requestId( rId )
|
||||||
|
{
|
||||||
|
init( callr, typ, inputvar, custom );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InfoRequestData::init( const QString& callr, const InfoType typ, const QVariant& inputvar, const QVariantMap& custom )
|
||||||
|
{
|
||||||
|
internalId = TomahawkUtils::infosystemRequestId();
|
||||||
|
caller = callr;
|
||||||
|
type = typ;
|
||||||
|
input = inputvar;
|
||||||
|
customData = custom;
|
||||||
|
timeoutMillis = DEFAULT_TIMEOUT_MILLIS;
|
||||||
|
allSources = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
InfoPlugin::InfoPlugin()
|
InfoPlugin::InfoPlugin()
|
||||||
: QObject()
|
: QObject()
|
||||||
{
|
{
|
||||||
@@ -165,7 +193,7 @@ InfoSystem::getInfo( const QString &caller, const QVariantMap &customData, const
|
|||||||
{
|
{
|
||||||
requestData.type = type;
|
requestData.type = type;
|
||||||
requestData.input = inputMap[ type ];
|
requestData.input = inputMap[ type ];
|
||||||
requestData.timeoutMillis = timeoutMap.contains( type ) ? timeoutMap[ type ] : 10000;
|
requestData.timeoutMillis = timeoutMap.contains( type ) ? timeoutMap[ type ] : DEFAULT_TIMEOUT_MILLIS;
|
||||||
QMetaObject::invokeMethod( m_infoSystemWorkerThreadController->worker(), "getInfo", Qt::QueuedConnection, Q_ARG( Tomahawk::InfoSystem::InfoRequestData, requestData ) );
|
QMetaObject::invokeMethod( m_infoSystemWorkerThreadController->worker(), "getInfo", Qt::QueuedConnection, Q_ARG( Tomahawk::InfoSystem::InfoRequestData, requestData ) );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@@ -61,27 +61,12 @@ struct InfoRequestData {
|
|||||||
uint timeoutMillis;
|
uint timeoutMillis;
|
||||||
bool allSources;
|
bool allSources;
|
||||||
|
|
||||||
InfoRequestData()
|
InfoRequestData();
|
||||||
: requestId( TomahawkUtils::infosystemRequestId() )
|
|
||||||
, internalId( TomahawkUtils::infosystemRequestId() )
|
|
||||||
, caller( QString() )
|
|
||||||
, type( Tomahawk::InfoSystem::InfoNoInfo )
|
|
||||||
, input( QVariant() )
|
|
||||||
, customData( QVariantMap() )
|
|
||||||
, timeoutMillis( 10000 )
|
|
||||||
, allSources( false )
|
|
||||||
{}
|
|
||||||
|
|
||||||
InfoRequestData( const quint64 rId, const QString &callr, const Tomahawk::InfoSystem::InfoType typ, const QVariant &inputvar, const QVariantMap &custom )
|
InfoRequestData( const quint64 rId, const QString &callr, const Tomahawk::InfoSystem::InfoType typ, const QVariant &inputvar, const QVariantMap &custom );
|
||||||
: requestId( rId )
|
|
||||||
, internalId( TomahawkUtils::infosystemRequestId() )
|
private:
|
||||||
, caller( callr )
|
init( const QString& callr, const InfoType typ, const QVariant& inputvar, const QVariantMap& custom);
|
||||||
, type( typ )
|
|
||||||
, input( inputvar )
|
|
||||||
, customData( custom )
|
|
||||||
, timeoutMillis( 10000 )
|
|
||||||
, allSources( false )
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user