summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/serverinfo.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-17 10:30:19 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-17 10:30:19 +0200
commit94555a0b08534ba6345d8ba65eef808b6e3d1dca (patch)
tree7184edd46f55edf86bbc5dfb39580fc8dcce0696 /rbutil/rbutilqt/base/serverinfo.cpp
parentc2246905a269d1b066b5778610b5705999d9790f (diff)
downloadrockbox-94555a0b08534ba6345d8ba65eef808b6e3d1dca.tar.gz
rockbox-94555a0b08534ba6345d8ba65eef808b6e3d1dca.tar.bz2
rockbox-94555a0b08534ba6345d8ba65eef808b6e3d1dca.zip
Move download URL construction to ServerInfo.
Centralize creating the URLs so it's not duplicated in two places. This also allows to change the representation on the server more easily, since it only requires changes in one place. Currently only changes URLs for Rockbox builds. Change-Id: I87277cd61f8b164bdbcd914c9873d674661a786c
Diffstat (limited to 'rbutil/rbutilqt/base/serverinfo.cpp')
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp
index b60245c3d5..4abaeb2aa7 100644
--- a/rbutil/rbutilqt/base/serverinfo.cpp
+++ b/rbutil/rbutilqt/base/serverinfo.cpp
@@ -31,20 +31,27 @@ const static struct {
const char* def;
} ServerInfoList[] = {
{ ServerInfo::CurReleaseVersion, ":platform:/releaseversion", "" },
+ { ServerInfo::CurReleaseUrl, ":platform:/releaseurl", "" },
{ ServerInfo::CurStatus, ":platform:/status", "Unknown" },
{ ServerInfo::BleedingRevision, "bleedingrev", "" },
{ ServerInfo::BleedingDate, "bleedingdate", "" },
+ { ServerInfo::CurDevelUrl, ":platform:/develurl", "" },
};
QMap<QString, QVariant> ServerInfo::serverInfos;
void ServerInfo::readBuildInfo(QString file)
{
+ QString releaseBaseUrl = SystemInfo::value(SystemInfo::ReleaseUrl).toString();
+ QString develBaseUrl = SystemInfo::value(SystemInfo::BleedingUrl).toString();
+ QString manualBaseUrl = SystemInfo::value(SystemInfo::ManualUrl).toString();
+
QSettings info(file, QSettings::IniFormat);
- setValue(ServerInfo::BleedingRevision,info.value("bleeding/rev"));
+ QString developmentRevision = info.value("bleeding/rev").toString();
+ setValue(ServerInfo::BleedingRevision, developmentRevision);
QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ");
- setValue(ServerInfo::BleedingDate,date.toString(Qt::ISODate));
+ setValue(ServerInfo::BleedingDate, date.toString(Qt::ISODate));
info.beginGroup("release");
QStringList keys = info.allKeys();
@@ -58,13 +65,18 @@ void ServerInfo::readBuildInfo(QString file)
// them the same time.
QStringList variants;
variants = SystemInfo::platforms(SystemInfo::PlatformVariantDisabled, platforms.at(i));
- QVariant release;
+ QString releaseVersion;
+ QString releaseUrl;
info.beginGroup("release");
if(keys.contains(platforms.at(i))) {
- release = info.value(platforms.at(i));
+ releaseVersion = info.value(platforms.at(i)).toString();
+ // construct release download URL
+ releaseUrl = releaseBaseUrl;
+ releaseUrl.replace("%MODEL%", platforms.at(i));
+ releaseUrl.replace("%RELVERSION%", releaseVersion);
}
-
info.endGroup();
+
info.beginGroup("status");
QString status = tr("Unknown");
switch(info.value(platforms.at(i)).toInt())
@@ -82,10 +94,19 @@ void ServerInfo::readBuildInfo(QString file)
break;
}
info.endGroup();
+ // release and development URLs are not provided by the server but
+ // constructed.
+ QString develUrl = develBaseUrl;
+ develUrl.replace("%MODEL%", platforms.at(i));
+ develUrl.replace("%RELVERSION%", developmentRevision);
// set variants (if any)
for(int j = 0; j < variants.size(); ++j) {
setPlatformValue(variants.at(j), ServerInfo::CurStatus, status);
- setPlatformValue(variants.at(j), ServerInfo::CurReleaseVersion, release);
+ if(!releaseUrl.isEmpty()) {
+ setPlatformValue(variants.at(j), ServerInfo::CurReleaseVersion, releaseVersion);
+ setPlatformValue(variants.at(j), ServerInfo::CurReleaseUrl, releaseUrl);
+ }
+ setPlatformValue(variants.at(j), ServerInfo::CurDevelUrl, develUrl);
}
}
}