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) | |
download | rockbox-dec5421ca2cb5ac9e77ce96507d0285a6b0fcfee.tar.gz rockbox-dec5421ca2cb5ac9e77ce96507d0285a6b0fcfee.zip |
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; | |||
27 | const static struct { | 27 | const static struct { |
28 | ServerInfo::ServerInfos info; | 28 | ServerInfo::ServerInfos info; |
29 | const char* name; | 29 | const char* name; |
30 | const char* def; | ||
30 | } ServerInfoList[] = { | 31 | } ServerInfoList[] = { |
31 | { ServerInfo::CurReleaseVersion, "release/:platform:" }, | 32 | { ServerInfo::CurReleaseVersion, "release/:platform:", "" }, |
32 | { ServerInfo::CurReleaseUrl, "release/:platform:" }, | 33 | { ServerInfo::CurReleaseUrl, "release/:platform:", "" }, |
33 | { ServerInfo::RelCandidateVersion, "release-candidate/:platform:" }, | 34 | { ServerInfo::RelCandidateVersion, "release-candidate/:platform:", "" }, |
34 | { ServerInfo::RelCandidateUrl, "release-candidate/:platform:" }, | 35 | { ServerInfo::RelCandidateUrl, "release-candidate/:platform:", "" }, |
35 | { ServerInfo::CurStatus, "status/:platform:" }, | 36 | { ServerInfo::CurStatus, "status/:platform:", "-1" }, |
36 | { ServerInfo::ManualPdfUrl, "" }, | 37 | { ServerInfo::ManualPdfUrl, "", "" }, |
37 | { ServerInfo::ManualHtmlUrl, "" }, | 38 | { ServerInfo::ManualHtmlUrl, "", "" }, |
38 | { ServerInfo::ManualZipUrl, "" }, | 39 | { ServerInfo::ManualZipUrl, "", "" }, |
39 | { ServerInfo::BleedingRevision, "bleeding/rev" }, | 40 | { ServerInfo::BleedingRevision, "bleeding/rev", "" }, |
40 | { ServerInfo::BleedingDate, "bleeding/timestamp" }, | 41 | { ServerInfo::BleedingDate, "bleeding/timestamp", "" }, |
41 | { ServerInfo::CurDevelUrl, "" }, | 42 | { ServerInfo::CurDevelUrl, "", "" }, |
42 | }; | 43 | }; |
43 | 44 | ||
44 | QMap<QString, QVariant> ServerInfo::serverInfos; | 45 | QMap<QString, QVariant> ServerInfo::serverInfos; |
@@ -73,13 +74,10 @@ QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform) | |||
73 | // get value | 74 | // get value |
74 | QVariant value = QString(); | 75 | QVariant value = QString(); |
75 | if(!s.isEmpty() && serverSettings) | 76 | if(!s.isEmpty() && serverSettings) |
76 | value = serverSettings->value(s, ""); | 77 | value = serverSettings->value(s, ServerInfoList[i].def); |
77 | 78 | ||
78 | // depending on the actual value we need more replacements. | 79 | // depending on the actual value we need more replacements. |
79 | switch(info) { | 80 | switch(info) { |
80 | case ServerInfo::CurStatus: | ||
81 | value = ServerInfo::statusToString(value.toInt()); | ||
82 | break; | ||
83 | case CurReleaseVersion: | 81 | case CurReleaseVersion: |
84 | case RelCandidateVersion: | 82 | case RelCandidateVersion: |
85 | value = value.toStringList().at(0); | 83 | value = value.toStringList().at(0); |