summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/serverinfo.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-11-14 16:23:56 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-11-14 16:42:29 +0100
commit2509def164ee7f4aecbe6a786df57140f19e35f2 (patch)
tree63a7396e1b94482f9f05c3f3abf6c7cd77e10d26 /rbutil/rbutilqt/base/serverinfo.cpp
parent440083af872da43c116c5374d8e1511cef65abf2 (diff)
downloadrockbox-2509def164ee7f4aecbe6a786df57140f19e35f2.tar.gz
rockbox-2509def164ee7f4aecbe6a786df57140f19e35f2.tar.bz2
rockbox-2509def164ee7f4aecbe6a786df57140f19e35f2.zip
rbutil: Rework player configuration.
- Split internal configuration into player specific and common parts. Always require passing the player for player specific data instead of implicitly assuming the currently selected one; only use the currently selected one if the player name is explicitly passed as empty. - Similarly adjust handling of server info data; prepare for splitting into build type specific values so the naming becomes cleaner. Change-Id: I894e694f83bd9fe2d22ad46b3f8f7df3e2c68033
Diffstat (limited to 'rbutil/rbutilqt/base/serverinfo.cpp')
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp56
1 files changed, 20 insertions, 36 deletions
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp
index 98a94a5232..505689847d 100644
--- a/rbutil/rbutilqt/base/serverinfo.cpp
+++ b/rbutil/rbutilqt/base/serverinfo.cpp
@@ -51,9 +51,9 @@ void ServerInfo::readBuildInfo(QString file)
QSettings info(file, QSettings::IniFormat);
QString developmentRevision = info.value("bleeding/rev").toString();
- setValue(ServerInfo::BleedingRevision, developmentRevision);
+ setPlatformValue(ServerInfo::BleedingRevision, "", developmentRevision);
QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ");
- setValue(ServerInfo::BleedingDate, date.toString(Qt::ISODate));
+ setPlatformValue(ServerInfo::BleedingDate, "", date.toString(Qt::ISODate));
info.beginGroup("release");
QStringList releasekeys = info.allKeys();
@@ -135,10 +135,10 @@ void ServerInfo::readBuildInfo(QString file)
QString manualHtmlUrl = manualBaseUrl;
QString manualZipUrl = manualBaseUrl;
- QString buildservermodel = SystemInfo::platformValue(platforms.at(i),
- SystemInfo::CurBuildserverModel).toString();
- QString modelman = SystemInfo::platformValue(platforms.at(i),
- SystemInfo::CurManual).toString();
+ QString buildservermodel = SystemInfo::platformValue(
+ SystemInfo::CurBuildserverModel, platforms.at(i)).toString();
+ QString modelman = SystemInfo::platformValue(
+ SystemInfo::CurManual, platforms.at(i)).toString();
QString manualBaseName = "rockbox-";
if(modelman.isEmpty()) manualBaseName += buildservermodel;
@@ -153,45 +153,26 @@ void ServerInfo::readBuildInfo(QString file)
// set variants (if any)
for(int j = 0; j < variants.size(); ++j) {
- setPlatformValue(variants.at(j), ServerInfo::CurStatus, status);
+ setPlatformValue(ServerInfo::CurStatus, variants.at(j), status);
if(!releaseUrl.isEmpty()) {
- setPlatformValue(variants.at(j), ServerInfo::CurReleaseVersion, releaseVersion);
- setPlatformValue(variants.at(j), ServerInfo::CurReleaseUrl, releaseUrl);
+ setPlatformValue(ServerInfo::CurReleaseVersion, variants.at(j), releaseVersion);
+ setPlatformValue(ServerInfo::CurReleaseUrl, variants.at(j), releaseUrl);
}
if(!relCandidateUrl.isEmpty()) {
- setPlatformValue(variants.at(j), ServerInfo::RelCandidateVersion, relCandidateVersion);
- setPlatformValue(variants.at(j), ServerInfo::RelCandidateUrl, relCandidateUrl);
+ setPlatformValue(ServerInfo::RelCandidateVersion, variants.at(j), relCandidateVersion);
+ setPlatformValue(ServerInfo::RelCandidateUrl, variants.at(j), relCandidateUrl);
}
- setPlatformValue(variants.at(j), ServerInfo::CurDevelUrl, develUrl);
+ setPlatformValue(ServerInfo::CurDevelUrl, variants.at(j), develUrl);
- setPlatformValue(variants.at(j), ServerInfo::ManualPdfUrl, manualPdfUrl);
- setPlatformValue(variants.at(j), ServerInfo::ManualHtmlUrl, manualHtmlUrl);
- setPlatformValue(variants.at(j), ServerInfo::ManualZipUrl, manualZipUrl);
+ setPlatformValue(ServerInfo::ManualPdfUrl, variants.at(j), manualPdfUrl);
+ setPlatformValue(ServerInfo::ManualHtmlUrl, variants.at(j), manualHtmlUrl);
+ setPlatformValue(ServerInfo::ManualZipUrl, variants.at(j), manualZipUrl);
}
}
}
-QVariant ServerInfo::value(enum ServerInfos info)
-{
- // locate info item
- int i = 0;
- while(ServerInfoList[i].info != info)
- i++;
-
- QString s = ServerInfoList[i].name;
- s.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
- LOG_INFO() << "GET:" << s << serverInfos.value(s, ServerInfoList[i].def).toString();
- return serverInfos.value(s, ServerInfoList[i].def);
-}
-
-void ServerInfo::setValue(enum ServerInfos setting, QVariant value)
-{
- QString empty;
- return setPlatformValue(empty, setting, value);
-}
-
-void ServerInfo::setPlatformValue(QString platform, enum ServerInfos info, QVariant value)
+void ServerInfo::setPlatformValue(enum ServerInfos info, QString platform, QVariant value)
{
// locate setting item
int i = 0;
@@ -204,13 +185,16 @@ void ServerInfo::setPlatformValue(QString platform, enum ServerInfos info, QVari
LOG_INFO() << "SET:" << s << serverInfos.value(s).toString();
}
-QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
+QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform)
{
// locate setting item
int i = 0;
while(ServerInfoList[i].info != info)
i++;
+ if(platform.isEmpty())
+ platform = RbSettings::value(RbSettings::CurrentPlatform).toString();
+
QString s = ServerInfoList[i].name;
s.replace(":platform:", platform);
QString d = ServerInfoList[i].def;