summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/serverinfo.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-01-31 21:57:45 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-01-31 21:57:45 +0000
commitea4130fd2d91d99fec3135bc83128fe702a846ab (patch)
treed5d677b796200036eae47721290a13145b628982 /rbutil/rbutilqt/base/serverinfo.cpp
parente9538363286e22bf21be1f8b3d5a4e83cdc2e4a4 (diff)
downloadrockbox-ea4130fd2d91d99fec3135bc83128fe702a846ab.tar.gz
rockbox-ea4130fd2d91d99fec3135bc83128fe702a846ab.tar.bz2
rockbox-ea4130fd2d91d99fec3135bc83128fe702a846ab.zip
Extend SystemInfo to allow distinguishing between platforms and variants.
Doing so removes the need to loop over all targets to fill in values for target variants in ServerInfo. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24427 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/serverinfo.cpp')
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp53
1 files changed, 28 insertions, 25 deletions
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp
index e54fd03f8a..e581e952ac 100644
--- a/rbutil/rbutilqt/base/serverinfo.cpp
+++ b/rbutil/rbutilqt/base/serverinfo.cpp
@@ -51,33 +51,47 @@ void ServerInfo::readBuildInfo(QString file)
info.beginGroup("release");
QStringList keys = info.allKeys();
- for(int i=0; i < keys.size(); i++)
- {
- setAllConfigPlatformValue(keys[i],ServerInfo::CurReleaseVersion,info.value(keys[i]));
- }
info.endGroup();
- info.beginGroup("status");
- keys = info.allKeys();
- for(int i=0; i < keys.size(); i++)
+ // get base platforms, handle variants with platforms in the loop
+ QStringList platforms = SystemInfo::platforms(SystemInfo::PlatformBase);
+ for(int i = 0; i < platforms.size(); i++)
{
- switch(info.value(keys[i]).toInt())
+ // check if there are rbutil-variants of the current platform and handle
+ // them the same time.
+ QStringList variants;
+ variants = SystemInfo::platforms(SystemInfo::PlatformVariant, platforms.at(i));
+ QVariant release;
+ info.beginGroup("release");
+ if(keys.contains(platforms.at(i))) {
+ release = info.value(platforms.at(i));
+ }
+
+ info.endGroup();
+ info.beginGroup("status");
+ QString status = tr("Unknown");
+ switch(info.value(platforms.at(i)).toInt())
{
case 1:
- ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unusable"));
+ status = tr("Unusable");
break;
case 2:
- ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unstable"));
+ status = tr("Unstable");
break;
case 3:
- ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Stable"));
+ status = tr("Stable");
break;
- default:
- ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unknown"));
+ default:
break;
}
+ info.endGroup();
+ // 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);
+ }
+
}
- info.endGroup();
}
void ServerInfo::readBleedingInfo(QString file)
@@ -121,17 +135,6 @@ void ServerInfo::setPlatformValue(QString platform, enum ServerInfos info, QVari
qDebug() << "[ServerInfo] SET:" << s << serverInfos.value(s).toString();
}
-void ServerInfo::setAllConfigPlatformValue(QString configplatform, ServerInfos info, QVariant value)
-{
- // insert intp all platforms where configurename matches
- QStringList platforms = SystemInfo::platforms();
- for(int i =0; i < platforms.size(); i++)
- {
- if(SystemInfo::platformValue(platforms.at(i),SystemInfo::CurConfigureModel) == configplatform)
- setPlatformValue(platforms.at(i),info,value);
- }
-}
-
QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
{
// locate setting item