diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-11-28 20:47:28 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-12-03 22:25:12 +0100 |
commit | b064a6cbb58a0db1a70fbac2e82242ce0c7509b1 (patch) | |
tree | c9090d367d237cbd408afbd24d5809e55a1a2653 /rbutil/rbutilqt/base/systeminfo.cpp | |
parent | 78a01db47cac5fa67aeee6f1c5134f89c3e4944a (diff) | |
download | rockbox-b064a6cbb58a0db1a70fbac2e82242ce0c7509b1.tar.gz rockbox-b064a6cbb58a0db1a70fbac2e82242ce0c7509b1.zip |
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
Diffstat (limited to 'rbutil/rbutilqt/base/systeminfo.cpp')
-rw-r--r-- | rbutil/rbutilqt/base/systeminfo.cpp | 85 |
1 files changed, 0 insertions, 85 deletions
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 @@ | |||
23 | #include "Logger.h" | 23 | #include "Logger.h" |
24 | 24 | ||
25 | // device settings | 25 | // device settings |
26 | const static struct { | ||
27 | SystemInfo::SystemInfos info; | ||
28 | const char* name; | ||
29 | } SystemInfosList[] = { | ||
30 | { SystemInfo::ManualUrl, ":build:/manual_url" }, | ||
31 | { SystemInfo::BuildUrl, ":build:/build_url" }, | ||
32 | { SystemInfo::FontUrl, ":build:/font_url" }, | ||
33 | { SystemInfo::VoiceUrl, ":build:/voice_url" }, | ||
34 | { SystemInfo::BootloaderUrl, "bootloader/download_url" }, | ||
35 | { SystemInfo::BootloaderInfoUrl, "bootloader/info_url" }, | ||
36 | { SystemInfo::DoomUrl, "doom_url" }, | ||
37 | { SystemInfo::Duke3DUrl, "duke3d_url" }, | ||
38 | { SystemInfo::PuzzFontsUrl, "puzzfonts_url" }, | ||
39 | { SystemInfo::QuakeUrl, "quake_url" }, | ||
40 | { SystemInfo::Wolf3DUrl, "wolf3d_url" }, | ||
41 | { SystemInfo::XWorldUrl, "xworld_url" }, | ||
42 | { SystemInfo::BuildInfoUrl, "build_info_url" }, | ||
43 | { SystemInfo::GenlangUrl, "genlang_url" }, | ||
44 | { SystemInfo::ThemesUrl, "themes_url" }, | ||
45 | { SystemInfo::ThemesInfoUrl, "themes_info_url" }, | ||
46 | { SystemInfo::RbutilUrl, "rbutil_url" }, | ||
47 | }; | ||
48 | |||
49 | const static struct { | ||
50 | SystemInfo::PlatformInfo info; | ||
51 | const char* name; | ||
52 | const char* def; | ||
53 | } PlatformInfosList[] = { | ||
54 | { SystemInfo::Manual, ":platform:/manualname", ":platform:" }, | ||
55 | { SystemInfo::BootloaderMethod, ":platform:/bootloadermethod", "none" }, | ||
56 | { SystemInfo::BootloaderName, ":platform:/bootloadername", "" }, | ||
57 | { SystemInfo::BootloaderFile, ":platform:/bootloaderfile", "" }, | ||
58 | { SystemInfo::BootloaderFilter, ":platform:/bootloaderfilter", "" }, | ||
59 | { SystemInfo::Encoder, ":platform:/encoder", "" }, | ||
60 | { SystemInfo::Brand, ":platform:/brand", "" }, | ||
61 | { SystemInfo::Name, ":platform:/name", "" }, | ||
62 | { SystemInfo::PlayerPicture, ":platform:/playerpic", "" }, | ||
63 | }; | ||
64 | 26 | ||
65 | //! pointer to setting object to nullptr | 27 | //! pointer to setting object to nullptr |
66 | QSettings* SystemInfo::systemInfos = nullptr; | 28 | QSettings* SystemInfo::systemInfos = nullptr; |
@@ -76,53 +38,6 @@ void SystemInfo::ensureSystemInfoExists() | |||
76 | } | 38 | } |
77 | 39 | ||
78 | 40 | ||
79 | QVariant SystemInfo::value(enum SystemInfos info, BuildType type) | ||
80 | { | ||
81 | ensureSystemInfoExists(); | ||
82 | |||
83 | // locate setting item | ||
84 | int i = 0; | ||
85 | while(SystemInfosList[i].info != info) | ||
86 | i++; | ||
87 | QString s = SystemInfosList[i].name; | ||
88 | switch(type) { | ||
89 | case BuildDaily: | ||
90 | s.replace(":build:", "daily"); | ||
91 | break; | ||
92 | case BuildCurrent: | ||
93 | s.replace(":build:", "development"); | ||
94 | break; | ||
95 | case BuildCandidate: | ||
96 | s.replace(":build:", "release-candidate"); | ||
97 | break; | ||
98 | case BuildRelease: | ||
99 | s.replace(":build:", "release"); | ||
100 | break; | ||
101 | } | ||
102 | LOG_INFO() << "GET:" << s << systemInfos->value(s).toString(); | ||
103 | return systemInfos->value(s); | ||
104 | } | ||
105 | |||
106 | QVariant SystemInfo::platformValue(enum PlatformInfo info, QString platform) | ||
107 | { | ||
108 | ensureSystemInfoExists(); | ||
109 | |||
110 | // locate setting item | ||
111 | int i = 0; | ||
112 | while(PlatformInfosList[i].info != info) | ||
113 | i++; | ||
114 | |||
115 | if (platform.isEmpty()) | ||
116 | platform = RbSettings::value(RbSettings::CurrentPlatform).toString(); | ||
117 | |||
118 | QString s = PlatformInfosList[i].name; | ||
119 | s.replace(":platform:", platform); | ||
120 | QString d = PlatformInfosList[i].def; | ||
121 | d.replace(":platform:", platform); | ||
122 | LOG_INFO() << "GET P:" << s << systemInfos->value(s, d).toString(); | ||
123 | return systemInfos->value(s, d); | ||
124 | } | ||
125 | |||
126 | QStringList SystemInfo::platforms(enum SystemInfo::PlatformType type, QString variant) | 41 | QStringList SystemInfo::platforms(enum SystemInfo::PlatformType type, QString variant) |
127 | { | 42 | { |
128 | ensureSystemInfoExists(); | 43 | ensureSystemInfoExists(); |