welcome: Fix requirements parsing

As the config files integer are now of type `QVariant::LongLong` instead
of `QVariant::Int`, requirements relying on this type were not parsed
correctly.

This patch fixes this, and adds an option to the python conversion to
take into account `QVariant::LongLong` types.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
main
Arnaud Ferraris 6 years ago
parent 0d06e047ae
commit 3929557a5a

@ -52,6 +52,9 @@ variantToPyObject( const QVariant& variant )
case QVariant::Int:
return bp::object( variant.toInt() );
case QVariant::LongLong:
return bp::object( variant.toLongLong() );
case QVariant::Double:
return bp::object( variant.toDouble() );

@ -206,7 +206,7 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
if ( configurationMap.contains( "requiredStorage" ) &&
( configurationMap.value( "requiredStorage" ).type() == QVariant::Double ||
configurationMap.value( "requiredStorage" ).type() == QVariant::Int ) )
configurationMap.value( "requiredStorage" ).type() == QVariant::LongLong ) )
{
bool ok = false;
m_requiredStorageGiB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
@ -227,7 +227,7 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
if ( configurationMap.contains( "requiredRam" ) &&
( configurationMap.value( "requiredRam" ).type() == QVariant::Double ||
configurationMap.value( "requiredRam" ).type() == QVariant::Int ) )
configurationMap.value( "requiredRam" ).type() == QVariant::LongLong ) )
{
bool ok = false;
m_requiredRamGiB = configurationMap.value( "requiredRam" ).toDouble( &ok );

Loading…
Cancel
Save