ASAPCabinetFE
 
Loading...
Searching...
No Matches
section_config.h
1#ifndef SECTION_CONFIG_H
2#define SECTION_CONFIG_H
3
4#include <string>
5#include <vector>
6#include <unordered_map>
7
13public:
15 // ----------------- SECTIONS ------------------
16 sectionOrder_ = {
17 "TableMetadata",
18 "TitleDisplay",
19 "UIWidgets",
20 "AudioSettings",
21 "Keybinds",
22 "DPISettings",
23 "WindowSettings",
24 "MediaDimensions",
25 "CustomMedia",
26 "VPX",
27 "DefaultMedia",
28 "UISounds",
29 "Internal"
30 };
31 sectionDisplayNames_ = {
32 {"TableMetadata", "Table Metadata"},
33 {"TitleDisplay", "Title Display"},
34 {"UIWidgets", "UI Widgets"},
35 {"AudioSettings", "Audio Settings"},
36 {"Keybinds", "Keybinds"},
37 {"DPISettings", "DPI Settings"},
38 {"WindowSettings", "Window Settings"},
39 {"MediaDimensions", "Media Dimensions"},
40 {"CustomMedia", "Custom Media"},
41 {"VPX", "VPX Settings"},
42 {"DefaultMedia", "Default Media"},
43 {"UISounds", "UI Sounds"},
44 {"Internal", "Internal Settings"}
45 };
46 // -------------------- KEYS --------------------
47 keyOrders_["TableMetadata"] = {
48 "titleSource",
49 "titleSortBy",
50 "showMetadata",
51 "metadataPanelWidth",
52 "metadataPanelHeight",
53 "metadataPanelAlpha",
54 "useVpxtool",
55 "fetchVPSdb",
56 "fetchVpinMediaDb",
57 "resizeToWindows",
58 "ignoreScanners",
59 "forceRebuildMetadata",
60 "titleWeight",
61 "yearWeight",
62 "manufacturerWeight",
63 "romWeight",
64 "titleThreshold",
65 "confidenceThreshold"
66 };
67 keyDisplayNames_["TableMetadata"] = {
68 {"titleSource", "Table Info"},
69 {"titleSortBy", "Sort By"},
70 {"useVpxtool", "Use VPXTool"},
71 {"fetchVPSdb", "Use VPS Database"},
72 {"fetchVpinMediaDb", "Use VPinMedia Database"},
73 {"resizeToWindows", "Resize VpinMdb images"},
74 {"showMetadata", "Show Metadata"},
75 {"metadataPanelWidth", "Panel Width"},
76 {"metadataPanelHeight", "Panel Height"},
77 {"metadataPanelAlpha", "Panel Opacity"},
78 {"ignoreScanners", "Fast Load"},
79 {"forceRebuildMetadata", "Rebuild Metadata"}
80 };
81 keyDropdownOptions_["TableMetadata"] = {
82 {"titleSource", {"filename", "metadata"}},
83 {"titleSortBy", {"title", "author", "type", "year", "manufacturer"}}
84 };
85
86 keyOrders_["TitleDisplay"] = {
87 "showWheel",
88 "wheelWindow",
89 "showTitle",
90 "titleWindow",
91 "fontPath",
92 "fontColor",
93 "fontBgColor",
94 "fontSize",
95 "titleX",
96 "titleY"
97 };
98 keyDisplayNames_["TitleDisplay"] = {
99 {"showWheel", "Show Wheel"},
100 {"wheelWindow", "Wheel Window"},
101 {"showTitle", "Show Title"},
102 {"titleWindow", "Title Window"},
103 {"fontPath", "Font Path"},
104 {"fontColor", "Font Color"},
105 {"fontBgColor", "Font Background Color"},
106 {"fontSize", "Font Size"},
107 {"titleX", "Title X Position"},
108 {"titleY", "Title Y Position"}
109 };
110 keyDropdownOptions_["TitleDisplay"] = {
111 {"wheelWindow", {"playfield", "backglass", "dmd", "topper"}},
112 {"titleWindow", {"playfield", "backglass", "dmd", "topper"}}
113 };
114
115 keyOrders_["UIWidgets"] = {
116 "showArrowHint",
117 "arrowHintWidth",
118 "arrowHintHeight",
119 "arrowThickness",
120 "arrowAlpha",
121 "arrowColorTop",
122 "arrowColorBottom",
123 "arrowGlow",
124 "arrowGlowColor",
125 "showScrollbar",
126 "scrollbarWidth",
127 "thumbWidth",
128 "scrollbarLength",
129 "scrollbarColor",
130 "scrollbarThumbColor"
131 };
132 keyDisplayNames_["UIWidgets"] = {
133 {"showArrowHint", "Show Arrow Hint"},
134 {"arrowHintWidth", "Arrow Width"},
135 {"arrowHintHeight", "Arrow Height"},
136 {"arrowThickness", "Arrow Thickness"},
137 {"arrowAlpha", "Arrow Opacity"},
138 {"arrowColorTop", "Arrow Top Color"},
139 {"arrowColorBottom", "Arrow Bottom Color"},
140 {"arrowGlow", "Arrow Glow"},
141 {"arrowGlowColor", "Arrow Glow Color"},
142 {"showScrollbar", "Show Scrollbar"},
143 {"scrollbarWidth", "Scrollbar Width"},
144 {"thumbWidth", "Thumb Width"},
145 {"scrollbarLength", "Scrollbar Length"},
146 {"scrollbarColor", "Scrollbar Color"},
147 {"scrollbarThumbColor", "Scrollbar Thumb Color"}
148 };
149
150 keyOrders_["AudioSettings"] = {
151 "masterVol",
152 "masterMute",
153 "mediaAudioVol",
154 "mediaAudioMute",
155 "tableMusicVol",
156 "tableMusicMute",
157 "interfaceAudioVol",
158 "interfaceAudioMute",
159 "interfaceAmbienceVol",
160 "interfaceAmbienceMute"
161 };
162 keyDisplayNames_["AudioSettings"] = {
163 {"masterVol", "Master Volume"},
164 {"masterMute", "Master Mute"},
165 {"mediaAudioVol", "Media Volume"},
166 {"mediaAudioMute", "Media Mute"},
167 {"tableMusicVol", "Table Music Volume"},
168 {"tableMusicMute", "Table Music Mute"},
169 {"interfaceAudioVol", "Interface Volume"},
170 {"interfaceAudioMute", "Interface Mute"},
171 {"interfaceAmbienceVol", "Ambience Volume"},
172 {"interfaceAmbienceMute", "Ambience Mute"}
173 };
174
175 keyOrders_["Keybinds"] = {
176 "Previous Table", "Next Table", "Fast Previous Table", "Fast Next Table",
177 "Jump Next Letter", "Jump Previous Letter", "Random Table", "Launch Table",
178 "Toggle Config", "Toggle Editor", "Toggle Catalog", "Screenshot Mode",
179 "Screenshot Key", "Screenshot Quit", "Quit"
180 };
181 keyDisplayNames_["Keybinds"] = {
182 {"Previous Table", "Previous Table"},
183 {"Next Table", "Next Table"},
184 {"Fast Previous Table", "Fast Previous Table"},
185 {"Fast Next Table", "Fast Next Table"},
186 {"Jump Next Letter", "Jump Next Letter"},
187 {"Jump Previous Letter", "Jump Previous Letter"},
188 {"Random Table", "Random Table"},
189 {"Launch Table", "Launch Table"},
190 {"Screenshot Mode", "Screenshot Mode"},
191 {"Screenshot Key", "Screenshot Key"},
192 {"Screenshot Quit", "Screenshot Quit"},
193 {"Toggle Config", "Toggle Config"},
194 {"Toggle Editor", "Toggle Editor"},
195 {"Toggle Catalog", "Toggle Catalog"},
196 {"Quit", "Quit"}
197 };
198
199 keyOrders_["DPISettings"] = {
200 "dpiScale",
201 "enableDpiScaling"
202 };
203 keyDisplayNames_["DPISettings"] = {
204 {"dpiScale", "DPI Scale"},
205 {"enableDpiScaling", "Enable DPI Scaling"}
206 };
207
208 keyOrders_["WindowSettings"] = {
209 "videoBackend",
210 "useVPinballXIni",
211 "playfieldWindowWidth",
212 "playfieldWindowHeight",
213 "playfieldX",
214 "playfieldY",
215 "showBackglass",
216 "backglassWindowWidth",
217 "backglassWindowHeight",
218 "backglassX",
219 "backglassY",
220 "showDMD",
221 "dmdWindowWidth",
222 "dmdWindowHeight",
223 "dmdX",
224 "dmdY",
225 "showTopper",
226 "topperWindowWidth",
227 "topperWindowHeight",
228 "topperWindowX",
229 "topperWindowY"
230 };
231 keyDisplayNames_["WindowSettings"] = {
232 {"videoBackend", "Video Backend"},
233 {"useVPinballXIni", "Use VPX INI"},
234 {"playfieldWindowWidth", "Playfield Width"},
235 {"playfieldWindowHeight", "Playfield Height"},
236 {"playfieldX", "Playfield X"},
237 {"playfieldY", "Playfield Y"},
238 {"showBackglass", "Show Backglass"},
239 {"backglassWindowWidth", "Backglass Width"},
240 {"backglassWindowHeight", "Backglass Height"},
241 {"backglassX", "Backglass X"},
242 {"backglassY", "Backglass Y"},
243 {"showDMD", "Show DMD"},
244 {"dmdWindowWidth", "DMD Width"},
245 {"dmdWindowHeight", "DMD Height"},
246 {"dmdX", "DMD X"},
247 {"dmdY", "DMD Y"},
248 {"showTopper", "Show Topper"},
249 {"topperWindowWidth", "Topper Width"},
250 {"topperWindowHeight", "Topper Height"},
251 {"topperWindowX", "Topper X"},
252 {"topperWindowY", "Topper Y"}
253 };
254 keyDropdownOptions_["WindowSettings"] = {
255 {"videoBackend", {"vlc", "ffmpeg", "novideo"}}
256 };
257
258 keyOrders_["MediaDimensions"] = {
259 "forceImagesOnly",
260 "wheelMediaWidth",
261 "wheelMediaHeight",
262 "wheelMediaX",
263 "wheelMediaY",
264 "playfieldMediaWidth",
265 "playfieldMediaHeight",
266 "playfieldMediaX",
267 "playfieldMediaY",
268 "playfieldRotation",
269 "backglassMediaWidth",
270 "backglassMediaHeight",
271 "backglassMediaX",
272 "backglassMediaY",
273 "backglassRotation",
274 "dmdMediaWidth",
275 "dmdMediaHeight",
276 "dmdMediaX",
277 "dmdMediaY",
278 "dmdRotation",
279 "topperMediaWidth",
280 "topperMediaHeight",
281 "topperMediaX",
282 "topperMediaY",
283 "topperRotation"
284 };
285 keyDisplayNames_["MediaDimensions"] = {
286 {"forceImagesOnly", "Force Images Only"},
287 {"wheelMediaWidth", "Wheel Width"},
288 {"wheelMediaHeight", "Wheel Height"},
289 {"wheelMediaX", "Wheel X"},
290 {"wheelMediaY", "Wheel Y"},
291 {"playfieldMediaWidth", "Playfield Media Width"},
292 {"playfieldMediaHeight", "Playfield Media Height"},
293 {"playfieldMediaX", "Playfield Media X"},
294 {"playfieldMediaY", "Playfield Media Y"},
295 {"playfieldRotation", "Playfield Rotation"},
296 {"backglassMediaWidth", "Backglass Media Width"},
297 {"backglassMediaHeight", "Backglass Media Height"},
298 {"backglassMediaX", "Backglass Media X"},
299 {"backglassMediaY", "Backglass Media Y"},
300 {"backglassRotation", "Backglass Rotation"},
301 {"dmdMediaWidth", "DMD Media Width"},
302 {"dmdMediaHeight", "DMD Media Height"},
303 {"dmdMediaX", "DMD Media X"},
304 {"dmdMediaY", "DMD Media Y"},
305 {"dmdRotation", "DMD Rotation"},
306 {"topperMediaWidth", "Topper Media Width"},
307 {"topperMediaHeight", "Topper Media Height"},
308 {"topperMediaX", "Topper Media X"},
309 {"topperMediaY", "Topper Media Y"},
310 {"topperRotation", "Topper Rotation"}
311 };
312
313 keyOrders_["CustomMedia"] = {
314 "customWheelImage",
315 "customPlayfieldImage",
316 "customBackglassImage",
317 "customDmdImage",
318 "customTopperImage",
319 "customPlayfieldVideo",
320 "customBackglassVideo",
321 "customDmdVideo",
322 "customTopperVideo",
323 "tableMusic",
324 "customLaunchSound"
325 };
326 keyDisplayNames_["CustomMedia"] = {
327 {"customWheelImage", "Custom Wheel Image"},
328 {"customPlayfieldImage", "Custom Playfield Image"},
329 {"customBackglassImage", "Custom Backglass Image"},
330 {"customDmdImage", "Custom DMD Image"},
331 {"customTopperImage", "Custom Topper Image"},
332 {"customPlayfieldVideo", "Custom Playfield Video"},
333 {"customBackglassVideo", "Custom Backglass Video"},
334 {"customDmdVideo", "Custom DMD Video"},
335 {"customTopperVideo", "Custom Topper Video"},
336 {"tableMusic", "Table Music"},
337 {"customLaunchSound", "Custom Launch Sound"}
338 };
339
340 keyOrders_["VPX"] = {
341 "VPXTablesPath",
342 "VPinballXPath",
343 "vpxIniPath",
344 "vpxStartArgs",
345 "vpxEndArgs",
346 "autoPatchTables"
347 };
348 keyDisplayNames_["VPX"] = {
349 {"VPXTablesPath", "VPX Tables Path"},
350 {"VPinballXPath", "VPinballX Path"},
351 {"vpxIniPath", "VPX INI Path"},
352 {"vpxStartArgs", "VPX Start Arguments"},
353 {"vpxEndArgs", "VPX End Arguments"},
354 {"autoPatchTables", "Automatically Patch Tables"}
355 };
356
357 keyOrders_["DefaultMedia"] = {
358 "defaultWheelImage",
359 "defaultPlayfieldImage",
360 "defaultBackglassImage",
361 "defaultDmdImage",
362 "defaultTopperImage",
363 "defaultPlayfieldVideo",
364 "defaultBackglassVideo",
365 "defaultDmdVideo",
366 "defaultTopperVideo"
367 };
368 keyDisplayNames_["DefaultMedia"] = {
369 {"defaultWheelImage", "Default Wheel Image"},
370 {"defaultPlayfieldImage", "Default Playfield Image"},
371 {"defaultBackglassImage", "Default Backglass Image"},
372 {"defaultDmdImage", "Default DMD Image"},
373 {"defaultTopperImage", "Default Topper Image"},
374 {"defaultPlayfieldVideo", "Default Playfield Video"},
375 {"defaultBackglassVideo", "Default Backglass Video"},
376 {"defaultDmdVideo", "Default DMD Video"},
377 {"defaultTopperVideo", "Default Topper Video"}
378 };
379
380 keyOrders_["UISounds"] = {
381 "scrollNormalSound",
382 "scrollFastSound",
383 "scrollJumpSound",
384 "scrollRandomSound",
385 "launchTableSound",
386 "launchScreenshotSound",
387 "panelToggleSound",
388 "screenshotTakeSound",
389 "ambienceSound"
390 };
391 keyDisplayNames_["UISounds"] = {
392 {"scrollNormalSound", "Single Scroll Sound"},
393 {"scrollFastSound", "Fast Scroll Sound"},
394 {"scrollJumpSound", "Jump Scroll Sound"},
395 {"scrollRandomSound", "Random Scroll Sound"},
396 {"launchTableSound", "Launch Table Sound"},
397 {"launchScreenshotSound", "Launch Screenshot Sound"},
398 {"panelToggleSound", "Panel Toggle Sound"},
399 {"screenshotTakeSound", "Screenshot Taken Sound"},
400 {"ambienceSound", "Ambience Sound"}
401 };
402
403 keyOrders_["Internal"] = {
404 "vpxSubCmd",
405 "vpsDbPath",
406 "vpsDbUpdateFrequency",
407 "vpsDbLastUpdated",
408 "vpxtoolIndex",
409 "indexPath",
410 "screenshotWait"
411 };
412 keyDisplayNames_["Internal"] = {
413 {"vpxSubCmd", "VPX Subcommand"},
414 {"vpsDbPath", "VPS Database Path"},
415 {"vpsDbUpdateFrequency", "VPS Database Update Frequency"},
416 {"vpsDbLastUpdated", "VPS Database Last Updated"},
417 {"vpxtoolIndex", "VPX Tool Index"},
418 {"indexPath", "Index Path"},
419 {"screenshotWait", "Screenshot Wait Time"}
420 };
421 }
422
423 const std::vector<std::string>& getSectionOrder() const { return sectionOrder_; }
424 const std::vector<std::string>& getKeyOrder(const std::string& sectionName) const {
425 static const std::vector<std::string> empty;
426 auto it = keyOrders_.find(sectionName);
427 return it != keyOrders_.end() ? it->second : empty;
428 }
429 std::string getSectionDisplayName(const std::string& sectionName) const {
430 auto it = sectionDisplayNames_.find(sectionName);
431 return it != sectionDisplayNames_.end() ? it->second : sectionName;
432 }
433 std::string getKeyDisplayName(const std::string& sectionName, const std::string& key) const {
434 auto sectionIt = keyDisplayNames_.find(sectionName);
435 if (sectionIt != keyDisplayNames_.end()) {
436 auto keyIt = sectionIt->second.find(key);
437 if (keyIt != sectionIt->second.end()) {
438 return keyIt->second;
439 }
440 }
441 return key;
442 }
443 const std::vector<std::string>& getDropdownOptions(const std::string& sectionName, const std::string& key) const {
444 static const std::vector<std::string> empty;
445 auto sectionIt = keyDropdownOptions_.find(sectionName);
446 if (sectionIt != keyDropdownOptions_.end()) {
447 auto keyIt = sectionIt->second.find(key);
448 if (keyIt != sectionIt->second.end()) {
449 return keyIt->second;
450 }
451 }
452 return empty;
453 }
454
455private:
456 std::vector<std::string> sectionOrder_;
457 std::unordered_map<std::string, std::string> sectionDisplayNames_;
458 std::unordered_map<std::string, std::vector<std::string>> keyOrders_;
459 std::unordered_map<std::string, std::unordered_map<std::string, std::string>> keyDisplayNames_;
460 std::unordered_map<std::string, std::unordered_map<std::string, std::vector<std::string>>> keyDropdownOptions_;
461};
462
463#endif // SECTION_CONFIG_H
Manages section and key order for configuration UI rendering.
Definition section_config.h:12