diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-11-15 21:55:34 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-11-15 21:55:34 +0100 |
commit | dec5421ca2cb5ac9e77ce96507d0285a6b0fcfee (patch) | |
tree | d8a93441f1ed6f4c21f5e483fa42d5fe7f97b1eb /rbutil/rbutilqt/base | |
parent | af766ae10eb10685bfd81124738b167294b7a8f2 (diff) |
rbutil: Rework server info data handling.
Return status as int, not as string, and provide a separate function for
converting to string. This allows to filter based on the actual status,
not a (localized) status string, which is more robust.
Fix a regression that made players with missing status value show up as
retired.
Change-Id: I15f83ae0df484199b1b3b5b95069db8b4d425987
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r-- | rbutil/rbutilqt/base/serverinfo.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp index 84aa89039d..88c8d955fe 100644 --- a/rbutil/rbutilqt/base/serverinfo.cpp +++ b/rbutil/rbutilqt/base/serverinfo.cpp @@ -27,18 +27,19 @@ static QSettings* serverSettings = nullptr; const static struct { ServerInfo::ServerInfos info; const char* name; + const char* def; } ServerInfoList[] = { - { ServerInfo::CurReleaseVersion, "release/:platform:" }, - { ServerInfo::CurReleaseUrl, "release/:platform:" }, - { ServerInfo::RelCandidateVersion, "release-candidate/:platform:" }, - { ServerInfo::RelCandidateUrl, "release-candidate/:platform:" }, - { ServerInfo::CurStatus, "status/:platform:" }, - { ServerInfo::ManualPdfUrl, "" }, - { ServerInfo::ManualHtmlUrl, "" }, - { ServerInfo::ManualZipUrl, "" }, - { ServerInfo::BleedingRevision, "bleeding/rev" }, - { ServerInfo::BleedingDate, "bleeding/timestamp" }, - { ServerInfo::CurDevelUrl, "" }, + { ServerInfo::CurReleaseVersion, "release/:platform:", "" }, + { ServerInfo::CurReleaseUrl, "release/:platform:", "" }, + { ServerInfo::RelCandidateVersion, "release-candidate/:platform:", "" }, + { ServerInfo::RelCandidateUrl, "release-candidate/:platform:", "" }, + { ServerInfo::CurStatus, "status/:platform:", "-1" }, + { ServerInfo::ManualPdfUrl, "", "" }, + { ServerInfo::ManualHtmlUrl, "", "" }, + { ServerInfo::ManualZipUrl, "", "" }, + { ServerInfo::BleedingRevision, "bleeding/rev", "" }, + { ServerInfo::BleedingDate, "bleeding/timestamp", "" }, + { ServerInfo::CurDevelUrl, "", "" }, }; QMap<QString, QVariant> ServerInfo::serverInfos; @@ -73,13 +74,10 @@ QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform) // get value QVariant value = QString(); if(!s.isEmpty() && serverSettings) - value = serverSettings->value(s, ""); + value = serverSettings->value(s, ServerInfoList[i].def); // depending on the actual value we need more replacements. switch(info) { - case ServerInfo::CurStatus: - value = ServerInfo::statusToString(value.toInt()); - break; case CurReleaseVersion: case RelCandidateVersion: value = value.toStringList().at(0); |