diff options
Diffstat (limited to 'rbutil/rbutilqt')
24 files changed, 791 insertions, 773 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp index 00918bf769..58e844b4c3 100644 --- a/rbutil/rbutilqt/base/autodetection.cpp +++ b/rbutil/rbutilqt/base/autodetection.cpp | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "autodetection.h" | 20 | #include "autodetection.h" |
21 | #include "rbsettings.h" | 21 | #include "rbsettings.h" |
22 | #include "systeminfo.h" | 22 | #include "systeminfo.h" |
23 | #include "playerbuildinfo.h" | ||
23 | 24 | ||
24 | #include "../ipodpatcher/ipodpatcher.h" | 25 | #include "../ipodpatcher/ipodpatcher.h" |
25 | #include "../sansapatcher/sansapatcher.h" | 26 | #include "../sansapatcher/sansapatcher.h" |
@@ -69,7 +70,8 @@ bool Autodetection::detect(void) | |||
69 | } | 70 | } |
70 | for(int i = 0; i < m_detected.size(); ++i) { | 71 | for(int i = 0; i < m_detected.size(); ++i) { |
71 | LOG_INFO() << "Detected player:" << m_detected.at(i).device | 72 | LOG_INFO() << "Detected player:" << m_detected.at(i).device |
72 | << "at" << m_detected.at(i).mountpoint << states[m_detected.at(i).status]; | 73 | << "at" << m_detected.at(i).mountpoint |
74 | << states[m_detected.at(i).status]; | ||
73 | } | 75 | } |
74 | 76 | ||
75 | return m_detected.size() > 0; | 77 | return m_detected.size() > 0; |
@@ -108,7 +110,8 @@ void Autodetection::detectUsb() | |||
108 | LOG_WARNING() << "[USB] detected problem with player" << d.device; | 110 | LOG_WARNING() << "[USB] detected problem with player" << d.device; |
109 | } | 111 | } |
110 | QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0')); | 112 | QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0')); |
111 | if(!SystemInfo::platformValue(SystemInfo::Name, idstring).toString().isEmpty()) { | 113 | if(!PlayerBuildInfo::instance()->value( |
114 | PlayerBuildInfo::DisplayName, idstring).toString().isEmpty()) { | ||
112 | struct Detected d; | 115 | struct Detected d; |
113 | d.status = PlayerIncompatible; | 116 | d.status = PlayerIncompatible; |
114 | d.device = idstring; | 117 | d.device = idstring; |
diff --git a/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp b/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp index e8852d6df5..3621a27e26 100644 --- a/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "utils.h" | 23 | #include "utils.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "rbsettings.h" | 25 | #include "rbsettings.h" |
26 | #include "systeminfo.h" | 26 | #include "playerbuildinfo.h" |
27 | 27 | ||
28 | #include "../mks5lboot/mks5lboot.h" | 28 | #include "../mks5lboot/mks5lboot.h" |
29 | 29 | ||
@@ -408,8 +408,8 @@ BootloaderInstallBase::BootloaderType BootloaderInstallS5l::installed(void) | |||
408 | QString logfile = RbSettings::value(RbSettings::Mountpoint).toString() | 408 | QString logfile = RbSettings::value(RbSettings::Mountpoint).toString() |
409 | + "/.rockbox/rbutil.log"; | 409 | + "/.rockbox/rbutil.log"; |
410 | QSettings s(logfile, QSettings::IniFormat, this); | 410 | QSettings s(logfile, QSettings::IniFormat, this); |
411 | QString section = SystemInfo::platformValue( | 411 | QString section = PlayerBuildInfo::instance()->value( |
412 | SystemInfo::BootloaderName).toString().section('/', -1); | 412 | PlayerBuildInfo::BootloaderName).toString().section('/', -1); |
413 | rbblInstalled = s.contains("Bootloader/" + section); | 413 | rbblInstalled = s.contains("Bootloader/" + section); |
414 | 414 | ||
415 | if (rbblInstalled) { | 415 | if (rbblInstalled) { |
diff --git a/rbutil/rbutilqt/base/playerbuildinfo.cpp b/rbutil/rbutilqt/base/playerbuildinfo.cpp new file mode 100644 index 0000000000..fb8b121e8f --- /dev/null +++ b/rbutil/rbutilqt/base/playerbuildinfo.cpp | |||
@@ -0,0 +1,265 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2020 by Dominik Riebeling | ||
10 | * | ||
11 | * All files in this archive are subject to the GNU General Public License. | ||
12 | * See the file COPYING in the source tree root for full license agreement. | ||
13 | * | ||
14 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
15 | * KIND, either express or implied. | ||
16 | * | ||
17 | ****************************************************************************/ | ||
18 | |||
19 | #include "playerbuildinfo.h" | ||
20 | #include "rbsettings.h" | ||
21 | #include "Logger.h" | ||
22 | |||
23 | PlayerBuildInfo* PlayerBuildInfo::infoInstance = nullptr; | ||
24 | |||
25 | PlayerBuildInfo* PlayerBuildInfo::instance() | ||
26 | { | ||
27 | if (infoInstance == nullptr) { | ||
28 | infoInstance = new PlayerBuildInfo(); | ||
29 | } | ||
30 | return infoInstance; | ||
31 | } | ||
32 | |||
33 | // server infos | ||
34 | const static struct { | ||
35 | PlayerBuildInfo::BuildInfo item; | ||
36 | const char* name; | ||
37 | } ServerInfoList[] = { | ||
38 | { PlayerBuildInfo::BuildVoiceLangs, "voices/:version:" }, | ||
39 | { PlayerBuildInfo::BuildVersion, ":build:/:target:" }, | ||
40 | { PlayerBuildInfo::BuildUrl, ":build:/build_url" }, | ||
41 | { PlayerBuildInfo::BuildVoiceUrl, ":build:/voice_url" }, | ||
42 | { PlayerBuildInfo::BuildManualUrl, ":build:/manual_url" }, | ||
43 | { PlayerBuildInfo::BuildSourceUrl, ":build:/source_url" }, | ||
44 | { PlayerBuildInfo::BuildFontUrl, ":build:/font_url" }, | ||
45 | |||
46 | // other URLs -- those are not directly related to the build, but handled here. | ||
47 | { PlayerBuildInfo::DoomUrl, "other/doom_url" }, | ||
48 | { PlayerBuildInfo::Duke3DUrl, "other/duke3d_url" }, | ||
49 | { PlayerBuildInfo::PuzzFontsUrl, "other/puzzfonts_url" }, | ||
50 | { PlayerBuildInfo::QuakeUrl, "other/quake_url" }, | ||
51 | { PlayerBuildInfo::Wolf3DUrl, "other/wolf3d_url" }, | ||
52 | { PlayerBuildInfo::XWorldUrl, "other/xworld_url" }, | ||
53 | { PlayerBuildInfo::MidiPatchsetUrl, "other/patcheset_url" }, | ||
54 | }; | ||
55 | |||
56 | const static struct { | ||
57 | PlayerBuildInfo::DeviceInfo item; | ||
58 | const char* name; | ||
59 | } PlayerInfoList[] = { | ||
60 | { PlayerBuildInfo::BuildStatus, "status/:target:" }, | ||
61 | { PlayerBuildInfo::DisplayName, ":target:/name" }, | ||
62 | { PlayerBuildInfo::BootloaderMethod, ":target:/bootloadermethod" }, | ||
63 | { PlayerBuildInfo::BootloaderName, ":target:/bootloadername" }, | ||
64 | { PlayerBuildInfo::BootloaderFile, ":target:/bootloaderfile" }, | ||
65 | { PlayerBuildInfo::BootloaderFilter, ":target:/bootloaderfilter" }, | ||
66 | { PlayerBuildInfo::Encoder, ":target:/encoder" }, | ||
67 | { PlayerBuildInfo::Brand, ":target:/brand" }, | ||
68 | { PlayerBuildInfo::PlayerPicture, ":target:/playerpic" }, | ||
69 | }; | ||
70 | |||
71 | const static struct { | ||
72 | PlayerBuildInfo::SystemUrl item; | ||
73 | const char* name; | ||
74 | } PlayerSystemUrls[] = { | ||
75 | { PlayerBuildInfo::BootloaderUrl, "bootloader/download_url" }, | ||
76 | { PlayerBuildInfo::BuildInfoUrl, "build_info_url" }, | ||
77 | { PlayerBuildInfo::GenlangUrl, "genlang_url" }, | ||
78 | { PlayerBuildInfo::ThemesUrl, "themes_url" }, | ||
79 | { PlayerBuildInfo::ThemesInfoUrl, "themes_info_url" }, | ||
80 | { PlayerBuildInfo::RbutilUrl, "rbutil_url" }, | ||
81 | }; | ||
82 | |||
83 | PlayerBuildInfo::PlayerBuildInfo() : | ||
84 | serverInfo(nullptr), | ||
85 | playerInfo(":/ini/rbutil.ini", QSettings::IniFormat) | ||
86 | { | ||
87 | |||
88 | } | ||
89 | |||
90 | void PlayerBuildInfo::setBuildInfo(QString file) | ||
91 | { | ||
92 | if (serverInfo) | ||
93 | delete serverInfo; | ||
94 | LOG_INFO() << "updated:" << file; | ||
95 | serverInfo = new QSettings(file, QSettings::IniFormat); | ||
96 | } | ||
97 | |||
98 | QVariant PlayerBuildInfo::value(BuildInfo item, BuildType type) | ||
99 | { | ||
100 | // locate setting item in server info file | ||
101 | int i = 0; | ||
102 | while(ServerInfoList[i].item != item) | ||
103 | i++; | ||
104 | |||
105 | // split of variant for target. | ||
106 | // we can have an optional variant part in the target string. | ||
107 | // For build info we don't use that. | ||
108 | QString target = RbSettings::value(RbSettings::CurrentPlatform).toString().split('.').at(0); | ||
109 | |||
110 | QString s = ServerInfoList[i].name; | ||
111 | s.replace(":target:", target); | ||
112 | QString v; | ||
113 | switch(type) { | ||
114 | case TypeRelease: | ||
115 | v = "release"; | ||
116 | break; | ||
117 | case TypeCandidate: | ||
118 | v = "release-candidate"; | ||
119 | break; | ||
120 | case TypeDaily: | ||
121 | v = "daily"; | ||
122 | break; | ||
123 | case TypeDevel: | ||
124 | v = "development"; | ||
125 | break; | ||
126 | } | ||
127 | |||
128 | QVariant result = QString(); | ||
129 | if (!serverInfo) | ||
130 | return result; | ||
131 | QStringList version = serverInfo->value(v + "/" + target, "").toStringList(); | ||
132 | s.replace(":build:", v); | ||
133 | s.replace(":version:", version.at(0)); | ||
134 | |||
135 | // get value from server build-info | ||
136 | // we need to get a version string, otherwise the data is invalid. | ||
137 | // For invalid data return an empty string. | ||
138 | if(version.at(0).isEmpty()) { | ||
139 | LOG_INFO() << s << "(version invalid)"; | ||
140 | return result; | ||
141 | } | ||
142 | if(!s.isEmpty()) | ||
143 | result = serverInfo->value(s); | ||
144 | |||
145 | // depending on the actual value we need more replacements. | ||
146 | switch(item) { | ||
147 | case BuildVersion: | ||
148 | result = result.toStringList().at(0); | ||
149 | break; | ||
150 | |||
151 | case BuildUrl: | ||
152 | if(version.size() > 1) { | ||
153 | // version info has an URL appended. Takes precendence. | ||
154 | result = version.at(1); | ||
155 | } | ||
156 | break; | ||
157 | |||
158 | case BuildVoiceLangs: | ||
159 | if (type == TypeDaily) | ||
160 | s = "voices/daily"; | ||
161 | result = serverInfo->value(s); | ||
162 | break; | ||
163 | |||
164 | case BuildManualUrl: | ||
165 | { | ||
166 | // special case: if playerInfo has a non-empty manualname entry for the | ||
167 | // target, use that as target for the manual name. | ||
168 | QString manualtarget = playerInfo.value(target + "/manualname", "").toString(); | ||
169 | if(!manualtarget.isEmpty()) | ||
170 | target = manualtarget; | ||
171 | break; | ||
172 | } | ||
173 | |||
174 | default: | ||
175 | break; | ||
176 | } | ||
177 | // if the value is a string we can replace some patterns. | ||
178 | // if we cannot convert it (f.e. for a QStringList) we leave as-is, since | ||
179 | // the conversion would return an empty type. | ||
180 | if (result.canConvert(QMetaType::QString)) | ||
181 | result = result.toString() | ||
182 | .replace("%TARGET%", target) | ||
183 | .replace("%VERSION%", version.at(0)); | ||
184 | |||
185 | LOG_INFO() << "B:" << s << result; | ||
186 | return result; | ||
187 | } | ||
188 | |||
189 | QVariant PlayerBuildInfo::value(DeviceInfo item, QString target) | ||
190 | { | ||
191 | // locate setting item in server info file | ||
192 | int i = 0; | ||
193 | while(PlayerInfoList[i].item != item) | ||
194 | i++; | ||
195 | |||
196 | // split of variant for target. | ||
197 | // we can have an optional variant part in the target string. | ||
198 | // For device info we use this. | ||
199 | if (target.isEmpty()) | ||
200 | target = RbSettings::value(RbSettings::CurrentPlatform).toString(); | ||
201 | |||
202 | QVariant result = QString(); | ||
203 | |||
204 | QString s = PlayerInfoList[i].name; | ||
205 | s.replace(":target:", target); | ||
206 | |||
207 | switch(item) { | ||
208 | case BuildStatus: | ||
209 | { | ||
210 | // build status is the only value that doesn't depend on the version | ||
211 | // but the selected target instead. | ||
212 | bool ok = false; | ||
213 | if (serverInfo) | ||
214 | result = serverInfo->value(s).toInt(&ok); | ||
215 | if (!ok) | ||
216 | result = -1; | ||
217 | break; | ||
218 | } | ||
219 | |||
220 | default: | ||
221 | result = playerInfo.value(s); | ||
222 | break; | ||
223 | } | ||
224 | |||
225 | LOG_INFO() << "T:" << s << result; | ||
226 | return result; | ||
227 | } | ||
228 | |||
229 | QVariant PlayerBuildInfo::value(SystemUrl item) | ||
230 | { | ||
231 | // locate setting item in server info file | ||
232 | int i = 0; | ||
233 | while(PlayerSystemUrls[i].item != item) | ||
234 | i++; | ||
235 | |||
236 | QVariant result = playerInfo.value(PlayerSystemUrls[i].name); | ||
237 | LOG_INFO() << "U:" << PlayerSystemUrls[i].name << result; | ||
238 | return result; | ||
239 | } | ||
240 | |||
241 | |||
242 | QString PlayerBuildInfo::statusAsString(QString platform) | ||
243 | { | ||
244 | QString result; | ||
245 | switch(value(BuildStatus, platform).toInt()) | ||
246 | { | ||
247 | case STATUS_RETIRED: | ||
248 | result = tr("Stable (Retired)"); | ||
249 | break; | ||
250 | case STATUS_UNUSABLE: | ||
251 | result = tr("Unusable"); | ||
252 | break; | ||
253 | case STATUS_UNSTABLE: | ||
254 | result = tr("Unstable"); | ||
255 | break; | ||
256 | case STATUS_STABLE: | ||
257 | result = tr("Stable"); | ||
258 | break; | ||
259 | default: | ||
260 | result = tr("Unknown"); | ||
261 | break; | ||
262 | } | ||
263 | |||
264 | return result; | ||
265 | } | ||
diff --git a/rbutil/rbutilqt/base/playerbuildinfo.h b/rbutil/rbutilqt/base/playerbuildinfo.h new file mode 100644 index 0000000000..81d7d97312 --- /dev/null +++ b/rbutil/rbutilqt/base/playerbuildinfo.h | |||
@@ -0,0 +1,106 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2020 by Dominik Riebeling | ||
10 | * | ||
11 | * All files in this archive are subject to the GNU General Public License. | ||
12 | * See the file COPYING in the source tree root for full license agreement. | ||
13 | * | ||
14 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
15 | * KIND, either express or implied. | ||
16 | * | ||
17 | ****************************************************************************/ | ||
18 | |||
19 | #ifndef PLAYERBUILDINFO_H | ||
20 | #define PLAYERBUILDINFO_H | ||
21 | |||
22 | #include <QSettings> | ||
23 | |||
24 | #define STATUS_RETIRED 0 | ||
25 | #define STATUS_UNUSABLE 1 | ||
26 | #define STATUS_UNSTABLE 2 | ||
27 | #define STATUS_STABLE 3 | ||
28 | |||
29 | // Provide information about both player and builds. | ||
30 | // For build info data retrieved from the build server has to be passed. | ||
31 | class PlayerBuildInfo : public QObject | ||
32 | { | ||
33 | public: | ||
34 | |||
35 | enum BuildType { | ||
36 | TypeRelease, | ||
37 | TypeCandidate, | ||
38 | TypeDaily, | ||
39 | TypeDevel, | ||
40 | }; | ||
41 | enum BuildInfo { | ||
42 | BuildUrl, | ||
43 | BuildVersion, | ||
44 | BuildManualUrl, | ||
45 | BuildVoiceUrl, | ||
46 | BuildVoiceLangs, | ||
47 | BuildSourceUrl, | ||
48 | BuildFontUrl, | ||
49 | |||
50 | DoomUrl, | ||
51 | Duke3DUrl, | ||
52 | PuzzFontsUrl, | ||
53 | QuakeUrl, | ||
54 | Wolf3DUrl, | ||
55 | XWorldUrl, | ||
56 | MidiPatchsetUrl, | ||
57 | }; | ||
58 | enum DeviceInfo { | ||
59 | BuildStatus, | ||
60 | |||
61 | DisplayName, | ||
62 | BootloaderMethod, | ||
63 | BootloaderName, | ||
64 | BootloaderFile, | ||
65 | BootloaderFilter, | ||
66 | Encoder, | ||
67 | Brand, | ||
68 | PlayerPicture, | ||
69 | }; | ||
70 | |||
71 | enum SystemUrl { | ||
72 | BootloaderUrl, | ||
73 | BuildInfoUrl, | ||
74 | GenlangUrl, | ||
75 | ThemesUrl, | ||
76 | ThemesInfoUrl, | ||
77 | RbutilUrl, | ||
78 | }; | ||
79 | |||
80 | static PlayerBuildInfo* instance(); | ||
81 | |||
82 | //! Update with build information from server | ||
83 | void setBuildInfo(QString file); | ||
84 | |||
85 | // Get information about a device. This data does not depend on the build type. | ||
86 | QVariant value(DeviceInfo item, QString target = ""); | ||
87 | |||
88 | // Get build information for currently selected player. | ||
89 | QVariant value(BuildInfo item, BuildType type); | ||
90 | |||
91 | // Get fixed download URL information | ||
92 | QVariant value(SystemUrl item); | ||
93 | |||
94 | QString statusAsString(QString target = ""); | ||
95 | |||
96 | protected: | ||
97 | explicit PlayerBuildInfo(); | ||
98 | |||
99 | private: | ||
100 | static PlayerBuildInfo* infoInstance; | ||
101 | QSettings* serverInfo; | ||
102 | QSettings playerInfo; | ||
103 | |||
104 | }; | ||
105 | |||
106 | #endif | ||
diff --git a/rbutil/rbutilqt/base/rbsettings.cpp b/rbutil/rbutilqt/base/rbsettings.cpp index adb222f80e..47217a15fe 100644 --- a/rbutil/rbutilqt/base/rbsettings.cpp +++ b/rbutil/rbutilqt/base/rbsettings.cpp | |||
@@ -17,7 +17,7 @@ | |||
17 | ****************************************************************************/ | 17 | ****************************************************************************/ |
18 | 18 | ||
19 | #include "rbsettings.h" | 19 | #include "rbsettings.h" |
20 | #include "systeminfo.h" | 20 | #include "playerbuildinfo.h" |
21 | #include <QSettings> | 21 | #include <QSettings> |
22 | #include "Logger.h" | 22 | #include "Logger.h" |
23 | 23 | ||
@@ -196,7 +196,8 @@ QString RbSettings::constructSettingPath(QString path, QString substitute) | |||
196 | } | 196 | } |
197 | else { | 197 | else { |
198 | path.replace(":tts:", userSettings->value("tts").toString()); | 198 | path.replace(":tts:", userSettings->value("tts").toString()); |
199 | path.replace(":encoder:", SystemInfo::platformValue(SystemInfo::Encoder, platform).toString()); | 199 | path.replace(":encoder:", PlayerBuildInfo::instance()->value( |
200 | PlayerBuildInfo::Encoder, platform).toString()); | ||
200 | } | 201 | } |
201 | path.replace(":platform:", platform); | 202 | path.replace(":platform:", platform); |
202 | } | 203 | } |
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp deleted file mode 100644 index 5fee75f689..0000000000 --- a/rbutil/rbutilqt/base/serverinfo.cpp +++ /dev/null | |||
@@ -1,157 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2010 by Dominik Wenger | ||
10 | * | ||
11 | * All files in this archive are subject to the GNU General Public License. | ||
12 | * See the file COPYING in the source tree root for full license agreement. | ||
13 | * | ||
14 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
15 | * KIND, either express or implied. | ||
16 | * | ||
17 | ****************************************************************************/ | ||
18 | |||
19 | #include "serverinfo.h" | ||
20 | #include "rbsettings.h" | ||
21 | #include "systeminfo.h" | ||
22 | #include "Logger.h" | ||
23 | |||
24 | ServerInfo* ServerInfo::infoInstance = nullptr; | ||
25 | |||
26 | ServerInfo* ServerInfo::instance() | ||
27 | { | ||
28 | if (infoInstance == nullptr) { | ||
29 | infoInstance = new ServerInfo(); | ||
30 | } | ||
31 | return infoInstance; | ||
32 | } | ||
33 | |||
34 | // server infos | ||
35 | const static struct { | ||
36 | ServerInfo::ServerInfos info; | ||
37 | const char* name; | ||
38 | const char* def; | ||
39 | } ServerInfoList[] = { | ||
40 | { ServerInfo::CurReleaseVersion, "release/:platform:", "" }, | ||
41 | { ServerInfo::CurReleaseUrl, "release/:platform:", "" }, | ||
42 | { ServerInfo::RelCandidateVersion, "release-candidate/:platform:", "" }, | ||
43 | { ServerInfo::RelCandidateUrl, "release-candidate/:platform:", "" }, | ||
44 | { ServerInfo::DailyVersion, "daily/:platform:", "" }, | ||
45 | { ServerInfo::DailyUrl, "daily/:platform:", "" }, | ||
46 | { ServerInfo::CurStatus, "status/:platform:", "-1" }, | ||
47 | { ServerInfo::BleedingRevision, "bleeding/rev", "" }, | ||
48 | { ServerInfo::BleedingDate, "bleeding/timestamp", "" }, | ||
49 | { ServerInfo::CurDevelUrl, "", "" }, | ||
50 | }; | ||
51 | |||
52 | void ServerInfo::readBuildInfo(QString file) | ||
53 | { | ||
54 | if (serverSettings) | ||
55 | delete serverSettings; | ||
56 | serverSettings = new QSettings(file, QSettings::IniFormat); | ||
57 | } | ||
58 | |||
59 | |||
60 | QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform) | ||
61 | { | ||
62 | // locate setting item in server info file | ||
63 | int i = 0; | ||
64 | while(ServerInfoList[i].info != info) | ||
65 | i++; | ||
66 | |||
67 | // replace setting name | ||
68 | if(platform.isEmpty()) | ||
69 | platform = RbSettings::value(RbSettings::CurrentPlatform).toString(); | ||
70 | |||
71 | // split of variant for platform. | ||
72 | // we can have an optional variant part in the platform string. | ||
73 | // For build info we don't use that. | ||
74 | platform = platform.split('.').at(0); | ||
75 | |||
76 | QString s = ServerInfoList[i].name; | ||
77 | s.replace(":platform:", platform); | ||
78 | |||
79 | // get value | ||
80 | QVariant value = QString(); | ||
81 | if(!s.isEmpty() && serverSettings) | ||
82 | value = serverSettings->value(s, ServerInfoList[i].def); | ||
83 | |||
84 | // depending on the actual value we need more replacements. | ||
85 | switch(info) { | ||
86 | case CurReleaseVersion: | ||
87 | case RelCandidateVersion: | ||
88 | case DailyVersion: | ||
89 | value = value.toStringList().at(0); | ||
90 | break; | ||
91 | case CurReleaseUrl: | ||
92 | case RelCandidateUrl: | ||
93 | case DailyUrl: | ||
94 | { | ||
95 | QString version = value.toStringList().at(0); | ||
96 | if(value.toStringList().size() > 1) | ||
97 | value = value.toStringList().at(1); | ||
98 | else if(!version.isEmpty() && info == CurReleaseUrl) | ||
99 | value = SystemInfo::value(SystemInfo::BuildUrl, | ||
100 | SystemInfo::BuildRelease).toString() | ||
101 | .replace("%MODEL%", platform) | ||
102 | .replace("%RELVERSION%", version); | ||
103 | else if(!version.isEmpty() && info == RelCandidateUrl) | ||
104 | value = SystemInfo::value(SystemInfo::BuildUrl, | ||
105 | SystemInfo::BuildCandidate).toString() | ||
106 | .replace("%MODEL%", platform) | ||
107 | .replace("%RELVERSION%", version); | ||
108 | else if(!version.isEmpty() && info == DailyUrl) | ||
109 | value = SystemInfo::value(SystemInfo::BuildUrl, | ||
110 | SystemInfo::BuildDaily).toString() | ||
111 | .replace("%MODEL%", platform) | ||
112 | .replace("%RELVERSION%", version); | ||
113 | } | ||
114 | break; | ||
115 | case CurDevelUrl: | ||
116 | value = SystemInfo::value(SystemInfo::BuildUrl, | ||
117 | SystemInfo::BuildCurrent).toString() | ||
118 | .replace("%MODEL%", platform); | ||
119 | break; | ||
120 | case BleedingDate: | ||
121 | // TODO: get rid of this, it's location specific. | ||
122 | value = QDateTime::fromString(value.toString(), | ||
123 | "yyyyMMddThhmmssZ").toString(Qt::ISODate); | ||
124 | break; | ||
125 | |||
126 | default: | ||
127 | break; | ||
128 | } | ||
129 | |||
130 | LOG_INFO() << "Server:" << value; | ||
131 | return value; | ||
132 | } | ||
133 | |||
134 | QString ServerInfo::statusAsString(QString platform) | ||
135 | { | ||
136 | QString value; | ||
137 | switch(platformValue(CurStatus, platform).toInt()) | ||
138 | { | ||
139 | case STATUS_RETIRED: | ||
140 | value = tr("Stable (Retired)"); | ||
141 | break; | ||
142 | case STATUS_UNUSABLE: | ||
143 | value = tr("Unusable"); | ||
144 | break; | ||
145 | case STATUS_UNSTABLE: | ||
146 | value = tr("Unstable"); | ||
147 | break; | ||
148 | case STATUS_STABLE: | ||
149 | value = tr("Stable"); | ||
150 | break; | ||
151 | default: | ||
152 | value = tr("Unknown"); | ||
153 | break; | ||
154 | } | ||
155 | |||
156 | return value; | ||
157 | } | ||
diff --git a/rbutil/rbutilqt/base/serverinfo.h b/rbutil/rbutilqt/base/serverinfo.h deleted file mode 100644 index 0746ec2c4f..0000000000 --- a/rbutil/rbutilqt/base/serverinfo.h +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2010 by Dominik Wenger | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | // Parse and provide information from build server via build-info file. | ||
22 | // This is a singleton. | ||
23 | |||
24 | #ifndef SERVERINFO_H | ||
25 | #define SERVERINFO_H | ||
26 | |||
27 | #include <QtCore> | ||
28 | #define STATUS_RETIRED 0 | ||
29 | #define STATUS_UNUSABLE 1 | ||
30 | #define STATUS_UNSTABLE 2 | ||
31 | #define STATUS_STABLE 3 | ||
32 | |||
33 | class ServerInfo : public QObject | ||
34 | { | ||
35 | Q_OBJECT | ||
36 | public: | ||
37 | |||
38 | //! All Server infos | ||
39 | enum ServerInfos { | ||
40 | CurReleaseVersion, | ||
41 | CurStatus, | ||
42 | CurReleaseUrl, | ||
43 | CurDevelUrl, | ||
44 | BleedingRevision, | ||
45 | BleedingDate, | ||
46 | RelCandidateVersion, | ||
47 | RelCandidateUrl, | ||
48 | DailyVersion, | ||
49 | DailyUrl | ||
50 | }; | ||
51 | |||
52 | static ServerInfo* instance(); | ||
53 | |||
54 | //! read in buildinfo file | ||
55 | void readBuildInfo(QString file); | ||
56 | //! get a value from server info for a named platform. | ||
57 | QVariant platformValue(enum ServerInfos setting, QString platform = ""); | ||
58 | //! Get status number as string | ||
59 | QString statusAsString(QString platform = ""); | ||
60 | |||
61 | protected: | ||
62 | ServerInfo() : serverSettings(nullptr) {} | ||
63 | |||
64 | private: | ||
65 | static ServerInfo* infoInstance; | ||
66 | QSettings* serverSettings; | ||
67 | |||
68 | }; | ||
69 | |||
70 | #endif | ||
71 | |||
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(); |
diff --git a/rbutil/rbutilqt/base/systeminfo.h b/rbutil/rbutilqt/base/systeminfo.h index 67863c2268..7b5b68131b 100644 --- a/rbutil/rbutilqt/base/systeminfo.h +++ b/rbutil/rbutilqt/base/systeminfo.h | |||
@@ -34,47 +34,6 @@ class SystemInfo : public QObject | |||
34 | MapIncompatible, | 34 | MapIncompatible, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | enum BuildType { | ||
38 | BuildCurrent, | ||
39 | BuildDaily, | ||
40 | BuildRelease, | ||
41 | BuildCandidate | ||
42 | }; | ||
43 | |||
44 | //! All system settings | ||
45 | enum SystemInfos { | ||
46 | BuildUrl, | ||
47 | FontUrl, | ||
48 | VoiceUrl, | ||
49 | ManualUrl, | ||
50 | BootloaderUrl, | ||
51 | BootloaderInfoUrl, | ||
52 | DoomUrl, | ||
53 | Duke3DUrl, | ||
54 | QuakeUrl, | ||
55 | PuzzFontsUrl, | ||
56 | Wolf3DUrl, | ||
57 | XWorldUrl, | ||
58 | ReleaseUrl, | ||
59 | BuildInfoUrl, | ||
60 | GenlangUrl, | ||
61 | ThemesUrl, | ||
62 | ThemesInfoUrl, | ||
63 | RbutilUrl, | ||
64 | }; | ||
65 | |||
66 | enum PlatformInfo { | ||
67 | Manual, | ||
68 | BootloaderMethod, | ||
69 | BootloaderName, | ||
70 | BootloaderFile, | ||
71 | BootloaderFilter, | ||
72 | Encoder, | ||
73 | Brand, | ||
74 | Name, | ||
75 | PlayerPicture, | ||
76 | }; | ||
77 | |||
78 | enum PlatformType { | 37 | enum PlatformType { |
79 | PlatformAll, | 38 | PlatformAll, |
80 | PlatformAllDisabled, | 39 | PlatformAllDisabled, |
@@ -93,9 +52,6 @@ class SystemInfo : public QObject | |||
93 | //! returns a map of usb-ids and their targets | 52 | //! returns a map of usb-ids and their targets |
94 | static QMap<int, QStringList> usbIdMap(enum MapType type); | 53 | static QMap<int, QStringList> usbIdMap(enum MapType type); |
95 | //! get a value from system settings | 54 | //! get a value from system settings |
96 | static QVariant value(enum SystemInfos info, BuildType type = BuildCurrent); | ||
97 | //! get a value from system settings for a named platform. | ||
98 | static QVariant platformValue(enum PlatformInfo info, QString platform = ""); | ||
99 | 55 | ||
100 | private: | 56 | private: |
101 | //! you shouldnt call this, its a fully static calls | 57 | //! you shouldnt call this, its a fully static calls |
diff --git a/rbutil/rbutilqt/base/talkgenerator.cpp b/rbutil/rbutilqt/base/talkgenerator.cpp index 951bf0e804..9139ceb274 100644 --- a/rbutil/rbutilqt/base/talkgenerator.cpp +++ b/rbutil/rbutilqt/base/talkgenerator.cpp | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | #include "talkgenerator.h" | 19 | #include "talkgenerator.h" |
20 | #include "rbsettings.h" | 20 | #include "rbsettings.h" |
21 | #include "systeminfo.h" | 21 | #include "playerbuildinfo.h" |
22 | #include "wavtrim.h" | 22 | #include "wavtrim.h" |
23 | #include "Logger.h" | 23 | #include "Logger.h" |
24 | 24 | ||
@@ -56,8 +56,8 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt | |||
56 | 56 | ||
57 | // Encoder | 57 | // Encoder |
58 | emit logItem(tr("Starting Encoder Engine"),LOGINFO); | 58 | emit logItem(tr("Starting Encoder Engine"),LOGINFO); |
59 | m_enc = EncoderBase::getEncoder( | 59 | m_enc = EncoderBase::getEncoder(this, PlayerBuildInfo::instance()->value( |
60 | this, SystemInfo::platformValue(SystemInfo::Encoder).toString()); | 60 | PlayerBuildInfo::Encoder).toString()); |
61 | if(!m_enc->start()) | 61 | if(!m_enc->start()) |
62 | { | 62 | { |
63 | emit logItem(tr("Init of Encoder engine failed"),LOGERROR); | 63 | emit logItem(tr("Init of Encoder engine failed"),LOGERROR); |
@@ -156,7 +156,8 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri | |||
156 | QString error; | 156 | QString error; |
157 | LOG_INFO() << "voicing: " << list->at(i).toSpeak | 157 | LOG_INFO() << "voicing: " << list->at(i).toSpeak |
158 | << "to" << list->at(i).wavfilename; | 158 | << "to" << list->at(i).wavfilename; |
159 | TTSStatus status = m_tts->voice(list->at(i).toSpeak,list->at(i).wavfilename, &error); | 159 | TTSStatus status = m_tts->voice(list->at(i).toSpeak, |
160 | list->at(i).wavfilename, &error); | ||
160 | if(status == Warning) | 161 | if(status == Warning) |
161 | { | 162 | { |
162 | warnings = true; | 163 | warnings = true; |
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp index 2f01f42e2c..3ab8aa6906 100644 --- a/rbutil/rbutilqt/base/utils.cpp +++ b/rbutil/rbutilqt/base/utils.cpp | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "rockboxinfo.h" | 20 | #include "rockboxinfo.h" |
21 | #include "system.h" | 21 | #include "system.h" |
22 | #include "rbsettings.h" | 22 | #include "rbsettings.h" |
23 | #include "systeminfo.h" | 23 | #include "playerbuildinfo.h" |
24 | #include "Logger.h" | 24 | #include "Logger.h" |
25 | 25 | ||
26 | #if !defined(_UNICODE) | 26 | #if !defined(_UNICODE) |
@@ -385,8 +385,10 @@ QString Utils::checkEnvironment(bool permission) | |||
385 | { | 385 | { |
386 | text += tr("<li>Target mismatch detected.<br/>" | 386 | text += tr("<li>Target mismatch detected.<br/>" |
387 | "Installed target: %1<br/>Selected target: %2.</li>") | 387 | "Installed target: %1<br/>Selected target: %2.</li>") |
388 | .arg(SystemInfo::platformValue(SystemInfo::Name, installed).toString(), | 388 | .arg(PlayerBuildInfo::instance()->value( |
389 | SystemInfo::platformValue(SystemInfo::Name).toString()); | 389 | PlayerBuildInfo::DisplayName, installed).toString(), |
390 | PlayerBuildInfo::instance()->value( | ||
391 | PlayerBuildInfo::DisplayName).toString()); | ||
390 | } | 392 | } |
391 | 393 | ||
392 | if(!text.isEmpty()) | 394 | if(!text.isEmpty()) |
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp index c4edac64b9..98ab96b8ab 100644 --- a/rbutil/rbutilqt/base/voicefile.cpp +++ b/rbutil/rbutilqt/base/voicefile.cpp | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "utils.h" | 21 | #include "utils.h" |
22 | #include "rockboxinfo.h" | 22 | #include "rockboxinfo.h" |
23 | #include "rbsettings.h" | 23 | #include "rbsettings.h" |
24 | #include "systeminfo.h" | 24 | #include "playerbuildinfo.h" |
25 | #include "ziputil.h" | 25 | #include "ziputil.h" |
26 | #include "Logger.h" | 26 | #include "Logger.h" |
27 | 27 | ||
@@ -148,7 +148,8 @@ bool VoiceFileCreator::createVoiceFile() | |||
148 | // genlang output as previously from the webserver. | 148 | // genlang output as previously from the webserver. |
149 | 149 | ||
150 | // prepare download url | 150 | // prepare download url |
151 | QString genlang = SystemInfo::value(SystemInfo::GenlangUrl).toString(); | 151 | QString genlang = PlayerBuildInfo::instance()->value( |
152 | PlayerBuildInfo::GenlangUrl).toString(); | ||
152 | genlang.replace("%LANG%", m_lang); | 153 | genlang.replace("%LANG%", m_lang); |
153 | genlang.replace("%TARGET%", target); | 154 | genlang.replace("%TARGET%", target); |
154 | genlang.replace("%REVISION%", version); | 155 | genlang.replace("%REVISION%", version); |
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index b34379641e..6b784a6383 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp | |||
@@ -33,8 +33,8 @@ | |||
33 | #include "system.h" | 33 | #include "system.h" |
34 | #include "encttscfggui.h" | 34 | #include "encttscfggui.h" |
35 | #include "rbsettings.h" | 35 | #include "rbsettings.h" |
36 | #include "serverinfo.h" | ||
37 | #include "systeminfo.h" | 36 | #include "systeminfo.h" |
37 | #include "playerbuildinfo.h" | ||
38 | #include "utils.h" | 38 | #include "utils.h" |
39 | #include "comboboxviewdelegate.h" | 39 | #include "comboboxviewdelegate.h" |
40 | #if defined(Q_OS_WIN32) | 40 | #if defined(Q_OS_WIN32) |
@@ -355,8 +355,8 @@ void Config::setDevices() | |||
355 | QMultiMap <QString, QString> manuf; | 355 | QMultiMap <QString, QString> manuf; |
356 | for(int it = 0; it < platformList.size(); it++) | 356 | for(int it = 0; it < platformList.size(); it++) |
357 | { | 357 | { |
358 | QString curbrand = SystemInfo::platformValue( | 358 | QString curbrand = PlayerBuildInfo::instance()->value( |
359 | SystemInfo::Brand, platformList.at(it)).toString(); | 359 | PlayerBuildInfo::Brand, platformList.at(it)).toString(); |
360 | manuf.insert(curbrand, platformList.at(it)); | 360 | manuf.insert(curbrand, platformList.at(it)); |
361 | } | 361 | } |
362 | 362 | ||
@@ -384,9 +384,10 @@ void Config::setDevices() | |||
384 | if(!manuf.values(brands.at(c)).contains(platformList.at(it))) | 384 | if(!manuf.values(brands.at(c)).contains(platformList.at(it))) |
385 | continue; | 385 | continue; |
386 | // construct display name | 386 | // construct display name |
387 | QString curname = SystemInfo::platformValue( | 387 | QString curname = QString("%1 (%2)").arg( |
388 | SystemInfo::Name, platformList.at(it)).toString() | 388 | PlayerBuildInfo::instance()->value(PlayerBuildInfo::DisplayName, |
389 | + " (" + ServerInfo::instance()->statusAsString(platformList.at(it)) + ")"; | 389 | platformList.at(it)).toString(), |
390 | PlayerBuildInfo::instance()->statusAsString(platformList.at(it))); | ||
390 | LOG_INFO() << "add supported device:" << brands.at(c) << curname; | 391 | LOG_INFO() << "add supported device:" << brands.at(c) << curname; |
391 | w2 = new QTreeWidgetItem(w, QStringList(curname)); | 392 | w2 = new QTreeWidgetItem(w, QStringList(curname)); |
392 | w2->setData(0, Qt::UserRole, platformList.at(it)); | 393 | w2->setData(0, Qt::UserRole, platformList.at(it)); |
@@ -470,10 +471,10 @@ void Config::updateEncState() | |||
470 | return; | 471 | return; |
471 | 472 | ||
472 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 473 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
473 | QString encoder = SystemInfo::platformValue( | 474 | QString encoder = PlayerBuildInfo::instance()->value( |
474 | SystemInfo::Encoder, devname).toString(); | 475 | PlayerBuildInfo::Encoder, devname).toString(); |
475 | ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue( | 476 | ui.encoderName->setText(EncoderBase::getEncoderName( |
476 | SystemInfo::Encoder, devname).toString())); | 477 | PlayerBuildInfo::instance()->value(PlayerBuildInfo::Encoder, devname).toString())); |
477 | 478 | ||
478 | EncoderBase* enc = EncoderBase::getEncoder(this,encoder); | 479 | EncoderBase* enc = EncoderBase::getEncoder(this,encoder); |
479 | 480 | ||
@@ -741,8 +742,9 @@ void Config::autodetect() | |||
741 | mp = tr("(unknown)"); | 742 | mp = tr("(unknown)"); |
742 | } | 743 | } |
743 | msg += QString("<li>%1</li>").arg(tr("%1 at %2").arg( | 744 | msg += QString("<li>%1</li>").arg(tr("%1 at %2").arg( |
744 | SystemInfo::platformValue( | 745 | PlayerBuildInfo::instance()->value( |
745 | SystemInfo::Name, detected.at(i).device).toString(), | 746 | PlayerBuildInfo::DisplayName, |
747 | detected.at(i).device).toString(), | ||
746 | QDir::toNativeSeparators(mp))); | 748 | QDir::toNativeSeparators(mp))); |
747 | } | 749 | } |
748 | msg += "</ul>"; | 750 | msg += "</ul>"; |
@@ -767,22 +769,25 @@ void Config::autodetect() | |||
767 | case Autodetection::PlayerIncompatible: | 769 | case Autodetection::PlayerIncompatible: |
768 | msg += tr("Detected an unsupported player:\n%1\n" | 770 | msg += tr("Detected an unsupported player:\n%1\n" |
769 | "Sorry, Rockbox doesn't run on your player.") | 771 | "Sorry, Rockbox doesn't run on your player.") |
770 | .arg(SystemInfo::platformValue( | 772 | .arg(PlayerBuildInfo::instance()->value( |
771 | SystemInfo::Name, detected.at(0).device).toString()); | 773 | PlayerBuildInfo::DisplayName, |
774 | detected.at(0).device).toString()); | ||
772 | break; | 775 | break; |
773 | case Autodetection::PlayerMtpMode: | 776 | case Autodetection::PlayerMtpMode: |
774 | msg = tr("%1 in MTP mode found!\n" | 777 | msg = tr("%1 in MTP mode found!\n" |
775 | "You need to change your player to MSC mode for installation. ") | 778 | "You need to change your player to MSC mode for installation. ") |
776 | .arg(SystemInfo::platformValue( | 779 | .arg(PlayerBuildInfo::instance()->value( |
777 | SystemInfo::Name, detected.at(0).device).toString()); | 780 | PlayerBuildInfo::DisplayName, |
781 | detected.at(0).device).toString()); | ||
778 | break; | 782 | break; |
779 | case Autodetection::PlayerWrongFilesystem: | 783 | case Autodetection::PlayerWrongFilesystem: |
780 | if(SystemInfo::platformValue( | 784 | if(PlayerBuildInfo::instance()->value( |
781 | SystemInfo::BootloaderMethod, detected.at(0).device) == "ipod") { | 785 | PlayerBuildInfo::BootloaderMethod, detected.at(0).device) == "ipod") { |
782 | msg = tr("%1 \"MacPod\" found!\n" | 786 | msg = tr("%1 \"MacPod\" found!\n" |
783 | "Rockbox needs a FAT formatted Ipod (so-called \"WinPod\") " | 787 | "Rockbox needs a FAT formatted Ipod (so-called \"WinPod\") " |
784 | "to run. ").arg(SystemInfo::platformValue( | 788 | "to run. ").arg(PlayerBuildInfo::instance()->value( |
785 | SystemInfo::Name, detected.at(0).device).toString()); | 789 | PlayerBuildInfo::DisplayName, |
790 | detected.at(0).device).toString()); | ||
786 | } | 791 | } |
787 | else { | 792 | else { |
788 | msg = tr("The player contains an incompatible filesystem.\n" | 793 | msg = tr("The player contains an incompatible filesystem.\n" |
@@ -961,10 +966,11 @@ void Config::configEnc() | |||
961 | return; | 966 | return; |
962 | 967 | ||
963 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 968 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
964 | QString encoder = SystemInfo::platformValue( | 969 | QString encoder = PlayerBuildInfo::instance()->value( |
965 | SystemInfo::Encoder, devname).toString(); | 970 | PlayerBuildInfo::Encoder, devname).toString(); |
966 | ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue( | 971 | ui.encoderName->setText( |
967 | SystemInfo::Encoder, devname).toString())); | 972 | EncoderBase::getEncoderName(PlayerBuildInfo::instance()->value( |
973 | PlayerBuildInfo::Encoder, devname).toString())); | ||
968 | 974 | ||
969 | 975 | ||
970 | EncoderBase* enc = EncoderBase::getEncoder(this,encoder); | 976 | EncoderBase* enc = EncoderBase::getEncoder(this,encoder); |
diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp index 3ac24666df..190bdb28f4 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp +++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <QFileDialog> | 21 | #include <QFileDialog> |
22 | #include "selectiveinstallwidget.h" | 22 | #include "selectiveinstallwidget.h" |
23 | #include "ui_selectiveinstallwidgetfrm.h" | 23 | #include "ui_selectiveinstallwidgetfrm.h" |
24 | #include "serverinfo.h" | 24 | #include "playerbuildinfo.h" |
25 | #include "rbsettings.h" | 25 | #include "rbsettings.h" |
26 | #include "rockboxinfo.h" | 26 | #include "rockboxinfo.h" |
27 | #include "systeminfo.h" | 27 | #include "systeminfo.h" |
@@ -71,26 +71,28 @@ SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent | |||
71 | 71 | ||
72 | void SelectiveInstallWidget::selectedVersionChanged(int index) | 72 | void SelectiveInstallWidget::selectedVersionChanged(int index) |
73 | { | 73 | { |
74 | m_buildtype = static_cast<SystemInfo::BuildType>(ui.selectedVersion->itemData(index).toInt()); | 74 | m_buildtype = static_cast<PlayerBuildInfo::BuildType>(ui.selectedVersion->itemData(index).toInt()); |
75 | bool voice = true; | 75 | bool voice = true; |
76 | switch(m_buildtype) { | 76 | switch(m_buildtype) { |
77 | case SystemInfo::BuildRelease: | 77 | case PlayerBuildInfo::TypeRelease: |
78 | ui.selectedDescription->setText(tr("This is the latest stable " | 78 | ui.selectedDescription->setText(tr("This is the latest stable " |
79 | "release available.")); | 79 | "release available.")); |
80 | voice = true; | 80 | voice = true; |
81 | break; | 81 | break; |
82 | case SystemInfo::BuildCurrent: | 82 | case PlayerBuildInfo::TypeDevel: |
83 | ui.selectedDescription->setText(tr("The development version is " | 83 | ui.selectedDescription->setText(tr("The development version is " |
84 | "updated on every code change. Last update was on %1").arg( | 84 | "updated on every code change. Last update was on %1").arg( |
85 | ServerInfo::instance()->platformValue(ServerInfo::BleedingDate).toString())); | 85 | PlayerBuildInfo::instance()->value( |
86 | PlayerBuildInfo::BuildVersion, | ||
87 | PlayerBuildInfo::TypeDevel).toString())); | ||
86 | voice = false; | 88 | voice = false; |
87 | break; | 89 | break; |
88 | case SystemInfo::BuildCandidate: | 90 | case PlayerBuildInfo::TypeCandidate: |
89 | ui.selectedDescription->setText(tr("This will eventually become the " | 91 | ui.selectedDescription->setText(tr("This will eventually become the " |
90 | "next Rockbox version. Install it to help testing.")); | 92 | "next Rockbox version. Install it to help testing.")); |
91 | voice = false; | 93 | voice = false; |
92 | break; | 94 | break; |
93 | case SystemInfo::BuildDaily: | 95 | case PlayerBuildInfo::TypeDaily: |
94 | ui.selectedDescription->setText(tr("Daily updated development version.")); | 96 | ui.selectedDescription->setText(tr("Daily updated development version.")); |
95 | voice = true; | 97 | voice = true; |
96 | break; | 98 | break; |
@@ -106,8 +108,8 @@ void SelectiveInstallWidget::updateVersion(void) | |||
106 | // get some configuration values globally | 108 | // get some configuration values globally |
107 | m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); | 109 | m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); |
108 | m_target = RbSettings::value(RbSettings::CurrentPlatform).toString(); | 110 | m_target = RbSettings::value(RbSettings::CurrentPlatform).toString(); |
109 | m_blmethod = SystemInfo::platformValue( | 111 | m_blmethod = PlayerBuildInfo::instance()->value( |
110 | SystemInfo::BootloaderMethod, m_target).toString(); | 112 | PlayerBuildInfo::BootloaderMethod, m_target).toString(); |
111 | 113 | ||
112 | if(m_logger != nullptr) { | 114 | if(m_logger != nullptr) { |
113 | delete m_logger; | 115 | delete m_logger; |
@@ -115,46 +117,29 @@ void SelectiveInstallWidget::updateVersion(void) | |||
115 | } | 117 | } |
116 | 118 | ||
117 | // re-populate all version items | 119 | // re-populate all version items |
118 | m_versions.clear(); | 120 | QMap<PlayerBuildInfo::BuildType, QString> types; |
119 | m_versions.insert(SystemInfo::BuildRelease, ServerInfo::instance()->platformValue( | 121 | types[PlayerBuildInfo::TypeRelease] = tr("Stable Release (Version %1)"); |
120 | ServerInfo::CurReleaseVersion).toString()); | 122 | if (PlayerBuildInfo::instance()->value(PlayerBuildInfo::BuildStatus).toInt() != STATUS_RETIRED) { |
121 | // Don't populate RC or development selections if target has been retired. | 123 | types[PlayerBuildInfo::TypeCandidate] = tr("Release Candidate (Revison %1)"); |
122 | if (ServerInfo::instance()->platformValue(ServerInfo::CurStatus).toInt() != STATUS_RETIRED) { | 124 | types[PlayerBuildInfo::TypeDaily] = tr("Daily Build (%1)"); |
123 | m_versions.insert(SystemInfo::BuildCurrent, ServerInfo::instance()->platformValue( | 125 | types[PlayerBuildInfo::TypeDevel] = tr("Development Version (Revison %1)"); |
124 | ServerInfo::BleedingRevision).toString()); | ||
125 | m_versions.insert(SystemInfo::BuildCandidate, ServerInfo::instance()->platformValue( | ||
126 | ServerInfo::RelCandidateVersion).toString()); | ||
127 | m_versions.insert(SystemInfo::BuildDaily, ServerInfo::instance()->platformValue( | ||
128 | ServerInfo::DailyVersion).toString()); | ||
129 | } | 126 | } |
130 | 127 | ||
131 | ui.selectedVersion->clear(); | 128 | ui.selectedVersion->clear(); |
132 | if(!m_versions[SystemInfo::BuildRelease].isEmpty()) { | 129 | for(auto i = types.begin(); i != types.end(); i++) { |
133 | ui.selectedVersion->addItem(tr("Stable Release (Version %1)").arg( | 130 | QString version = PlayerBuildInfo::instance()->value( |
134 | m_versions[SystemInfo::BuildRelease]), SystemInfo::BuildRelease); | 131 | PlayerBuildInfo::BuildVersion, i.key()).toString(); |
135 | } | 132 | if(!version.isEmpty()) |
136 | if(!m_versions[SystemInfo::BuildCurrent].isEmpty()) { | 133 | ui.selectedVersion->addItem(i.value().arg(version), i.key()); |
137 | ui.selectedVersion->addItem(tr("Development Version (Revison %1)").arg( | ||
138 | m_versions[SystemInfo::BuildCurrent]), SystemInfo::BuildCurrent); | ||
139 | } | ||
140 | if(!m_versions[SystemInfo::BuildCandidate].isEmpty()) { | ||
141 | ui.selectedVersion->addItem(tr("Release Candidate (Revison %1)").arg( | ||
142 | m_versions[SystemInfo::BuildCandidate]), SystemInfo::BuildCandidate); | ||
143 | } | ||
144 | if(!m_versions[SystemInfo::BuildDaily].isEmpty()) { | ||
145 | ui.selectedVersion->addItem(tr("Daily Build (%1)").arg( | ||
146 | m_versions[SystemInfo::BuildDaily]), SystemInfo::BuildDaily); | ||
147 | } | 134 | } |
148 | 135 | ||
149 | // select previously selected version | 136 | // select previously selected version |
150 | int index = ui.selectedVersion->findData( | 137 | int index = ui.selectedVersion->findData( |
151 | static_cast<SystemInfo::BuildType>(RbSettings::value(RbSettings::Build).toInt())); | 138 | static_cast<PlayerBuildInfo::BuildType>(RbSettings::value(RbSettings::Build).toInt())); |
152 | if(index < 0) { | 139 | if(index < 0) { |
153 | if(!m_versions[SystemInfo::BuildRelease].isEmpty()) { | 140 | index = ui.selectedVersion->findData(PlayerBuildInfo::TypeRelease); |
154 | index = ui.selectedVersion->findData(SystemInfo::BuildRelease); | 141 | if(index < 0) { |
155 | } | 142 | index = ui.selectedVersion->findData(PlayerBuildInfo::TypeDevel); |
156 | else { | ||
157 | index = ui.selectedVersion->findData(SystemInfo::BuildCurrent); | ||
158 | } | 143 | } |
159 | } | 144 | } |
160 | ui.selectedVersion->setCurrentIndex(index); | 145 | ui.selectedVersion->setCurrentIndex(index); |
@@ -295,7 +280,8 @@ void SelectiveInstallWidget::installBootloader(void) | |||
295 | // create installer | 280 | // create installer |
296 | BootloaderInstallBase *bl = | 281 | BootloaderInstallBase *bl = |
297 | BootloaderInstallHelper::createBootloaderInstaller(this, | 282 | BootloaderInstallHelper::createBootloaderInstaller(this, |
298 | SystemInfo::platformValue(SystemInfo::BootloaderMethod).toString()); | 283 | PlayerBuildInfo::instance()->value( |
284 | PlayerBuildInfo::BootloaderMethod).toString()); | ||
299 | if(bl == nullptr) { | 285 | if(bl == nullptr) { |
300 | m_logger->addItem(tr("No install method known."), LOGERROR); | 286 | m_logger->addItem(tr("No install method known."), LOGERROR); |
301 | m_logger->setFinished(); | 287 | m_logger->setFinished(); |
@@ -312,15 +298,16 @@ void SelectiveInstallWidget::installBootloader(void) | |||
312 | connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted())); | 298 | connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted())); |
313 | 299 | ||
314 | // set bootloader filename. Do this now as installed() needs it. | 300 | // set bootloader filename. Do this now as installed() needs it. |
315 | QStringList blfile = SystemInfo::platformValue(SystemInfo::BootloaderFile).toStringList(); | 301 | QStringList blfile = PlayerBuildInfo::instance()->value( |
302 | PlayerBuildInfo::BootloaderFile).toStringList(); | ||
316 | QStringList blfilepath; | 303 | QStringList blfilepath; |
317 | for(int a = 0; a < blfile.size(); a++) { | 304 | for(int a = 0; a < blfile.size(); a++) { |
318 | blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString() | 305 | blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString() |
319 | + blfile.at(a)); | 306 | + blfile.at(a)); |
320 | } | 307 | } |
321 | bl->setBlFile(blfilepath); | 308 | bl->setBlFile(blfilepath); |
322 | QUrl url(SystemInfo::value(SystemInfo::BootloaderUrl).toString() | 309 | QUrl url(PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderUrl).toString() |
323 | + SystemInfo::platformValue(SystemInfo::BootloaderName).toString()); | 310 | + PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderName).toString()); |
324 | bl->setBlUrl(url); | 311 | bl->setBlUrl(url); |
325 | bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString() | 312 | bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString() |
326 | + "/.rockbox/rbutil.log"); | 313 | + "/.rockbox/rbutil.log"); |
@@ -340,7 +327,8 @@ void SelectiveInstallWidget::installBootloader(void) | |||
340 | else if(bl->installed() == BootloaderInstallBase::BootloaderOther | 327 | else if(bl->installed() == BootloaderInstallBase::BootloaderOther |
341 | && bl->capabilities() & BootloaderInstallBase::Backup) | 328 | && bl->capabilities() & BootloaderInstallBase::Backup) |
342 | { | 329 | { |
343 | QString targetFolder = SystemInfo::platformValue(SystemInfo::Name).toString() | 330 | QString targetFolder = PlayerBuildInfo::instance()->value( |
331 | PlayerBuildInfo::DisplayName).toString() | ||
344 | + " Firmware Backup"; | 332 | + " Firmware Backup"; |
345 | // remove invalid character(s) | 333 | // remove invalid character(s) |
346 | targetFolder.remove(QRegExp("[:/]")); | 334 | targetFolder.remove(QRegExp("[:/]")); |
@@ -377,7 +365,7 @@ void SelectiveInstallWidget::installBootloader(void) | |||
377 | // open dialog to browse to of file | 365 | // open dialog to browse to of file |
378 | QString offile; | 366 | QString offile; |
379 | QString filter | 367 | QString filter |
380 | = SystemInfo::platformValue(SystemInfo::BootloaderFilter).toString(); | 368 | = PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderFilter).toString(); |
381 | if(!filter.isEmpty()) { | 369 | if(!filter.isEmpty()) { |
382 | filter = tr("Bootloader files (%1)").arg(filter) + ";;"; | 370 | filter = tr("Bootloader files (%1)").arg(filter) + ";;"; |
383 | } | 371 | } |
@@ -442,23 +430,8 @@ void SelectiveInstallWidget::installRockbox(void) | |||
442 | RbSettings::setValue(RbSettings::Build, m_buildtype); | 430 | RbSettings::setValue(RbSettings::Build, m_buildtype); |
443 | RbSettings::sync(); | 431 | RbSettings::sync(); |
444 | 432 | ||
445 | switch(m_buildtype) { | 433 | url = PlayerBuildInfo::instance()->value( |
446 | case SystemInfo::BuildRelease: | 434 | PlayerBuildInfo::BuildUrl, m_buildtype).toString(); |
447 | url = ServerInfo::instance()->platformValue( | ||
448 | ServerInfo::CurReleaseUrl, m_target).toString(); | ||
449 | break; | ||
450 | case SystemInfo::BuildCurrent: | ||
451 | url = ServerInfo::instance()->platformValue( | ||
452 | ServerInfo::CurDevelUrl, m_target).toString(); | ||
453 | break; | ||
454 | case SystemInfo::BuildCandidate: | ||
455 | url = ServerInfo::instance()->platformValue( | ||
456 | ServerInfo::RelCandidateUrl, m_target).toString(); | ||
457 | break; | ||
458 | case SystemInfo::BuildDaily: | ||
459 | url = ServerInfo::instance()->platformValue( | ||
460 | ServerInfo::DailyUrl, m_target).toString(); | ||
461 | } | ||
462 | //! install build | 435 | //! install build |
463 | if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater(); | 436 | if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater(); |
464 | m_zipinstaller = new ZipInstaller(this); | 437 | m_zipinstaller = new ZipInstaller(this); |
@@ -466,7 +439,8 @@ void SelectiveInstallWidget::installRockbox(void) | |||
466 | m_zipinstaller->setLogSection("Rockbox (Base)"); | 439 | m_zipinstaller->setLogSection("Rockbox (Base)"); |
467 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) | 440 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
468 | m_zipinstaller->setCache(true); | 441 | m_zipinstaller->setCache(true); |
469 | m_zipinstaller->setLogVersion(m_versions[m_buildtype]); | 442 | m_zipinstaller->setLogVersion(PlayerBuildInfo::instance()->value( |
443 | PlayerBuildInfo::BuildVersion, m_buildtype).toString()); | ||
470 | m_zipinstaller->setMountPoint(m_mountpoint); | 444 | m_zipinstaller->setMountPoint(m_mountpoint); |
471 | 445 | ||
472 | connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); | 446 | connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); |
@@ -497,7 +471,8 @@ void SelectiveInstallWidget::installFonts(void) | |||
497 | // release is empty for non-release versions (i.e. daily / current) | 471 | // release is empty for non-release versions (i.e. daily / current) |
498 | logversion = installInfo.release(); | 472 | logversion = installInfo.release(); |
499 | } | 473 | } |
500 | fontsurl = SystemInfo::value(SystemInfo::FontUrl, m_buildtype).toString(); | 474 | fontsurl = PlayerBuildInfo::instance()->value( |
475 | PlayerBuildInfo::BuildFontUrl, m_buildtype).toString(); | ||
501 | fontsurl.replace("%RELVERSION%", relversion); | 476 | fontsurl.replace("%RELVERSION%", relversion); |
502 | 477 | ||
503 | // create new zip installer | 478 | // create new zip installer |
@@ -532,13 +507,12 @@ void SelectiveInstallWidget::installVoicefile(void) | |||
532 | QString voiceurl; | 507 | QString voiceurl; |
533 | QString logversion; | 508 | QString logversion; |
534 | QString relversion = installInfo.release(); | 509 | QString relversion = installInfo.release(); |
535 | if(m_buildtype != SystemInfo::BuildRelease) { | 510 | if(m_buildtype != PlayerBuildInfo::TypeRelease) { |
536 | // release is empty for non-release versions (i.e. daily / current) | 511 | // release is empty for non-release versions (i.e. daily / current) |
537 | logversion = installInfo.release(); | 512 | logversion = installInfo.release(); |
538 | } | 513 | } |
539 | voiceurl = SystemInfo::value(SystemInfo::VoiceUrl, m_buildtype).toString(); | 514 | voiceurl = PlayerBuildInfo::instance()->value( |
540 | voiceurl.replace("%RELVERSION%", m_versions[m_buildtype]); | 515 | PlayerBuildInfo::BuildVoiceUrl, m_buildtype).toString(); |
541 | voiceurl.replace("%MODEL%", m_target); | ||
542 | voiceurl.replace("%LANGUAGE%", lang); | 516 | voiceurl.replace("%LANGUAGE%", lang); |
543 | 517 | ||
544 | // create new zip installer | 518 | // create new zip installer |
@@ -573,18 +547,13 @@ void SelectiveInstallWidget::installManual(void) | |||
573 | QString manualurl; | 547 | QString manualurl; |
574 | QString logversion; | 548 | QString logversion; |
575 | QString relversion = installInfo.release(); | 549 | QString relversion = installInfo.release(); |
576 | if(m_buildtype != SystemInfo::BuildRelease) { | 550 | if(m_buildtype != PlayerBuildInfo::TypeRelease) { |
577 | // release is empty for non-release versions (i.e. daily / current) | 551 | // release is empty for non-release versions (i.e. daily / current) |
578 | logversion = installInfo.release(); | 552 | logversion = installInfo.release(); |
579 | } | 553 | } |
580 | 554 | ||
581 | manualurl = SystemInfo::value(SystemInfo::ManualUrl, m_buildtype).toString(); | 555 | manualurl = PlayerBuildInfo::instance()->value( |
582 | manualurl.replace("%RELVERSION%", m_versions[m_buildtype]); | 556 | PlayerBuildInfo::BuildManualUrl, m_buildtype).toString(); |
583 | QString model = SystemInfo::platformValue(SystemInfo::Manual, m_target).toString(); | ||
584 | if(model.isEmpty()) | ||
585 | model = m_target; | ||
586 | manualurl.replace("%MODEL%", model); | ||
587 | |||
588 | if(mantype == "pdf") | 557 | if(mantype == "pdf") |
589 | manualurl.replace("%FORMAT%", ".pdf"); | 558 | manualurl.replace("%FORMAT%", ".pdf"); |
590 | else | 559 | else |
@@ -644,15 +613,15 @@ void SelectiveInstallWidget::installThemes(void) | |||
644 | 613 | ||
645 | static const struct { | 614 | static const struct { |
646 | const char *name; | 615 | const char *name; |
647 | const char *pluginpath; | 616 | const char *rockfile; |
648 | SystemInfo::SystemInfos zipurl; // add new games to SystemInfo | 617 | PlayerBuildInfo::BuildInfo zipurl; // add new games to PlayerBuildInfo |
649 | } GamesList[] = { | 618 | } GamesList[] = { |
650 | { "Doom", "/.rockbox/rocks/games/doom.rock", SystemInfo::DoomUrl }, | 619 | { "Doom", "games/doom.rock", PlayerBuildInfo::DoomUrl }, |
651 | { "Duke3D", "/.rockbox/rocks/games/duke3d.rock", SystemInfo::Duke3DUrl }, | 620 | { "Duke3D", "games/duke3d.rock", PlayerBuildInfo::Duke3DUrl }, |
652 | { "Quake", "/.rockbox/rocks/games/quake.rock", SystemInfo::QuakeUrl }, | 621 | { "Quake", "games/quake.rock", PlayerBuildInfo::QuakeUrl }, |
653 | { "Puzzles fonts", "/.rockbox/rocks/games/sgt-blackbox.rock", SystemInfo::PuzzFontsUrl }, | 622 | { "Puzzles fonts", "games/sgt-blackbox.rock", PlayerBuildInfo::PuzzFontsUrl }, |
654 | { "Wolf3D", "/.rockbox/rocks/games/wolf3d.rock", SystemInfo::Wolf3DUrl }, | 623 | { "Wolf3D", "games/wolf3d.rock", PlayerBuildInfo::Wolf3DUrl }, |
655 | { "XWorld", "/.rockbox/rocks/games/xworld.rock", SystemInfo::XWorldUrl }, | 624 | { "XWorld", "games/xworld.rock", PlayerBuildInfo::XWorldUrl }, |
656 | }; | 625 | }; |
657 | 626 | ||
658 | void SelectiveInstallWidget::installGamefiles(void) | 627 | void SelectiveInstallWidget::installGamefiles(void) |
@@ -665,10 +634,13 @@ void SelectiveInstallWidget::installGamefiles(void) | |||
665 | for(unsigned int i = 0; i < sizeof(GamesList) / sizeof(GamesList[0]); i++) | 634 | for(unsigned int i = 0; i < sizeof(GamesList) / sizeof(GamesList[0]); i++) |
666 | { | 635 | { |
667 | // check if installed Rockbox has this plugin. | 636 | // check if installed Rockbox has this plugin. |
668 | if(QFileInfo(m_mountpoint + GamesList[i].pluginpath).exists()) { | 637 | if(QFileInfo(m_mountpoint + "/.rockbox/rocks/" + GamesList[i].rockfile).exists()) { |
669 | gameNames.append(GamesList[i].name); | 638 | gameNames.append(GamesList[i].name); |
670 | gameUrls.append(SystemInfo::value(GamesList[i].zipurl).toString()); | 639 | // game URLs do not depend on the actual build type, but we need |
671 | LOG_INFO() << gameUrls.at(gameUrls.size() - 1); | 640 | // to pass it (simplifies the API, and will allow to make them |
641 | // type specific later if needed) | ||
642 | gameUrls.append(PlayerBuildInfo::instance()->value( | ||
643 | GamesList[i].zipurl, m_buildtype).toString()); | ||
672 | } | 644 | } |
673 | } | 645 | } |
674 | 646 | ||
diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.h b/rbutil/rbutilqt/gui/selectiveinstallwidget.h index 7a969a9e89..6cd1936de5 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidget.h +++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "zipinstaller.h" | 25 | #include "zipinstaller.h" |
26 | #include "themesinstallwindow.h" | 26 | #include "themesinstallwindow.h" |
27 | #include "systeminfo.h" | 27 | #include "systeminfo.h" |
28 | #include "playerbuildinfo.h" | ||
28 | 29 | ||
29 | class SelectiveInstallWidget : public QWidget | 30 | class SelectiveInstallWidget : public QWidget |
30 | { | 31 | { |
@@ -65,9 +66,8 @@ class SelectiveInstallWidget : public QWidget | |||
65 | ProgressLoggerGui *m_logger; | 66 | ProgressLoggerGui *m_logger; |
66 | int m_installStage; | 67 | int m_installStage; |
67 | ZipInstaller *m_zipinstaller; | 68 | ZipInstaller *m_zipinstaller; |
68 | QMap<SystemInfo::BuildType, QString> m_versions; | ||
69 | ThemesInstallWindow *m_themesinstaller; | 69 | ThemesInstallWindow *m_themesinstaller; |
70 | SystemInfo::BuildType m_buildtype; | 70 | PlayerBuildInfo::BuildType m_buildtype; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | #endif | 73 | #endif |
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini index 321d4bd096..9a99909f92 100644 --- a/rbutil/rbutilqt/rbutil.ini +++ b/rbutil/rbutilqt/rbutil.ini | |||
@@ -20,32 +20,6 @@ rbutil_url=http://download.rockbox.org/rbutil/ | |||
20 | info_url=http://download.rockbox.org/bootloader/bootloaders-info | 20 | info_url=http://download.rockbox.org/bootloader/bootloaders-info |
21 | download_url=http://download.rockbox.org/bootloader | 21 | download_url=http://download.rockbox.org/bootloader |
22 | 22 | ||
23 | [release] | ||
24 | build_url=https://download.rockbox.org/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip | ||
25 | voice_url=https://download.rockbox.org/release/%RELVERSION%/%MODEL%-%RELVERSION%-%LANGUAGE%.zip | ||
26 | font_url=https://download.rockbox.org/release/%RELVERSION%/rockbox-fonts-%RELVERSION%.zip | ||
27 | manual_url=https://download.rockbox.org/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%%FORMAT% | ||
28 | |||
29 | [release-candidate] | ||
30 | build_url=https://download.rockbox.org/release-candidate/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip | ||
31 | voice_url=https://download.rockbox.org/release-candidate/%RELVERSION%/%MODEL%-%RELVERSION%-%LANGUAGE%.zip | ||
32 | font_url=https://download.rockbox.org/release-candidate/%RELVERSION%/rockbox-fonts-%RELVERSION%.zip | ||
33 | manual_url=https://download.rockbox.org/release-candidate/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%%FORMAT% | ||
34 | |||
35 | [development] | ||
36 | build_url=http://build.rockbox.org/data/rockbox-%MODEL%.zip | ||
37 | ; we don't have voices for dev builds. | ||
38 | voice_url=https://download.rockbox.org/daily/voices/%MODEL%-%LANGUAGE%.zip | ||
39 | font_url=https://download.rockbox.org/daily/fonts/rockbox-fonts.zip | ||
40 | ; manual is only built daily, use that one instead. | ||
41 | manual_url=https://download.rockbox.org/daily/manual/rockbox-%MODEL%%FORMAT% | ||
42 | |||
43 | [daily] | ||
44 | build_url=https://download.rockbox.org/daily/%MODEL%/rockbox-%MODEL%.zip | ||
45 | voice_url=https://download.rockbox.org/daily/%MODEL%/voice-%MODEL%-%LANGUAGE%.zip | ||
46 | font_url=https://download.rockbox.org/daily/fonts/rockbox-fonts.zip | ||
47 | manual_url=https://download.rockbox.org/daily/manual/rockbox-%MODEL%%FORMAT% | ||
48 | |||
49 | ; [platforms] is used to determine the order in the device tree. | 23 | ; [platforms] is used to determine the order in the device tree. |
50 | ; Only devices present in this section will get displayed! | 24 | ; Only devices present in this section will get displayed! |
51 | [platforms] | 25 | [platforms] |
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 4953db3470..a5c5967862 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "system.h" | 35 | #include "system.h" |
36 | #include "systrace.h" | 36 | #include "systrace.h" |
37 | #include "rbsettings.h" | 37 | #include "rbsettings.h" |
38 | #include "serverinfo.h" | 38 | #include "playerbuildinfo.h" |
39 | #include "systeminfo.h" | 39 | #include "systeminfo.h" |
40 | #include "ziputil.h" | 40 | #include "ziputil.h" |
41 | #include "infowidget.h" | 41 | #include "infowidget.h" |
@@ -224,7 +224,7 @@ void RbUtilQt::downloadInfo() | |||
224 | ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); | 224 | ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); |
225 | LOG_INFO() << "downloading build info"; | 225 | LOG_INFO() << "downloading build info"; |
226 | daily->setFile(&buildInfo); | 226 | daily->setFile(&buildInfo); |
227 | daily->getFile(QUrl(SystemInfo::value(SystemInfo::BuildInfoUrl).toString())); | 227 | daily->getFile(QUrl(PlayerBuildInfo::instance()->value(PlayerBuildInfo::BuildInfoUrl).toString())); |
228 | } | 228 | } |
229 | 229 | ||
230 | 230 | ||
@@ -241,9 +241,9 @@ void RbUtilQt::downloadDone(bool error) | |||
241 | } | 241 | } |
242 | LOG_INFO() << "network status:" << daily->errorString(); | 242 | LOG_INFO() << "network status:" << daily->errorString(); |
243 | 243 | ||
244 | // read info into ServerInfo object | 244 | // read info into PlayerBuildInfo object |
245 | buildInfo.open(); | 245 | buildInfo.open(); |
246 | ServerInfo::instance()->readBuildInfo(buildInfo.fileName()); | 246 | PlayerBuildInfo::instance()->setBuildInfo(buildInfo.fileName()); |
247 | buildInfo.close(); | 247 | buildInfo.close(); |
248 | 248 | ||
249 | ui.statusbar->showMessage(tr("Download build information finished."), 5000); | 249 | ui.statusbar->showMessage(tr("Download build information finished."), 5000); |
@@ -380,11 +380,11 @@ void RbUtilQt::updateDevice() | |||
380 | 380 | ||
381 | /* Enable bootloader installation, if possible */ | 381 | /* Enable bootloader installation, if possible */ |
382 | bool bootloaderInstallable = | 382 | bool bootloaderInstallable = |
383 | SystemInfo::platformValue(SystemInfo::BootloaderMethod) != "none"; | 383 | PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderMethod).toString() != "none"; |
384 | 384 | ||
385 | /* Enable bootloader uninstallation, if possible */ | 385 | /* Enable bootloader uninstallation, if possible */ |
386 | bool bootloaderUninstallable = bootloaderInstallable && | 386 | bool bootloaderUninstallable = bootloaderInstallable && |
387 | SystemInfo::platformValue(SystemInfo::BootloaderMethod) != "fwpatcher"; | 387 | PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderMethod) != "fwpatcher"; |
388 | ui.labelRemoveBootloader->setEnabled(bootloaderUninstallable); | 388 | ui.labelRemoveBootloader->setEnabled(bootloaderUninstallable); |
389 | ui.buttonRemoveBootloader->setEnabled(bootloaderUninstallable); | 389 | ui.buttonRemoveBootloader->setEnabled(bootloaderUninstallable); |
390 | ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable); | 390 | ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable); |
@@ -395,10 +395,11 @@ void RbUtilQt::updateDevice() | |||
395 | ui.menuA_ctions->setEnabled(configurationValid); | 395 | ui.menuA_ctions->setEnabled(configurationValid); |
396 | 396 | ||
397 | // displayed device info | 397 | // displayed device info |
398 | QString brand = SystemInfo::platformValue(SystemInfo::Brand).toString(); | 398 | QString brand = PlayerBuildInfo::instance()->value(PlayerBuildInfo::Brand).toString(); |
399 | QString name | 399 | QString name |
400 | = QString("%1 (%2)").arg(SystemInfo::platformValue(SystemInfo::Name).toString(), | 400 | = QString("%1 (%2)").arg( |
401 | ServerInfo::instance()->statusAsString()); | 401 | PlayerBuildInfo::instance()->value(PlayerBuildInfo::DisplayName).toString(), |
402 | PlayerBuildInfo::instance()->statusAsString()); | ||
402 | ui.labelDevice->setText(QString("<b>%1 %2</b>").arg(brand, name)); | 403 | ui.labelDevice->setText(QString("<b>%1 %2</b>").arg(brand, name)); |
403 | 404 | ||
404 | QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); | 405 | QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); |
@@ -413,7 +414,7 @@ void RbUtilQt::updateDevice() | |||
413 | } | 414 | } |
414 | 415 | ||
415 | QPixmap pm; | 416 | QPixmap pm; |
416 | QString m = SystemInfo::platformValue(SystemInfo::PlayerPicture).toString(); | 417 | QString m = PlayerBuildInfo::instance()->value(PlayerBuildInfo::PlayerPicture).toString(); |
417 | pm.load(":/icons/players/" + m + "-small.png"); | 418 | pm.load(":/icons/players/" + m + "-small.png"); |
418 | pm = pm.scaledToHeight(QFontMetrics(QApplication::font()).height() * 3); | 419 | pm = pm.scaledToHeight(QFontMetrics(QApplication::font()).height() * 3); |
419 | ui.labelPlayerPic->setPixmap(pm); | 420 | ui.labelPlayerPic->setPixmap(pm); |
@@ -478,14 +479,14 @@ void RbUtilQt::uninstallBootloader(void) | |||
478 | // create installer | 479 | // create installer |
479 | BootloaderInstallBase *bl | 480 | BootloaderInstallBase *bl |
480 | = BootloaderInstallHelper::createBootloaderInstaller(this, | 481 | = BootloaderInstallHelper::createBootloaderInstaller(this, |
481 | SystemInfo::platformValue(SystemInfo::BootloaderMethod).toString()); | 482 | PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderMethod).toString()); |
482 | 483 | ||
483 | if(bl == nullptr) { | 484 | if(bl == nullptr) { |
484 | logger->addItem(tr("No uninstall method for this target known."), LOGERROR); | 485 | logger->addItem(tr("No uninstall method for this target known."), LOGERROR); |
485 | logger->setFinished(); | 486 | logger->setFinished(); |
486 | return; | 487 | return; |
487 | } | 488 | } |
488 | QStringList blfile = SystemInfo::platformValue(SystemInfo::BootloaderFile).toStringList(); | 489 | QStringList blfile = PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderFile).toStringList(); |
489 | QStringList blfilepath; | 490 | QStringList blfilepath; |
490 | for(int a = 0; a < blfile.size(); a++) { | 491 | for(int a = 0; a < blfile.size(); a++) { |
491 | blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString() | 492 | blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString() |
@@ -610,8 +611,8 @@ bool RbUtilQt::chkConfig(QWidget *parent) | |||
610 | 611 | ||
611 | void RbUtilQt::checkUpdate(void) | 612 | void RbUtilQt::checkUpdate(void) |
612 | { | 613 | { |
613 | QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString(); | 614 | QString url = PlayerBuildInfo::instance()->value(PlayerBuildInfo::RbutilUrl).toString(); |
614 | #if defined(Q_OS_WIN32) | 615 | #if defined(Q_OS_WIN32) |
615 | url += "win32/"; | 616 | url += "win32/"; |
616 | #elif defined(Q_OS_LINUX) | 617 | #elif defined(Q_OS_LINUX) |
617 | url += "linux/"; | 618 | url += "linux/"; |
@@ -678,8 +679,8 @@ void RbUtilQt::downloadUpdateDone(bool error) | |||
678 | // if we found something newer, display info | 679 | // if we found something newer, display info |
679 | if(foundVersion != "") | 680 | if(foundVersion != "") |
680 | { | 681 | { |
681 | QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString(); | 682 | QString url = PlayerBuildInfo::instance()->value(PlayerBuildInfo::RbutilUrl).toString(); |
682 | #if defined(Q_OS_WIN32) | 683 | #if defined(Q_OS_WIN32) |
683 | url += "win32/"; | 684 | url += "win32/"; |
684 | #elif defined(Q_OS_LINUX) | 685 | #elif defined(Q_OS_LINUX) |
685 | url += "linux/"; | 686 | url += "linux/"; |
@@ -707,7 +708,7 @@ void RbUtilQt::changeEvent(QEvent *e) | |||
707 | if(e->type() == QEvent::LanguageChange) { | 708 | if(e->type() == QEvent::LanguageChange) { |
708 | ui.retranslateUi(this); | 709 | ui.retranslateUi(this); |
709 | buildInfo.open(); | 710 | buildInfo.open(); |
710 | ServerInfo::instance()->readBuildInfo(buildInfo.fileName()); | 711 | PlayerBuildInfo::instance()->setBuildInfo(buildInfo.fileName()); |
711 | buildInfo.close(); | 712 | buildInfo.close(); |
712 | updateDevice(); | 713 | updateDevice(); |
713 | } else { | 714 | } else { |
diff --git a/rbutil/rbutilqt/rbutilqt.pri b/rbutil/rbutilqt/rbutilqt.pri index c8f60052c4..bf127819fd 100644 --- a/rbutil/rbutilqt/rbutilqt.pri +++ b/rbutil/rbutilqt/rbutilqt.pri | |||
@@ -48,7 +48,6 @@ SOURCES += \ | |||
48 | base/voicefile.cpp \ | 48 | base/voicefile.cpp \ |
49 | createvoicewindow.cpp \ | 49 | createvoicewindow.cpp \ |
50 | base/rbsettings.cpp \ | 50 | base/rbsettings.cpp \ |
51 | base/serverinfo.cpp \ | ||
52 | base/systeminfo.cpp \ | 51 | base/systeminfo.cpp \ |
53 | base/system.cpp \ | 52 | base/system.cpp \ |
54 | sysinfo.cpp \ | 53 | sysinfo.cpp \ |
@@ -82,6 +81,7 @@ SOURCES += \ | |||
82 | mspack/system-mspack.c \ | 81 | mspack/system-mspack.c \ |
83 | base/mspackutil.cpp \ | 82 | base/mspackutil.cpp \ |
84 | base/archiveutil.cpp \ | 83 | base/archiveutil.cpp \ |
84 | base/playerbuildinfo.cpp | ||
85 | 85 | ||
86 | 86 | ||
87 | HEADERS += \ | 87 | HEADERS += \ |
@@ -127,7 +127,6 @@ HEADERS += \ | |||
127 | base/voicefile.h \ | 127 | base/voicefile.h \ |
128 | createvoicewindow.h \ | 128 | createvoicewindow.h \ |
129 | base/rbsettings.h \ | 129 | base/rbsettings.h \ |
130 | base/serverinfo.h \ | ||
131 | base/systeminfo.h \ | 130 | base/systeminfo.h \ |
132 | sysinfo.h \ | 131 | sysinfo.h \ |
133 | base/system.h \ | 132 | base/system.h \ |
@@ -173,6 +172,7 @@ HEADERS += \ | |||
173 | mspack/szdd.h \ | 172 | mspack/szdd.h \ |
174 | base/mspackutil.h \ | 173 | base/mspackutil.h \ |
175 | base/archiveutil.h \ | 174 | base/archiveutil.h \ |
175 | base/playerbuildinfo.h | ||
176 | 176 | ||
177 | 177 | ||
178 | FORMS += \ | 178 | FORMS += \ |
diff --git a/rbutil/rbutilqt/test/stubs/stubs-playerbuildinfo.cpp b/rbutil/rbutilqt/test/stubs/stubs-playerbuildinfo.cpp new file mode 100644 index 0000000000..8856645e89 --- /dev/null +++ b/rbutil/rbutilqt/test/stubs/stubs-playerbuildinfo.cpp | |||
@@ -0,0 +1,36 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2020 Dominik Riebeling | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | // Stubs for PlayerBuildInfo unit test. | ||
22 | |||
23 | #include "rbsettings.h" | ||
24 | |||
25 | static QMap<RbSettings::UserSettings, QVariant> stubUserSettings; | ||
26 | |||
27 | void RbSettings::setValue(UserSettings setting, QVariant value) | ||
28 | { | ||
29 | stubUserSettings[setting] = value; | ||
30 | } | ||
31 | |||
32 | QVariant RbSettings::value(UserSettings setting) | ||
33 | { | ||
34 | return stubUserSettings[setting]; | ||
35 | } | ||
36 | |||
diff --git a/rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp b/rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp deleted file mode 100644 index f0fcaf6613..0000000000 --- a/rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2020 Dominik Riebeling | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | // Stubs for ServerInfo unit test. | ||
22 | |||
23 | #include "rbsettings.h" | ||
24 | #include "systeminfo.h" | ||
25 | |||
26 | QVariant SystemInfo::platformValue(SystemInfo::PlatformInfo info, QString platform) | ||
27 | { | ||
28 | switch(info) { | ||
29 | case SystemInfo::Manual: | ||
30 | if (platform == "iriverh120") return "iriverh100"; | ||
31 | if (platform == "ipodmini2g") return "ipodmini1g"; | ||
32 | break; | ||
33 | case SystemInfo::BuildserverModel: | ||
34 | return platform.split('.').at(0); | ||
35 | default: | ||
36 | return QString(); | ||
37 | } | ||
38 | return QString(); | ||
39 | } | ||
40 | |||
41 | QVariant SystemInfo::value(SystemInfo::SystemInfos info, SystemInfo::BuildType type) | ||
42 | { | ||
43 | (void)info; // test is currently only using BuildUrl. | ||
44 | switch(type) { | ||
45 | case SystemInfo::BuildCurrent: | ||
46 | return QString("https://unittest/dev/rockbox-%MODEL%.zip"); | ||
47 | case SystemInfo::BuildDaily: | ||
48 | return QString("https://unittest/daily/rockbox-%MODEL%-%RELVERSION%.zip"); | ||
49 | case SystemInfo::BuildRelease: | ||
50 | return QString("https://unittest/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip"); | ||
51 | case SystemInfo::BuildCandidate: | ||
52 | return QString("https://unittest/rc/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip"); | ||
53 | default: | ||
54 | break; | ||
55 | } | ||
56 | return QString(); | ||
57 | } | ||
58 | |||
59 | QStringList SystemInfo::platforms(SystemInfo::PlatformType type, QString variant) | ||
60 | { | ||
61 | // stub implementation: we have a fixed list of players, and only iaudiox5 | ||
62 | // has variant iaudiox5.v | ||
63 | QStringList result; | ||
64 | result << "iriverh100" << "iriverh120" << "iriverh300" | ||
65 | << "ipodmini2g" << "archosrecorder" << "archosfmrecorder" | ||
66 | << "gigabeatfx" << "iaudiom3" << "sansae200" << "iriverh10"; | ||
67 | switch (type) | ||
68 | { | ||
69 | case SystemInfo::PlatformBaseDisabled: | ||
70 | // return base platforms only, i.e. return iaudiox5 for iaudiox5.v | ||
71 | result << "iaudiox5"; | ||
72 | break; | ||
73 | case SystemInfo::PlatformVariantDisabled: | ||
74 | // return variants for the passed variant | ||
75 | if (variant == "iaudiox5") { | ||
76 | result.clear(); | ||
77 | result << "iaudiox5" << "iaudiox5.v"; | ||
78 | } | ||
79 | else { | ||
80 | result.clear(); | ||
81 | result << variant; | ||
82 | } | ||
83 | break; | ||
84 | case SystemInfo::PlatformAllDisabled: | ||
85 | // return all, both with and without variant. | ||
86 | result << "iaudiox5" << "iaudiox5.v"; | ||
87 | break; | ||
88 | default: | ||
89 | break; | ||
90 | } | ||
91 | return result; | ||
92 | } | ||
93 | |||
94 | |||
95 | QVariant RbSettings::value(UserSettings setting) | ||
96 | { | ||
97 | switch (setting) | ||
98 | { | ||
99 | case RbSettings::CurrentPlatform: | ||
100 | return QString("ipodmini2g"); | ||
101 | default: | ||
102 | return QString(""); | ||
103 | } | ||
104 | } | ||
105 | |||
diff --git a/rbutil/rbutilqt/test/test-playerbuildinfo.cpp b/rbutil/rbutilqt/test/test-playerbuildinfo.cpp new file mode 100644 index 0000000000..fe07ba8348 --- /dev/null +++ b/rbutil/rbutilqt/test/test-playerbuildinfo.cpp | |||
@@ -0,0 +1,237 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2020 Dominik Riebeling | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include <QtTest> | ||
22 | #include <QObject> | ||
23 | #include "playerbuildinfo.h" | ||
24 | #include "rbsettings.h" | ||
25 | |||
26 | class TestPlayerBuildInfo : public QObject | ||
27 | { | ||
28 | Q_OBJECT | ||
29 | |||
30 | private slots: | ||
31 | void testBuildInfo(); | ||
32 | void testBuildInfo_data(); | ||
33 | void testPlayerInfo(); | ||
34 | void testPlayerInfo_data(); | ||
35 | }; | ||
36 | |||
37 | const char* testinfo = | ||
38 | "[release]\n" | ||
39 | "build_url=https://buildurl/release/%VERSION%/rockbox-%TARGET%-%VERSION%.zip\n" | ||
40 | "voice_url=https://buildurl/release/%VERSION%/voice-%TARGET%-%VERSION%.zip\n" | ||
41 | "manual_url=https://buildurl/release/%VERSION%/manual-%TARGET%-%VERSION%.zip\n" | ||
42 | "source_url=https://buildurl/release/%VERSION%/rockbox-%TARGET%-src-%VERSION%.zip\n" | ||
43 | "font_url=https://buildurl/release/%VERSION%/fonts-%VERSION%.zip\n" | ||
44 | "archosfmrecorder=3.11.2\n" | ||
45 | "iaudiom3=3.11.2,http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip\n" | ||
46 | "sansae200 = 3.15\n" | ||
47 | "iriverh100 = 3.11.2, http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip\n" | ||
48 | "iriverh120 = 3.3\n" | ||
49 | "iriverh300 = \n" | ||
50 | "[release-candidate]\n" | ||
51 | "build_url=https://buildurl/rc/%VERSION%/rockbox-%TARGET%-%VERSION%.zip\n" | ||
52 | "gigabeatfx=f9dce96,http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip\n" | ||
53 | "archosfmrecorder=f9dce96\n" | ||
54 | "archosrecorder = f9dce96\n" | ||
55 | "iaudiox5=f9dce96,http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip\n" | ||
56 | "[development]\n" | ||
57 | "build_url=https://buildurl/dev/rockbox-%TARGET%.zip\n" | ||
58 | "iriverh100 = be1be79\n" | ||
59 | "iaudiox5 = be1be76\n" | ||
60 | "[dailies]\n" | ||
61 | "timestamp = 20201113\n" | ||
62 | "rev = 362f7a3\n" | ||
63 | "[daily]\n" | ||
64 | "build_url=https://buildurl/daily/rockbox-%TARGET%-%VERSION%.zip\n" | ||
65 | "iriverh100 = f9dce00\n" | ||
66 | "[bleeding]\n" | ||
67 | "timestamp = 20201114T105723Z\n" | ||
68 | "rev = be1be79\n" | ||
69 | "[status]\n" | ||
70 | "archosfmrecorder=3\n" | ||
71 | "iriverh100=2\n" | ||
72 | "iriverh300=1\n" | ||
73 | "iriverh10=0\n" | ||
74 | "[voices]\n" | ||
75 | "3.15=english,francais\n" | ||
76 | "3.11.2=english\n" | ||
77 | "daily=deutsch,english,francais\n" | ||
78 | ; | ||
79 | |||
80 | Q_DECLARE_METATYPE(PlayerBuildInfo::BuildInfo); | ||
81 | Q_DECLARE_METATYPE(PlayerBuildInfo::BuildType); | ||
82 | Q_DECLARE_METATYPE(PlayerBuildInfo::DeviceInfo); | ||
83 | |||
84 | struct { | ||
85 | QString target; | ||
86 | PlayerBuildInfo::BuildInfo item; | ||
87 | PlayerBuildInfo::BuildType type; | ||
88 | QString expected; | ||
89 | } testdataBuild[] = | ||
90 | { | ||
91 | // release builds | ||
92 | { "iriverh100", PlayerBuildInfo::BuildVoiceLangs, PlayerBuildInfo::TypeRelease, "english" }, | ||
93 | { "iriverh300", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeRelease, "" }, | ||
94 | { "iriverh300", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeRelease, "" }, | ||
95 | { "iriverh10", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeRelease, "" }, | ||
96 | { "iriverh10", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeRelease, "" }, | ||
97 | { "archosfmrecorder", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeRelease, "3.11.2" }, | ||
98 | { "iaudiom3", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeRelease, "3.11.2" }, | ||
99 | { "iaudiom3", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeRelease, "http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip" }, | ||
100 | { "sansae200", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeRelease, "3.15" }, | ||
101 | { "sansae200", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeRelease, "https://buildurl/release/3.15/rockbox-sansae200-3.15.zip" }, | ||
102 | { "iriverh100", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeRelease, "3.11.2" }, | ||
103 | { "iriverh100", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeRelease, "http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip" }, | ||
104 | { "iriverh100", PlayerBuildInfo::BuildVoiceUrl, PlayerBuildInfo::TypeRelease, "https://buildurl/release/3.11.2/voice-iriverh100-3.11.2.zip" }, | ||
105 | { "iriverh100", PlayerBuildInfo::BuildManualUrl, PlayerBuildInfo::TypeRelease, "https://buildurl/release/3.11.2/manual-iriverh100-3.11.2.zip" }, | ||
106 | { "iriverh100", PlayerBuildInfo::BuildSourceUrl, PlayerBuildInfo::TypeRelease, "https://buildurl/release/3.11.2/rockbox-iriverh100-src-3.11.2.zip" }, | ||
107 | // h120 uses the same manual as h100. | ||
108 | { "iriverh120", PlayerBuildInfo::BuildManualUrl, PlayerBuildInfo::TypeRelease, "https://buildurl/release/3.3/manual-iriverh100-3.3.zip" }, | ||
109 | { "iriverh100", PlayerBuildInfo::BuildFontUrl, PlayerBuildInfo::TypeRelease, "https://buildurl/release/3.11.2/fonts-3.11.2.zip" }, | ||
110 | |||
111 | // rc builds | ||
112 | { "gigabeatfx", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeCandidate, "f9dce96" }, | ||
113 | { "gigabeatfx", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeCandidate, "http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip" }, | ||
114 | { "archosfmrecorder", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeCandidate, "f9dce96" }, | ||
115 | { "archosfmrecorder", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeCandidate, "https://buildurl/rc/f9dce96/rockbox-archosfmrecorder-f9dce96.zip" }, | ||
116 | { "archosrecorder", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeCandidate, "f9dce96" }, | ||
117 | { "archosrecorder", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeCandidate, "https://buildurl/rc/f9dce96/rockbox-archosrecorder-f9dce96.zip" }, | ||
118 | { "iaudiox5", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeCandidate, "f9dce96" }, | ||
119 | { "iaudiox5", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeCandidate, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" }, | ||
120 | { "iaudiox5.v", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeCandidate, "f9dce96" }, | ||
121 | { "iaudiox5.v", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeCandidate, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" }, | ||
122 | |||
123 | // devel builds | ||
124 | { "iriverh100", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeDevel, "https://buildurl/dev/rockbox-iriverh100.zip" }, | ||
125 | { "iaudiox5.v", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeDevel, "be1be76" }, | ||
126 | { "iaudiox5.v", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeDevel, "https://buildurl/dev/rockbox-iaudiox5.zip" }, | ||
127 | |||
128 | // daily builds | ||
129 | { "iriverh100", PlayerBuildInfo::BuildVoiceLangs, PlayerBuildInfo::TypeDaily, "deutsch,english,francais" }, | ||
130 | { "iriverh100", PlayerBuildInfo::BuildVersion, PlayerBuildInfo::TypeDaily, "f9dce00" }, | ||
131 | { "iriverh100", PlayerBuildInfo::BuildUrl, PlayerBuildInfo::TypeDaily, "https://buildurl/daily/rockbox-iriverh100-f9dce00.zip" }, | ||
132 | }; | ||
133 | |||
134 | struct { | ||
135 | QString target; | ||
136 | PlayerBuildInfo::DeviceInfo item; | ||
137 | QString expected; | ||
138 | } testdataPlayer[] = | ||
139 | { | ||
140 | {"archosfmrecorder", PlayerBuildInfo::BuildStatus, "3"}, | ||
141 | { "iriverh10", PlayerBuildInfo::BuildStatus, "0" }, | ||
142 | { "iriverh100", PlayerBuildInfo::BuildStatus, "2" }, | ||
143 | { "iriverh300", PlayerBuildInfo::BuildStatus, "1" }, | ||
144 | { "archosfmrecorder", PlayerBuildInfo::BuildStatus, "3" }, | ||
145 | {"archosfmrecorder", PlayerBuildInfo::DisplayName, "Jukebox Recorder FM"}, | ||
146 | {"archosfmrecorder", PlayerBuildInfo::BootloaderMethod, "none"}, | ||
147 | {"archosfmrecorder", PlayerBuildInfo::BootloaderName, ""}, | ||
148 | {"archosfmrecorder", PlayerBuildInfo::BootloaderFile, ""}, | ||
149 | {"archosfmrecorder", PlayerBuildInfo::BootloaderFilter, ""}, | ||
150 | {"archosfmrecorder", PlayerBuildInfo::Encoder, "lame"}, | ||
151 | {"archosfmrecorder", PlayerBuildInfo::Brand, "Archos"}, | ||
152 | {"archosfmrecorder", PlayerBuildInfo::PlayerPicture, "archosfmrecorder"}, | ||
153 | {"iriverh100", PlayerBuildInfo::BuildStatus, "2"}, | ||
154 | {"iriverh100", PlayerBuildInfo::BootloaderMethod, "hex"}, | ||
155 | {"iriverh100", PlayerBuildInfo::BootloaderFilter, "*.hex *.zip"}, | ||
156 | {"ipodmini2g", PlayerBuildInfo::Encoder, "rbspeex"}, | ||
157 | }; | ||
158 | |||
159 | void TestPlayerBuildInfo::testBuildInfo_data() | ||
160 | { | ||
161 | QTest::addColumn<QString>("target"); | ||
162 | QTest::addColumn<PlayerBuildInfo::BuildInfo>("item"); | ||
163 | QTest::addColumn<PlayerBuildInfo::BuildType>("type"); | ||
164 | QTest::addColumn<QString>("expected"); | ||
165 | for (size_t i = 0; i < sizeof(testdataBuild) / sizeof(testdataBuild[0]); i++) | ||
166 | QTest::newRow("") << testdataBuild[i].target << testdataBuild[i].item | ||
167 | << testdataBuild[i].type << testdataBuild[i].expected; | ||
168 | } | ||
169 | |||
170 | |||
171 | void TestPlayerBuildInfo::testBuildInfo() | ||
172 | { | ||
173 | // create a temporary file for test input. Do not use QSettings() to allow | ||
174 | // creating different format variations. | ||
175 | QTemporaryFile tf(this); | ||
176 | tf.open(); | ||
177 | QString filename = tf.fileName(); | ||
178 | tf.write(testinfo); | ||
179 | tf.close(); | ||
180 | |||
181 | PlayerBuildInfo::instance()->setBuildInfo(filename); | ||
182 | |||
183 | QFETCH(QString, target); | ||
184 | QFETCH(PlayerBuildInfo::BuildInfo, item); | ||
185 | QFETCH(PlayerBuildInfo::BuildType, type); | ||
186 | QFETCH(QString, expected); | ||
187 | |||
188 | RbSettings::setValue(RbSettings::CurrentPlatform, target); | ||
189 | QVariant result = PlayerBuildInfo::instance()->value(item, type); | ||
190 | if(result.canConvert(QMetaType::QString)) | ||
191 | QCOMPARE(result.toString(), QString(expected)); | ||
192 | else | ||
193 | QCOMPARE(result.toStringList().join(","), QString(expected)); | ||
194 | } | ||
195 | |||
196 | |||
197 | // NOTE: These tests rely on rbutil.ini | ||
198 | void TestPlayerBuildInfo::testPlayerInfo_data() | ||
199 | { | ||
200 | QTest::addColumn<QString>("target"); | ||
201 | QTest::addColumn<PlayerBuildInfo::DeviceInfo>("item"); | ||
202 | QTest::addColumn<QString>("expected"); | ||
203 | for (size_t i = 0; i < sizeof(testdataPlayer) / sizeof(testdataPlayer[0]); i++) | ||
204 | QTest::newRow("") << testdataPlayer[i].target << testdataPlayer[i].item | ||
205 | << testdataPlayer[i].expected; | ||
206 | } | ||
207 | |||
208 | void TestPlayerBuildInfo::testPlayerInfo() | ||
209 | { | ||
210 | // create a temporary file for test input. Do not use QSettings() to allow | ||
211 | // creating different format variations. | ||
212 | QTemporaryFile tf(this); | ||
213 | tf.open(); | ||
214 | QString filename = tf.fileName(); | ||
215 | tf.write(testinfo); | ||
216 | tf.close(); | ||
217 | |||
218 | PlayerBuildInfo::instance()->setBuildInfo(filename); | ||
219 | |||
220 | QFETCH(QString, target); | ||
221 | QFETCH(PlayerBuildInfo::DeviceInfo, item); | ||
222 | QFETCH(QString, expected); | ||
223 | |||
224 | QVariant result = PlayerBuildInfo::instance()->value(item, target); | ||
225 | if(result.canConvert(QMetaType::QString)) | ||
226 | QCOMPARE(result.toString(), QString(expected)); | ||
227 | else | ||
228 | QCOMPARE(result.toStringList().join(","), QString(expected)); | ||
229 | } | ||
230 | |||
231 | |||
232 | QTEST_MAIN(TestPlayerBuildInfo) | ||
233 | |||
234 | // this include is needed because we don't use a separate header file for the | ||
235 | // test class. It also needs to be at the end. | ||
236 | #include "test-playerbuildinfo.moc" | ||
237 | |||
diff --git a/rbutil/rbutilqt/test/test-serverinfo.pro b/rbutil/rbutilqt/test/test-playerbuildinfo.pro index 903d5a6b07..724da59162 100644 --- a/rbutil/rbutilqt/test/test-serverinfo.pro +++ b/rbutil/rbutilqt/test/test-playerbuildinfo.pro | |||
@@ -18,19 +18,18 @@ | |||
18 | QT += testlib | 18 | QT += testlib |
19 | 19 | ||
20 | TEMPLATE = app | 20 | TEMPLATE = app |
21 | TARGET = test-serverinfo | 21 | TARGET = test-playerbuildinfo |
22 | INCLUDEPATH += . ../base stubs | 22 | INCLUDEPATH += . ../base stubs |
23 | 23 | ||
24 | # Input | 24 | # Input |
25 | SOURCES += \ | 25 | SOURCES += \ |
26 | test-serverinfo.cpp \ | 26 | test-playerbuildinfo.cpp \ |
27 | stubs/stubs-serverinfo.cpp \ | 27 | stubs/stubs-playerbuildinfo.cpp \ |
28 | ../base/serverinfo.cpp | 28 | ../base/playerbuildinfo.cpp |
29 | 29 | ||
30 | HEADERS += \ | 30 | HEADERS += \ |
31 | ../base/rbsettings.h \ | 31 | ../base/rbsettings.h \ |
32 | ../base/rockboxinfo.h \ | 32 | ../base/rockboxinfo.h \ |
33 | ../base/systeminfo.h \ | 33 | ../base/systeminfo.h \ |
34 | ../base/serverinfo.h \ | ||
35 | 34 | ||
36 | RESOURCES += ../rbutilqt.qrc | 35 | RESOURCES += ../rbutilqt.qrc |
diff --git a/rbutil/rbutilqt/test/test-serverinfo.cpp b/rbutil/rbutilqt/test/test-serverinfo.cpp deleted file mode 100644 index b999624c78..0000000000 --- a/rbutil/rbutilqt/test/test-serverinfo.cpp +++ /dev/null | |||
@@ -1,124 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2012 Dominik Riebeling | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include <QtTest/QtTest> | ||
22 | #include <QObject> | ||
23 | #include "serverinfo.h" | ||
24 | |||
25 | class TestServerInfo : public QObject | ||
26 | { | ||
27 | Q_OBJECT | ||
28 | private slots: | ||
29 | void testMain(); | ||
30 | }; | ||
31 | |||
32 | const char* testinfo = | ||
33 | "[release]\n" | ||
34 | "archosfmrecorder=3.11.2\n" | ||
35 | "iaudiom3=3.11.2,http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip\n" | ||
36 | "sansae200 = 3.11.2\n" | ||
37 | "iriverh100 = 3.11.2, http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip\n" | ||
38 | "iriverh300 = \n" | ||
39 | "[release-candidate]\n" | ||
40 | "gigabeatfx=f9dce96,http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip\n" | ||
41 | "archosfmrecorder=f9dce96\n" | ||
42 | "archosrecorder = f9dce96\n" | ||
43 | "iaudiox5=f9dce96,http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip\n" | ||
44 | "[dailies]\n" | ||
45 | "timestamp = 20201113\n" | ||
46 | "rev = 362f7a3\n" | ||
47 | "[bleeding]\n" | ||
48 | "timestamp = 20201114T105723Z\n" | ||
49 | "rev = be1be79\n" | ||
50 | "[status]\n" | ||
51 | "archosfmrecorder=3\n" | ||
52 | "iriverh100=2\n" | ||
53 | "iriverh300=1\n" | ||
54 | "iriverh10=0\n" | ||
55 | ; | ||
56 | |||
57 | |||
58 | struct testvector { | ||
59 | const char* target; | ||
60 | ServerInfo::ServerInfos entry; | ||
61 | const char* expected; | ||
62 | }; | ||
63 | |||
64 | |||
65 | const struct testvector testdata[] = | ||
66 | { | ||
67 | { "archosfmrecorder", ServerInfo::CurReleaseVersion, "3.11.2" }, | ||
68 | { "archosfmrecorder", ServerInfo::CurStatus, "3" }, | ||
69 | { "iaudiom3", ServerInfo::CurReleaseVersion, "3.11.2" }, | ||
70 | { "iaudiom3", ServerInfo::CurReleaseUrl, "http://dl.rockbox.org/release/3.11.2/rockbox-iaudiom5-3.11.2.zip" }, | ||
71 | { "sansae200", ServerInfo::CurReleaseVersion, "3.11.2" }, | ||
72 | { "sansae200", ServerInfo::CurReleaseUrl, "https://unittest/release/3.11.2/rockbox-sansae200-3.11.2.zip" }, | ||
73 | { "iriverh100", ServerInfo::CurReleaseVersion, "3.11.2" }, | ||
74 | { "iriverh100", ServerInfo::CurReleaseUrl, "http://dl.rockbox.org/release/3.11.2/rockbox-iriverh100-3.11.2.zip" }, | ||
75 | { "iriverh100", ServerInfo::CurStatus, "2" }, | ||
76 | { "iriverh100", ServerInfo::CurDevelUrl, "https://unittest/dev/rockbox-iriverh100.zip" }, | ||
77 | { "iriverh300", ServerInfo::CurReleaseVersion, "" }, | ||
78 | { "iriverh300", ServerInfo::CurReleaseUrl, "" }, | ||
79 | { "iriverh300", ServerInfo::CurStatus, "1" }, | ||
80 | { "iriverh10", ServerInfo::CurReleaseVersion, "" }, | ||
81 | { "iriverh10", ServerInfo::CurReleaseUrl, "" }, | ||
82 | { "iriverh10", ServerInfo::CurStatus, "0" }, | ||
83 | { "gigabeatfx", ServerInfo::RelCandidateVersion, "f9dce96" }, | ||
84 | { "gigabeatfx", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip" }, | ||
85 | { "archosfmrecorder", ServerInfo::RelCandidateVersion, "f9dce96" }, | ||
86 | { "archosfmrecorder", ServerInfo::RelCandidateUrl, "https://unittest/rc/f9dce96/rockbox-archosfmrecorder-f9dce96.zip" }, | ||
87 | { "archosrecorder", ServerInfo::RelCandidateVersion, "f9dce96" }, | ||
88 | { "archosrecorder", ServerInfo::RelCandidateUrl, "https://unittest/rc/f9dce96/rockbox-archosrecorder-f9dce96.zip" }, | ||
89 | { "iaudiox5", ServerInfo::RelCandidateVersion, "f9dce96" }, | ||
90 | { "iaudiox5", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" }, | ||
91 | { "iaudiox5.v", ServerInfo::RelCandidateVersion, "f9dce96" }, | ||
92 | { "iaudiox5.v", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" }, | ||
93 | { "iaudiox5.v", ServerInfo::BleedingRevision, "be1be79" }, | ||
94 | { "iaudiox5.v", ServerInfo::BleedingDate, "2020-11-14T10:57:23" }, | ||
95 | { "iaudiox5.v", ServerInfo::CurDevelUrl, "https://unittest/dev/rockbox-iaudiox5.zip" }, | ||
96 | }; | ||
97 | |||
98 | |||
99 | void TestServerInfo::testMain() | ||
100 | { | ||
101 | // create a temporary file for test input. Do not use QSettings() to allow | ||
102 | // creating different format variations. | ||
103 | QTemporaryFile tf(this); | ||
104 | tf.open(); | ||
105 | QString filename = tf.fileName(); | ||
106 | tf.write(testinfo); | ||
107 | tf.close(); | ||
108 | |||
109 | ServerInfo::instance()->readBuildInfo(filename); | ||
110 | |||
111 | unsigned int i; | ||
112 | for(i = 0; i < sizeof(testdata) / sizeof(struct testvector); i++) { | ||
113 | QString result = ServerInfo::instance()->platformValue(testdata[i].entry, testdata[i].target).toString(); | ||
114 | QCOMPARE(result, QString(testdata[i].expected)); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | |||
119 | QTEST_MAIN(TestServerInfo) | ||
120 | |||
121 | // this include is needed because we don't use a separate header file for the | ||
122 | // test class. It also needs to be at the end. | ||
123 | #include "test-serverinfo.moc" | ||
124 | |||
diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp index e87d530c8c..daa910d6bf 100644 --- a/rbutil/rbutilqt/themesinstallwindow.cpp +++ b/rbutil/rbutilqt/themesinstallwindow.cpp | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "progressloggergui.h" | 26 | #include "progressloggergui.h" |
27 | #include "utils.h" | 27 | #include "utils.h" |
28 | #include "rbsettings.h" | 28 | #include "rbsettings.h" |
29 | #include "systeminfo.h" | 29 | #include "playerbuildinfo.h" |
30 | #include "rockboxinfo.h" | 30 | #include "rockboxinfo.h" |
31 | #include "version.h" | 31 | #include "version.h" |
32 | #include "Logger.h" | 32 | #include "Logger.h" |
@@ -84,7 +84,7 @@ void ThemesInstallWindow::downloadInfo() | |||
84 | LOG_INFO() << "downloading info to" << themesInfo.fileName(); | 84 | LOG_INFO() << "downloading info to" << themesInfo.fileName(); |
85 | themesInfo.close(); | 85 | themesInfo.close(); |
86 | 86 | ||
87 | QString infoUrl = SystemInfo::value(SystemInfo::ThemesInfoUrl).toString(); | 87 | QString infoUrl = PlayerBuildInfo::instance()->value(PlayerBuildInfo::ThemesInfoUrl).toString(); |
88 | infoUrl.replace("%TARGET%", | 88 | infoUrl.replace("%TARGET%", |
89 | RbSettings::value(RbSettings::CurrentPlatform).toString().split(".").at(0)); | 89 | RbSettings::value(RbSettings::CurrentPlatform).toString().split(".").at(0)); |
90 | infoUrl.replace("%REVISION%", installInfo.revision()); | 90 | infoUrl.replace("%REVISION%", installInfo.revision()); |
@@ -218,9 +218,9 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p | |||
218 | iniDetails.beginGroup(cur->data(Qt::UserRole).toString()); | 218 | iniDetails.beginGroup(cur->data(Qt::UserRole).toString()); |
219 | 219 | ||
220 | QUrl img, txt; | 220 | QUrl img, txt; |
221 | txt = QUrl(QString(SystemInfo::value(SystemInfo::ThemesUrl).toString() + "/" | 221 | txt = QUrl(QString(PlayerBuildInfo::instance()->value(PlayerBuildInfo::ThemesUrl).toString() + "/" |
222 | + iniDetails.value("descriptionfile").toString())); | 222 | + iniDetails.value("descriptionfile").toString())); |
223 | img = QUrl(QString(SystemInfo::value(SystemInfo::ThemesUrl).toString() + "/" | 223 | img = QUrl(QString(PlayerBuildInfo::instance()->value(PlayerBuildInfo::ThemesUrl).toString() + "/" |
224 | + iniDetails.value("image").toString())); | 224 | + iniDetails.value("image").toString())); |
225 | 225 | ||
226 | QString text; | 226 | QString text; |
@@ -334,7 +334,7 @@ void ThemesInstallWindow::install() | |||
334 | QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); | 334 | QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); |
335 | for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) { | 335 | for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) { |
336 | iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString()); | 336 | iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString()); |
337 | zip = SystemInfo::value(SystemInfo::ThemesUrl).toString() | 337 | zip = PlayerBuildInfo::instance()->value(PlayerBuildInfo::ThemesUrl).toString() |
338 | + "/" + iniDetails.value("archive").toString(); | 338 | + "/" + iniDetails.value("archive").toString(); |
339 | themes.append(zip); | 339 | themes.append(zip); |
340 | names.append("Theme: " + | 340 | names.append("Theme: " + |