summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2022-03-23 20:11:31 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2022-03-23 20:11:31 +0100
commit238cd13469935ec908b6d179839b7b7b435cb2be (patch)
tree986856a871bb21e2a38ed9ece27b6e00d5bf1746
parentf3b19de594bc68449fab0f42426e971bae2c7ad9 (diff)
downloadrockbox-238cd13469.tar.gz
rockbox-238cd13469.zip
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
-rw-r--r--utils/rbutilqt/base/playerbuildinfo.cpp12
-rw-r--r--utils/rbutilqt/test/test-playerbuildinfo.cpp12
2 files changed, 14 insertions, 10 deletions
diff --git a/utils/rbutilqt/base/playerbuildinfo.cpp b/utils/rbutilqt/base/playerbuildinfo.cpp
index aba377eafc..195c170f0e 100644
--- a/utils/rbutilqt/base/playerbuildinfo.cpp
+++ b/utils/rbutilqt/base/playerbuildinfo.cpp
@@ -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));
diff --git a/utils/rbutilqt/test/test-playerbuildinfo.cpp b/utils/rbutilqt/test/test-playerbuildinfo.cpp
index de81b36a30..281f2682e9 100644
--- a/utils/rbutilqt/test/test-playerbuildinfo.cpp
+++ b/utils/rbutilqt/test/test-playerbuildinfo.cpp
@@ -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));
}