From b064a6cbb58a0db1a70fbac2e82242ce0c7509b1 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 28 Nov 2020 20:47:28 +0100 Subject: rbutil: Rework and merge player and build server info handling. Handling the data for players from rbutil.ini and the build-info data from the server is closely related. Splitting things up into different classes only creates tightly coupling, which is unnecessary, and the need to differentiate between them in the application. Merge both classes into a single one and rework handling so the application doesn't have to deal with two separate classes anymore. Furthermore, change URL templates to use new values from build-info instead of hard coding them. Change-Id: Ica550973ce23d1559110782add52bc214eba552d --- rbutil/rbutilqt/base/systeminfo.cpp | 85 ------------------------------------- 1 file changed, 85 deletions(-) (limited to 'rbutil/rbutilqt/base/systeminfo.cpp') diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp index 8868ba937b..aa847540b9 100644 --- a/rbutil/rbutilqt/base/systeminfo.cpp +++ b/rbutil/rbutilqt/base/systeminfo.cpp @@ -23,44 +23,6 @@ #include "Logger.h" // device settings -const static struct { - SystemInfo::SystemInfos info; - const char* name; -} SystemInfosList[] = { - { 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 { - SystemInfo::PlatformInfo info; - const char* name; - const char* def; -} PlatformInfosList[] = { - { SystemInfo::Manual, ":platform:/manualname", ":platform:" }, - { SystemInfo::BootloaderMethod, ":platform:/bootloadermethod", "none" }, - { SystemInfo::BootloaderName, ":platform:/bootloadername", "" }, - { SystemInfo::BootloaderFile, ":platform:/bootloaderfile", "" }, - { SystemInfo::BootloaderFilter, ":platform:/bootloaderfilter", "" }, - { SystemInfo::Encoder, ":platform:/encoder", "" }, - { SystemInfo::Brand, ":platform:/brand", "" }, - { SystemInfo::Name, ":platform:/name", "" }, - { SystemInfo::PlayerPicture, ":platform:/playerpic", "" }, -}; //! pointer to setting object to nullptr QSettings* SystemInfo::systemInfos = nullptr; @@ -76,53 +38,6 @@ void SystemInfo::ensureSystemInfoExists() } -QVariant SystemInfo::value(enum SystemInfos info, BuildType type) -{ - ensureSystemInfoExists(); - - // locate setting item - int i = 0; - 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); -} - -QVariant SystemInfo::platformValue(enum PlatformInfo info, QString platform) -{ - ensureSystemInfoExists(); - - // locate setting item - int i = 0; - while(PlatformInfosList[i].info != info) - i++; - - if (platform.isEmpty()) - platform = RbSettings::value(RbSettings::CurrentPlatform).toString(); - - QString s = PlatformInfosList[i].name; - s.replace(":platform:", platform); - QString d = PlatformInfosList[i].def; - d.replace(":platform:", platform); - LOG_INFO() << "GET P:" << s << systemInfos->value(s, d).toString(); - return systemInfos->value(s, d); -} - QStringList SystemInfo::platforms(enum SystemInfo::PlatformType type, QString variant) { ensureSystemInfoExists(); -- cgit v1.2.3