summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp28
-rw-r--r--rbutil/rbutilqt/configure.cpp4
-rw-r--r--rbutil/rbutilqt/gui/selectiveinstallwidget.cpp2
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp2
-rw-r--r--rbutil/rbutilqt/test/test-serverinfo.cpp8
5 files changed, 21 insertions, 23 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);
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index d18f438801..d4457a34ed 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -386,8 +386,8 @@ void Config::setDevices()
// construct display name
QString curname = SystemInfo::platformValue(
SystemInfo::Name, platformList.at(it)).toString() +
- " (" +ServerInfo::platformValue(
- ServerInfo::CurStatus, platformList.at(it)).toString() +")";
+ " (" + ServerInfo::statusToString(ServerInfo::platformValue(
+ ServerInfo::CurStatus, platformList.at(it)).toInt()) +")";
LOG_INFO() << "add supported device:" << brands.at(c) << curname;
w2 = new QTreeWidgetItem(w, QStringList(curname));
w2->setData(0, Qt::UserRole, platformList.at(it));
diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp
index 065a139436..f875844c9c 100644
--- a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp
+++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp
@@ -93,7 +93,7 @@ void SelectiveInstallWidget::updateVersion(void)
m_versions.clear();
m_versions.insert("release", ServerInfo::platformValue(ServerInfo::CurReleaseVersion).toString());
// Don't populate RC or development selections if target has been retired.
- if (ServerInfo::platformValue(ServerInfo::CurStatus) != tr("Stable (Retired)")) {
+ if (ServerInfo::platformValue(ServerInfo::CurStatus).toInt() != STATUS_RETIRED) {
m_versions.insert("development", ServerInfo::platformValue(ServerInfo::BleedingRevision).toString());
m_versions.insert("rc", ServerInfo::platformValue(ServerInfo::RelCandidateVersion).toString());
}
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index ae28ee4e70..0fb2ba562e 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -408,7 +408,7 @@ void RbUtilQt::updateDevice()
QString brand = SystemInfo::platformValue(SystemInfo::Brand).toString();
QString name
= QString("%1 (%2)").arg(SystemInfo::platformValue(SystemInfo::Name).toString(),
- ServerInfo::platformValue(ServerInfo::CurStatus).toString());
+ ServerInfo::statusToString(ServerInfo::platformValue(ServerInfo::CurStatus).toInt()));
ui.labelDevice->setText(QString("<b>%1 %2</b>").arg(brand, name));
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
diff --git a/rbutil/rbutilqt/test/test-serverinfo.cpp b/rbutil/rbutilqt/test/test-serverinfo.cpp
index 9aa8306e50..bda939676c 100644
--- a/rbutil/rbutilqt/test/test-serverinfo.cpp
+++ b/rbutil/rbutilqt/test/test-serverinfo.cpp
@@ -65,21 +65,21 @@ struct testvector {
const struct testvector testdata[] =
{
{ "archosfmrecorder", ServerInfo::CurReleaseVersion, "3.11.2" },
- { "archosfmrecorder", ServerInfo::CurStatus, "Stable" },
+ { "archosfmrecorder", ServerInfo::CurStatus, "3" },
{ "iaudiom3", ServerInfo::CurReleaseVersion, "3.11.2" },
{ "iaudiom3", ServerInfo::CurReleaseUrl, "http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip" },
{ "sansae200", ServerInfo::CurReleaseVersion, "3.11.2" },
{ "sansae200", ServerInfo::CurReleaseUrl, "https://unittest/release/3.11.2/rockbox-sansae200-3.11.2.zip" },
{ "iriverh100", ServerInfo::CurReleaseVersion, "3.11.2" },
{ "iriverh100", ServerInfo::CurReleaseUrl, "http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip" },
- { "iriverh100", ServerInfo::CurStatus, "Unstable" },
+ { "iriverh100", ServerInfo::CurStatus, "2" },
{ "iriverh100", ServerInfo::CurDevelUrl, "https://unittest/dev/rockbox-iriverh100.zip" },
{ "iriverh300", ServerInfo::CurReleaseVersion, "" },
{ "iriverh300", ServerInfo::CurReleaseUrl, "" },
- { "iriverh300", ServerInfo::CurStatus, "Unusable" },
+ { "iriverh300", ServerInfo::CurStatus, "1" },
{ "iriverh10", ServerInfo::CurReleaseVersion, "" },
{ "iriverh10", ServerInfo::CurReleaseUrl, "" },
- { "iriverh10", ServerInfo::CurStatus, "Stable (Retired)" },
+ { "iriverh10", ServerInfo::CurStatus, "0" },
{ "gigabeatfx", ServerInfo::RelCandidateVersion, "f9dce96" },
{ "gigabeatfx", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip" },
{ "archosfmrecorder", ServerInfo::RelCandidateVersion, "f9dce96" },