summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-11-13 21:53:53 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-11-22 14:43:01 +0100
commitad37655687cd4861681e561b2a84fabb5c307327 (patch)
tree1cdc0a1e3fd5c810b8af288907395ee00cdaf366 /rbutil/rbutilqt/base
parent6b3b4df6f64f1523b76d5f4f26c568ffc208a899 (diff)
downloadrockbox-ad37655687cd4861681e561b2a84fabb5c307327.tar.gz
rockbox-ad37655687cd4861681e561b2a84fabb5c307327.zip
rbutil: Use pattern replacement for SystemInfo build type.
Use pattern replacement for lookup instead of expanded values. Will allow simplifying things later for better handling of different build types. Change-Id: Iaad67a6c8654d27c3206cf95a379acab169565bc
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp9
-rw-r--r--rbutil/rbutilqt/base/systeminfo.cpp55
-rw-r--r--rbutil/rbutilqt/base/systeminfo.h19
3 files changed, 49 insertions, 34 deletions
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp
index 08f7f770b7..2f73d96beb 100644
--- a/rbutil/rbutilqt/base/serverinfo.cpp
+++ b/rbutil/rbutilqt/base/serverinfo.cpp
@@ -95,17 +95,20 @@ QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform)
if(value.toStringList().size() > 1)
value = value.toStringList().at(1);
else if(!version.isEmpty() && info == CurReleaseUrl)
- value = SystemInfo::value(SystemInfo::ReleaseUrl).toString()
+ value = SystemInfo::value(SystemInfo::BuildUrl,
+ SystemInfo::BuildRelease).toString()
.replace("%MODEL%", platform)
.replace("%RELVERSION%", version);
else if(!version.isEmpty() && info == RelCandidateUrl)
- value = SystemInfo::value(SystemInfo::CandidateUrl).toString()
+ value = SystemInfo::value(SystemInfo::BuildUrl,
+ SystemInfo::BuildCandidate).toString()
.replace("%MODEL%", platform)
.replace("%RELVERSION%", version);
}
break;
case CurDevelUrl:
- value = SystemInfo::value(SystemInfo::BleedingUrl).toString()
+ value = SystemInfo::value(SystemInfo::BuildUrl,
+ SystemInfo::BuildCurrent).toString()
.replace("%MODEL%", platform);
break;
case ManualPdfUrl:
diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp
index 67b0428ceb..2aece49110 100644
--- a/rbutil/rbutilqt/base/systeminfo.cpp
+++ b/rbutil/rbutilqt/base/systeminfo.cpp
@@ -27,28 +27,23 @@ const static struct {
SystemInfo::SystemInfos info;
const char* name;
} SystemInfosList[] = {
- { SystemInfo::ManualUrl, "manual_url" },
- { SystemInfo::BleedingUrl, "bleeding_url" },
- { SystemInfo::BootloaderUrl, "bootloader_url" },
- { SystemInfo::BootloaderInfoUrl, "bootloader_info_url" },
- { SystemInfo::ReleaseFontUrl, "release_font_url" },
- { SystemInfo::DailyFontUrl, "daily_font_url" },
- { SystemInfo::DailyVoiceUrl, "daily_voice_url" },
- { SystemInfo::ReleaseVoiceUrl, "release_voice_url" },
- { SystemInfo::DoomUrl, "doom_url" },
- { SystemInfo::Duke3DUrl, "duke3d_url" },
- { SystemInfo::PuzzFontsUrl, "puzzfonts_url" },
- { SystemInfo::QuakeUrl, "quake_url" },
- { SystemInfo::Wolf3DUrl, "wolf3d_url" },
- { SystemInfo::XWorldUrl, "xworld_url" },
- { SystemInfo::ReleaseUrl, "release_url" },
- { SystemInfo::CandidateUrl, "rc_url" },
- { SystemInfo::DailyUrl, "daily_url" },
- { SystemInfo::BuildInfoUrl, "build_info_url" },
- { SystemInfo::GenlangUrl, "genlang_url" },
- { SystemInfo::ThemesUrl, "themes_url" },
- { SystemInfo::ThemesInfoUrl, "themes_info_url" },
- { SystemInfo::RbutilUrl, "rbutil_url" },
+ { SystemInfo::ManualUrl, ":build:/manual_url" },
+ { SystemInfo::BuildUrl, ":build:/build_url" },
+ { SystemInfo::FontUrl, ":build:/font_url" },
+ { SystemInfo::VoiceUrl, ":build:/voice_url" },
+ { SystemInfo::BootloaderUrl, "bootloader/download_url" },
+ { SystemInfo::BootloaderInfoUrl, "bootloader/info_url" },
+ { SystemInfo::DoomUrl, "doom_url" },
+ { SystemInfo::Duke3DUrl, "duke3d_url" },
+ { SystemInfo::PuzzFontsUrl, "puzzfonts_url" },
+ { SystemInfo::QuakeUrl, "quake_url" },
+ { SystemInfo::Wolf3DUrl, "wolf3d_url" },
+ { SystemInfo::XWorldUrl, "xworld_url" },
+ { SystemInfo::BuildInfoUrl, "build_info_url" },
+ { SystemInfo::GenlangUrl, "genlang_url" },
+ { SystemInfo::ThemesUrl, "themes_url" },
+ { SystemInfo::ThemesInfoUrl, "themes_info_url" },
+ { SystemInfo::RbutilUrl, "rbutil_url" },
};
const static struct {
@@ -84,7 +79,7 @@ void SystemInfo::ensureSystemInfoExists()
}
-QVariant SystemInfo::value(enum SystemInfos info)
+QVariant SystemInfo::value(enum SystemInfos info, BuildType type)
{
ensureSystemInfoExists();
@@ -93,6 +88,20 @@ QVariant SystemInfo::value(enum SystemInfos info)
while(SystemInfosList[i].info != info)
i++;
QString s = SystemInfosList[i].name;
+ switch(type) {
+ case BuildDaily:
+ s.replace(":build:", "daily");
+ break;
+ case BuildCurrent:
+ s.replace(":build:", "development");
+ break;
+ case BuildCandidate:
+ s.replace(":build:", "release-candidate");
+ break;
+ case BuildRelease:
+ s.replace(":build:", "release");
+ break;
+ }
LOG_INFO() << "GET:" << s << systemInfos->value(s).toString();
return systemInfos->value(s);
}
diff --git a/rbutil/rbutilqt/base/systeminfo.h b/rbutil/rbutilqt/base/systeminfo.h
index c4afe4b27d..12b9eb4bfb 100644
--- a/rbutil/rbutilqt/base/systeminfo.h
+++ b/rbutil/rbutilqt/base/systeminfo.h
@@ -34,15 +34,21 @@ class SystemInfo : public QObject
MapIncompatible,
};
+ enum BuildType {
+ BuildCurrent,
+ BuildDaily,
+ BuildRelease,
+ BuildCandidate
+ };
+
//! All system settings
enum SystemInfos {
+ BuildUrl,
+ FontUrl,
+ VoiceUrl,
ManualUrl,
- BleedingUrl,
BootloaderUrl,
BootloaderInfoUrl,
- DailyUrl,
- DailyFontUrl,
- DailyVoiceUrl,
DoomUrl,
Duke3DUrl,
QuakeUrl,
@@ -50,9 +56,6 @@ class SystemInfo : public QObject
Wolf3DUrl,
XWorldUrl,
ReleaseUrl,
- CandidateUrl,
- ReleaseVoiceUrl,
- ReleaseFontUrl,
BuildInfoUrl,
GenlangUrl,
ThemesUrl,
@@ -92,7 +95,7 @@ class SystemInfo : public QObject
//! returns a map of usb-ids and their targets
static QMap<int, QStringList> usbIdMap(enum MapType type);
//! get a value from system settings
- static QVariant value(enum SystemInfos info);
+ static QVariant value(enum SystemInfos info, BuildType type = BuildCurrent);
//! get a value from system settings for a named platform.
static QVariant platformValue(enum PlatformInfo info, QString platform = "");