mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 01:39:42 +01:00
Make timeoutMillis invunerable against inconsistent changes
This commit is contained in:
parent
e26545b195
commit
cdb044b4e4
@ -34,6 +34,34 @@ namespace Tomahawk
|
||||
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()
|
||||
: QObject()
|
||||
{
|
||||
@ -165,7 +193,7 @@ InfoSystem::getInfo( const QString &caller, const QVariantMap &customData, const
|
||||
{
|
||||
requestData.type = 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 ) );
|
||||
}
|
||||
return false;
|
||||
|
@ -61,27 +61,12 @@ struct InfoRequestData {
|
||||
uint timeoutMillis;
|
||||
bool allSources;
|
||||
|
||||
InfoRequestData()
|
||||
: requestId( TomahawkUtils::infosystemRequestId() )
|
||||
, internalId( TomahawkUtils::infosystemRequestId() )
|
||||
, caller( QString() )
|
||||
, type( Tomahawk::InfoSystem::InfoNoInfo )
|
||||
, input( QVariant() )
|
||||
, customData( QVariantMap() )
|
||||
, timeoutMillis( 10000 )
|
||||
, allSources( false )
|
||||
{}
|
||||
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 )
|
||||
, customData( custom )
|
||||
, timeoutMillis( 10000 )
|
||||
, allSources( false )
|
||||
{}
|
||||
InfoRequestData( const quint64 rId, const QString &callr, const Tomahawk::InfoSystem::InfoType typ, const QVariant &inputvar, const QVariantMap &custom );
|
||||
|
||||
private:
|
||||
init( const QString& callr, const InfoType typ, const QVariant& inputvar, const QVariantMap& custom);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user