diff options
Diffstat (limited to 'utils/rbutilqt/base/playerbuildinfo.h')
-rw-r--r-- | utils/rbutilqt/base/playerbuildinfo.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/utils/rbutilqt/base/playerbuildinfo.h b/utils/rbutilqt/base/playerbuildinfo.h new file mode 100644 index 0000000000..6a88f750ed --- /dev/null +++ b/utils/rbutilqt/base/playerbuildinfo.h | |||
@@ -0,0 +1,123 @@ | |||
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 | Q_OBJECT | ||
34 | |||
35 | public: | ||
36 | |||
37 | enum BuildType { | ||
38 | TypeRelease, | ||
39 | TypeCandidate, | ||
40 | TypeDaily, | ||
41 | TypeDevel, | ||
42 | }; | ||
43 | enum BuildInfo { | ||
44 | BuildUrl, | ||
45 | BuildVersion, | ||
46 | BuildManualUrl, | ||
47 | BuildVoiceUrl, | ||
48 | BuildVoiceLangs, | ||
49 | BuildSourceUrl, | ||
50 | BuildFontUrl, | ||
51 | |||
52 | DoomUrl, | ||
53 | Duke3DUrl, | ||
54 | PuzzFontsUrl, | ||
55 | QuakeUrl, | ||
56 | Wolf3DUrl, | ||
57 | XWorldUrl, | ||
58 | MidiPatchsetUrl, | ||
59 | }; | ||
60 | enum DeviceInfo { | ||
61 | BuildStatus, | ||
62 | |||
63 | DisplayName, | ||
64 | BootloaderMethod, | ||
65 | BootloaderName, | ||
66 | BootloaderFile, | ||
67 | BootloaderFilter, | ||
68 | Encoder, | ||
69 | Brand, | ||
70 | PlayerPicture, | ||
71 | |||
72 | TargetNamesAll, | ||
73 | TargetNamesEnabled, | ||
74 | LanguageInfo, | ||
75 | LanguageList, | ||
76 | UsbIdErrorList, | ||
77 | UsbIdTargetList, | ||
78 | }; | ||
79 | |||
80 | enum SystemUrl { | ||
81 | BootloaderUrl, | ||
82 | BuildInfoUrl, | ||
83 | GenlangUrl, | ||
84 | ThemesUrl, | ||
85 | ThemesInfoUrl, | ||
86 | RbutilUrl, | ||
87 | }; | ||
88 | |||
89 | static PlayerBuildInfo* instance(); | ||
90 | |||
91 | //! Update with build information from server | ||
92 | void setBuildInfo(QString file); | ||
93 | |||
94 | // Get information about a device. This data does not depend on the build type. | ||
95 | QVariant value(DeviceInfo item, QString target = ""); | ||
96 | |||
97 | // Get information about a device. Make a numeric match | ||
98 | // (only sensible implementation for USB IDs) | ||
99 | QVariant value(DeviceInfo item, unsigned int match); | ||
100 | |||
101 | // Get build information for currently selected player. | ||
102 | QVariant value(BuildInfo item, BuildType type); | ||
103 | |||
104 | // Get fixed download URL information | ||
105 | QVariant value(SystemUrl item); | ||
106 | |||
107 | QString statusAsString(QString target = ""); | ||
108 | |||
109 | protected: | ||
110 | explicit PlayerBuildInfo(); | ||
111 | |||
112 | private: | ||
113 | //! Return a list with all target names (as used internally). | ||
114 | //! @all false filter out all targets with status = disabled. | ||
115 | QStringList targetNames(bool all); | ||
116 | |||
117 | static PlayerBuildInfo* infoInstance; | ||
118 | QSettings* serverInfo; | ||
119 | QSettings playerInfo; | ||
120 | |||
121 | }; | ||
122 | |||
123 | #endif | ||