summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-11-28 20:47:28 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-12-03 22:25:12 +0100
commitb064a6cbb58a0db1a70fbac2e82242ce0c7509b1 (patch)
treec9090d367d237cbd408afbd24d5809e55a1a2653 /rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp
parent78a01db47cac5fa67aeee6f1c5134f89c3e4944a (diff)
downloadrockbox-b064a6cbb58a0db1a70fbac2e82242ce0c7509b1.tar.gz
rockbox-b064a6cbb58a0db1a70fbac2e82242ce0c7509b1.zip
rbutil: Rework and merge player and build server info handling.
Handling the data for players from rbutil.ini and the build-info data from the server is closely related. Splitting things up into different classes only creates tightly coupling, which is unnecessary, and the need to differentiate between them in the application. Merge both classes into a single one and rework handling so the application doesn't have to deal with two separate classes anymore. Furthermore, change URL templates to use new values from build-info instead of hard coding them. Change-Id: Ica550973ce23d1559110782add52bc214eba552d
Diffstat (limited to 'rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp')
-rw-r--r--rbutil/rbutilqt/test/stubs/stubs-serverinfo.cpp105
1 files changed, 0 insertions, 105 deletions
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
26QVariant 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
41QVariant 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
59QStringList 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
95QVariant 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