rbutil: Fix build info list handling with Qt6.
With Qt6 we need to check the type differently or we'd convert a stringlist to a string. Change-Id: I00a7a73535503b97f40edb51099a332902e881e0
This commit is contained in:
parent
f3b19de594
commit
238cd13469
2 changed files with 14 additions and 10 deletions
|
@ -137,9 +137,9 @@ QVariant PlayerBuildInfo::value(BuildInfo item, BuildType type)
|
|||
break;
|
||||
}
|
||||
|
||||
QVariant result = QString();
|
||||
QVariant result;
|
||||
if (!serverInfo)
|
||||
return result;
|
||||
return QString();
|
||||
QStringList version = serverInfo->value(buildtypename + "/" + target, "").toStringList();
|
||||
serverinfo.replace(":build:", buildtypename);
|
||||
serverinfo.replace(":version:", version.at(0));
|
||||
|
@ -149,7 +149,7 @@ QVariant PlayerBuildInfo::value(BuildInfo item, BuildType type)
|
|||
// For invalid data return an empty string.
|
||||
if(version.at(0).isEmpty()) {
|
||||
LOG_INFO() << serverinfo << "(version invalid)";
|
||||
return result;
|
||||
return QString();
|
||||
}
|
||||
if(!serverinfo.isEmpty())
|
||||
result = serverInfo->value(serverinfo);
|
||||
|
@ -189,7 +189,11 @@ QVariant PlayerBuildInfo::value(BuildInfo item, BuildType type)
|
|||
// if the value is a string we can replace some patterns.
|
||||
// if we cannot convert it (f.e. for a QStringList) we leave as-is, since
|
||||
// the conversion would return an empty type.
|
||||
if (result.canConvert(QMetaType::QString))
|
||||
#if QT_VERSION < 0x060000
|
||||
if (result.type() == QVariant::String)
|
||||
#else
|
||||
if (result.metaType().id() == QMetaType::QString)
|
||||
#endif
|
||||
result = result.toString()
|
||||
.replace("%TARGET%", target)
|
||||
.replace("%VERSION%", version.at(0));
|
||||
|
|
|
@ -212,10 +212,10 @@ void TestPlayerBuildInfo::testBuildInfo()
|
|||
|
||||
RbSettings::setValue(RbSettings::CurrentPlatform, target);
|
||||
QVariant result = PlayerBuildInfo::instance()->value(item, type);
|
||||
if(result.canConvert(QMetaType::QString))
|
||||
QCOMPARE(result.toString(), QString(expected));
|
||||
else
|
||||
if(result.canConvert(QMetaType::QStringList))
|
||||
QCOMPARE(result.toStringList().join(","), QString(expected));
|
||||
else
|
||||
QCOMPARE(result.toString(), QString(expected));
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,10 +252,10 @@ void TestPlayerBuildInfo::testPlayerInfo()
|
|||
QFETCH(QString, expected);
|
||||
|
||||
QVariant result = PlayerBuildInfo::instance()->value(item, target);
|
||||
if(result.canConvert(QMetaType::QString))
|
||||
QCOMPARE(result.toString(), QString(expected));
|
||||
else
|
||||
if(result.canConvert(QMetaType::QStringList))
|
||||
QCOMPARE(result.toStringList().join(","), QString(expected));
|
||||
else
|
||||
QCOMPARE(result.toString(), QString(expected));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue