diff options
Diffstat (limited to 'utils/rbutilqt')
-rw-r--r-- | utils/rbutilqt/base/playerbuildinfo.cpp | 12 | ||||
-rw-r--r-- | utils/rbutilqt/test/test-playerbuildinfo.cpp | 12 |
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) | |||
137 | break; | 137 | break; |
138 | } | 138 | } |
139 | 139 | ||
140 | QVariant result = QString(); | 140 | QVariant result; |
141 | if (!serverInfo) | 141 | if (!serverInfo) |
142 | return result; | 142 | return QString(); |
143 | QStringList version = serverInfo->value(buildtypename + "/" + target, "").toStringList(); | 143 | QStringList version = serverInfo->value(buildtypename + "/" + target, "").toStringList(); |
144 | serverinfo.replace(":build:", buildtypename); | 144 | serverinfo.replace(":build:", buildtypename); |
145 | serverinfo.replace(":version:", version.at(0)); | 145 | serverinfo.replace(":version:", version.at(0)); |
@@ -149,7 +149,7 @@ QVariant PlayerBuildInfo::value(BuildInfo item, BuildType type) | |||
149 | // For invalid data return an empty string. | 149 | // For invalid data return an empty string. |
150 | if(version.at(0).isEmpty()) { | 150 | if(version.at(0).isEmpty()) { |
151 | LOG_INFO() << serverinfo << "(version invalid)"; | 151 | LOG_INFO() << serverinfo << "(version invalid)"; |
152 | return result; | 152 | return QString(); |
153 | } | 153 | } |
154 | if(!serverinfo.isEmpty()) | 154 | if(!serverinfo.isEmpty()) |
155 | result = serverInfo->value(serverinfo); | 155 | result = serverInfo->value(serverinfo); |
@@ -189,7 +189,11 @@ QVariant PlayerBuildInfo::value(BuildInfo item, BuildType type) | |||
189 | // if the value is a string we can replace some patterns. | 189 | // if the value is a string we can replace some patterns. |
190 | // if we cannot convert it (f.e. for a QStringList) we leave as-is, since | 190 | // if we cannot convert it (f.e. for a QStringList) we leave as-is, since |
191 | // the conversion would return an empty type. | 191 | // the conversion would return an empty type. |
192 | if (result.canConvert(QMetaType::QString)) | 192 | #if QT_VERSION < 0x060000 |
193 | if (result.type() == QVariant::String) | ||
194 | #else | ||
195 | if (result.metaType().id() == QMetaType::QString) | ||
196 | #endif | ||
193 | result = result.toString() | 197 | result = result.toString() |
194 | .replace("%TARGET%", target) | 198 | .replace("%TARGET%", target) |
195 | .replace("%VERSION%", version.at(0)); | 199 | .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() | |||
212 | 212 | ||
213 | RbSettings::setValue(RbSettings::CurrentPlatform, target); | 213 | RbSettings::setValue(RbSettings::CurrentPlatform, target); |
214 | QVariant result = PlayerBuildInfo::instance()->value(item, type); | 214 | QVariant result = PlayerBuildInfo::instance()->value(item, type); |
215 | if(result.canConvert(QMetaType::QString)) | 215 | if(result.canConvert(QMetaType::QStringList)) |
216 | QCOMPARE(result.toString(), QString(expected)); | ||
217 | else | ||
218 | QCOMPARE(result.toStringList().join(","), QString(expected)); | 216 | QCOMPARE(result.toStringList().join(","), QString(expected)); |
217 | else | ||
218 | QCOMPARE(result.toString(), QString(expected)); | ||
219 | } | 219 | } |
220 | 220 | ||
221 | 221 | ||
@@ -252,10 +252,10 @@ void TestPlayerBuildInfo::testPlayerInfo() | |||
252 | QFETCH(QString, expected); | 252 | QFETCH(QString, expected); |
253 | 253 | ||
254 | QVariant result = PlayerBuildInfo::instance()->value(item, target); | 254 | QVariant result = PlayerBuildInfo::instance()->value(item, target); |
255 | if(result.canConvert(QMetaType::QString)) | 255 | if(result.canConvert(QMetaType::QStringList)) |
256 | QCOMPARE(result.toString(), QString(expected)); | ||
257 | else | ||
258 | QCOMPARE(result.toStringList().join(","), QString(expected)); | 256 | QCOMPARE(result.toStringList().join(","), QString(expected)); |
257 | else | ||
258 | QCOMPARE(result.toString(), QString(expected)); | ||
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||