xbmc
GUIDialogSettingsManualBase.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "addons/IAddon.h"
12 #include "settings/dialogs/GUIDialogSettingsManagerBase.h"
13 #include "settings/lib/SettingDefinitions.h"
14 #include "settings/lib/SettingLevel.h"
15 
16 #include <map>
17 #include <memory>
18 #include <string>
19 #include <vector>
20 
21 class CSetting;
22 class CSettingAction;
23 class CSettingAddon;
24 class CSettingBool;
25 class CSettingCategory;
26 class CSettingDate;
27 class CSettingGroup;
28 class CSettingInt;
29 class CSettingList;
30 class CSettingNumber;
31 class CSettingPath;
32 class CSettingSection;
33 class CSettingString;
34 class CSettingsManager;
35 class CSettingTime;
36 
38 {
39 public:
40  CGUIDialogSettingsManualBase(int windowId, const std::string &xmlFile);
41  ~CGUIDialogSettingsManualBase() override;
42 
43 protected:
44  // implementation of CGUIDialogSettingsBase
45  std::shared_ptr<CSettingSection> GetSection() override { return m_section; }
46  void SetupView() override;
47 
48  // implementation of CGUIDialogSettingsManagerBase
49  CSettingsManager* GetSettingsManager() const override;
50 
51  virtual void InitializeSettings();
52 
53  std::shared_ptr<CSettingCategory> AddCategory(const std::string &id, int label, int help = -1);
54  std::shared_ptr<CSettingGroup> AddGroup(const std::shared_ptr<CSettingCategory>& category,
55  int label = -1,
56  int help = -1,
57  bool separatorBelowLabel = true,
58  bool hideSeparator = false);
59  // checkmark control
60  std::shared_ptr<CSettingBool> AddToggle(const std::shared_ptr<CSettingGroup>& group,
61  const std::string& id,
62  int label,
63  SettingLevel level,
64  bool value,
65  bool delayed = false,
66  bool visible = true,
67  int help = -1);
68  // edit controls
69  std::shared_ptr<CSettingInt> AddEdit(const std::shared_ptr<CSettingGroup>& group,
70  const std::string& id,
71  int label,
72  SettingLevel level,
73  int value,
74  int minimum = 0,
75  int step = 1,
76  int maximum = 0,
77  bool verifyNewValue = false,
78  int heading = -1,
79  bool delayed = false,
80  bool visible = true,
81  int help = -1);
82  std::shared_ptr<CSettingNumber> AddEdit(const std::shared_ptr<CSettingGroup>& group,
83  const std::string& id,
84  int label,
85  SettingLevel level,
86  float value,
87  float minimum = 0.0f,
88  float step = 1.0f,
89  float maximum = 0.0f,
90  bool verifyNewValue = false,
91  int heading = -1,
92  bool delayed = false,
93  bool visible = true,
94  int help = -1);
95  std::shared_ptr<CSettingString> AddEdit(const std::shared_ptr<CSettingGroup>& group,
96  const std::string& id,
97  int label,
98  SettingLevel level,
99  const std::string& value,
100  bool allowEmpty = false,
101  bool hidden = false,
102  int heading = -1,
103  bool delayed = false,
104  bool visible = true,
105  int help = -1);
106  std::shared_ptr<CSettingString> AddIp(const std::shared_ptr<CSettingGroup>& group,
107  const std::string& id,
108  int label,
109  SettingLevel level,
110  const std::string& value,
111  bool allowEmpty = false,
112  int heading = -1,
113  bool delayed = false,
114  bool visible = true,
115  int help = -1);
116  std::shared_ptr<CSettingString> AddPasswordMd5(const std::shared_ptr<CSettingGroup>& group,
117  const std::string& id,
118  int label,
119  SettingLevel level,
120  const std::string& value,
121  bool allowEmpty = false,
122  int heading = -1,
123  bool delayed = false,
124  bool visible = true,
125  int help = -1);
126  // button controls
127  std::shared_ptr<CSettingAction> AddButton(const std::shared_ptr<CSettingGroup>& group,
128  const std::string& id,
129  int label,
130  SettingLevel level,
131  const std::string& data = "",
132  bool delayed = false,
133  bool visible = true,
134  int help = -1);
135  std::shared_ptr<CSettingString> AddInfoLabelButton(const std::shared_ptr<CSettingGroup>& group,
136  const std::string& id,
137  int label,
138  SettingLevel level,
139  const std::string& info,
140  bool visible = true,
141  int help = -1);
142  std::shared_ptr<CSettingAddon> AddAddon(const std::shared_ptr<CSettingGroup>& group,
143  const std::string& id,
144  int label,
145  SettingLevel level,
146  const std::string& value,
147  ADDON::AddonType addonType,
148  bool allowEmpty = false,
149  int heading = -1,
150  bool hideValue = false,
151  bool showInstalledAddons = true,
152  bool showInstallableAddons = false,
153  bool showMoreAddons = true,
154  bool delayed = false,
155  bool visible = true,
156  int help = -1);
157  std::shared_ptr<CSettingPath> AddPath(
158  const std::shared_ptr<CSettingGroup>& group,
159  const std::string& id,
160  int label,
161  SettingLevel level,
162  const std::string& value,
163  bool writable = true,
164  const std::vector<std::string>& sources = std::vector<std::string>(),
165  bool allowEmpty = false,
166  int heading = -1,
167  bool hideValue = false,
168  bool delayed = false,
169  bool visible = true,
170  int help = -1);
171  std::shared_ptr<CSettingDate> AddDate(const std::shared_ptr<CSettingGroup>& group,
172  const std::string& id,
173  int label,
174  SettingLevel level,
175  const std::string& value,
176  bool allowEmpty = false,
177  int heading = -1,
178  bool delayed = false,
179  bool visible = true,
180  int help = -1);
181  std::shared_ptr<CSettingTime> AddTime(const std::shared_ptr<CSettingGroup>& group,
182  const std::string& id,
183  int label,
184  SettingLevel level,
185  const std::string& value,
186  bool allowEmpty = false,
187  int heading = -1,
188  bool delayed = false,
189  bool visible = true,
190  int help = -1);
191 
192  // spinner controls
193  std::shared_ptr<CSettingString> AddSpinner(const std::shared_ptr<CSettingGroup>& group,
194  const std::string& id,
195  int label,
196  SettingLevel level,
197  const std::string& value,
198  StringSettingOptionsFiller filler,
199  bool delayed = false,
200  bool visible = true,
201  int help = -1);
202  std::shared_ptr<CSettingInt> AddSpinner(const std::shared_ptr<CSettingGroup>& group,
203  const std::string& id,
204  int label,
205  SettingLevel level,
206  int value,
207  int minimum,
208  int step,
209  int maximum,
210  int formatLabel = -1,
211  int minimumLabel = -1,
212  bool delayed = false,
213  bool visible = true,
214  int help = -1);
215  std::shared_ptr<CSettingInt> AddSpinner(const std::shared_ptr<CSettingGroup>& group,
216  const std::string& id,
217  int label,
218  SettingLevel level,
219  int value,
220  int minimum,
221  int step,
222  int maximum,
223  const std::string& formatString,
224  int minimumLabel = -1,
225  bool delayed = false,
226  bool visible = true,
227  int help = -1);
228  std::shared_ptr<CSettingInt> AddSpinner(const std::shared_ptr<CSettingGroup>& group,
229  const std::string& id,
230  int label,
231  SettingLevel level,
232  int value,
233  const TranslatableIntegerSettingOptions& entries,
234  bool delayed = false,
235  bool visible = true,
236  int help = -1);
237  std::shared_ptr<CSettingInt> AddSpinner(const std::shared_ptr<CSettingGroup>& group,
238  const std::string& id,
239  int label,
240  SettingLevel level,
241  int value,
242  const IntegerSettingOptions& entries,
243  bool delayed = false,
244  bool visible = true,
245  int help = -1);
246  std::shared_ptr<CSettingInt> AddSpinner(const std::shared_ptr<CSettingGroup>& group,
247  const std::string& id,
248  int label,
249  SettingLevel level,
250  int value,
251  IntegerSettingOptionsFiller filler,
252  bool delayed = false,
253  bool visible = true,
254  int help = -1);
255  std::shared_ptr<CSettingNumber> AddSpinner(const std::shared_ptr<CSettingGroup>& group,
256  const std::string& id,
257  int label,
258  SettingLevel level,
259  float value,
260  float minimum,
261  float step,
262  float maximum,
263  int formatLabel = -1,
264  int minimumLabel = -1,
265  bool delayed = false,
266  bool visible = true,
267  int help = -1);
268  std::shared_ptr<CSettingNumber> AddSpinner(const std::shared_ptr<CSettingGroup>& group,
269  const std::string& id,
270  int label,
271  SettingLevel level,
272  float value,
273  float minimum,
274  float step,
275  float maximum,
276  const std::string& formatString,
277  int minimumLabel = -1,
278  bool delayed = false,
279  bool visible = true,
280  int help = -1);
281 
282  // list controls
283  std::shared_ptr<CSettingString> AddList(const std::shared_ptr<CSettingGroup>& group,
284  const std::string& id,
285  int label,
286  SettingLevel level,
287  const std::string& value,
288  StringSettingOptionsFiller filler,
289  int heading,
290  bool visible = true,
291  int help = -1,
292  bool details = false);
293  std::shared_ptr<CSettingInt> AddList(const std::shared_ptr<CSettingGroup>& group,
294  const std::string& id,
295  int label,
296  SettingLevel level,
297  int value,
298  const TranslatableIntegerSettingOptions& entries,
299  int heading,
300  bool visible = true,
301  int help = -1,
302  bool details = false);
303  std::shared_ptr<CSettingInt> AddList(const std::shared_ptr<CSettingGroup>& group,
304  const std::string& id,
305  int label,
306  SettingLevel level,
307  int value,
308  const IntegerSettingOptions& entries,
309  int heading,
310  bool visible = true,
311  int help = -1,
312  bool details = false);
313  std::shared_ptr<CSettingInt> AddList(const std::shared_ptr<CSettingGroup>& group,
314  const std::string& id,
315  int label,
316  SettingLevel level,
317  int value,
318  IntegerSettingOptionsFiller filler,
319  int heading,
320  bool visible = true,
321  int help = -1,
322  bool details = false);
323  std::shared_ptr<CSettingList> AddList(const std::shared_ptr<CSettingGroup>& group,
324  const std::string& id,
325  int label,
326  SettingLevel level,
327  std::vector<std::string> values,
328  StringSettingOptionsFiller filler,
329  int heading,
330  int minimumItems = 0,
331  int maximumItems = -1,
332  bool visible = true,
333  int help = -1,
334  bool details = false);
335  std::shared_ptr<CSettingList> AddList(const std::shared_ptr<CSettingGroup>& group,
336  const std::string& id,
337  int label,
338  SettingLevel level,
339  std::vector<int> values,
340  const TranslatableIntegerSettingOptions& entries,
341  int heading,
342  int minimumItems = 0,
343  int maximumItems = -1,
344  bool visible = true,
345  int help = -1,
346  bool details = false);
347  std::shared_ptr<CSettingList> AddList(const std::shared_ptr<CSettingGroup>& group,
348  const std::string& id,
349  int label,
350  SettingLevel level,
351  std::vector<int> values,
352  const IntegerSettingOptions& entries,
353  int heading,
354  int minimumItems = 0,
355  int maximumItems = -1,
356  bool visible = true,
357  int help = -1,
358  bool details = false);
359  std::shared_ptr<CSettingList> AddList(const std::shared_ptr<CSettingGroup>& group,
360  const std::string& id,
361  int label,
362  SettingLevel level,
363  std::vector<int> values,
364  IntegerSettingOptionsFiller filler,
365  int heading,
366  int minimumItems = 0,
367  int maximumItems = -1,
368  bool visible = true,
369  int help = -1,
370  SettingControlListValueFormatter formatter = nullptr,
371  bool details = false);
372 
373  // slider controls
374  std::shared_ptr<CSettingInt> AddPercentageSlider(const std::shared_ptr<CSettingGroup>& group,
375  const std::string& id,
376  int label,
377  SettingLevel level,
378  int value,
379  int formatLabel,
380  int step = 1,
381  int heading = -1,
382  bool usePopup = false,
383  bool delayed = false,
384  bool visible = true,
385  int help = -1);
386  std::shared_ptr<CSettingInt> AddPercentageSlider(const std::shared_ptr<CSettingGroup>& group,
387  const std::string& id,
388  int label,
389  SettingLevel level,
390  int value,
391  const std::string& formatString,
392  int step = 1,
393  int heading = -1,
394  bool usePopup = false,
395  bool delayed = false,
396  bool visible = true,
397  int help = -1);
398  std::shared_ptr<CSettingInt> AddSlider(const std::shared_ptr<CSettingGroup>& group,
399  const std::string& id,
400  int label,
401  SettingLevel level,
402  int value,
403  int formatLabel,
404  int minimum,
405  int step,
406  int maximum,
407  int heading = -1,
408  bool usePopup = false,
409  bool delayed = false,
410  bool visible = true,
411  int help = -1);
412  std::shared_ptr<CSettingInt> AddSlider(const std::shared_ptr<CSettingGroup>& group,
413  const std::string& id,
414  int label,
415  SettingLevel level,
416  int value,
417  const std::string& formatString,
418  int minimum,
419  int step,
420  int maximum,
421  int heading = -1,
422  bool usePopup = false,
423  bool delayed = false,
424  bool visible = true,
425  int help = -1);
426  std::shared_ptr<CSettingNumber> AddSlider(const std::shared_ptr<CSettingGroup>& group,
427  const std::string& id,
428  int label,
429  SettingLevel level,
430  float value,
431  int formatLabel,
432  float minimum,
433  float step,
434  float maximum,
435  int heading = -1,
436  bool usePopup = false,
437  bool delayed = false,
438  bool visible = true,
439  int help = -1);
440  std::shared_ptr<CSettingNumber> AddSlider(const std::shared_ptr<CSettingGroup>& group,
441  const std::string& id,
442  int label,
443  SettingLevel level,
444  float value,
445  const std::string& formatString,
446  float minimum,
447  float step,
448  float maximum,
449  int heading = -1,
450  bool usePopup = false,
451  bool delayed = false,
452  bool visible = true,
453  int help = -1);
454 
455  // range controls
456  std::shared_ptr<CSettingList> AddPercentageRange(const std::shared_ptr<CSettingGroup>& group,
457  const std::string& id,
458  int label,
459  SettingLevel level,
460  int valueLower,
461  int valueUpper,
462  int valueFormatLabel,
463  int step = 1,
464  int formatLabel = 21469,
465  bool delayed = false,
466  bool visible = true,
467  int help = -1);
468  std::shared_ptr<CSettingList> AddPercentageRange(const std::shared_ptr<CSettingGroup>& group,
469  const std::string& id,
470  int label,
471  SettingLevel level,
472  int valueLower,
473  int valueUpper,
474  const std::string& valueFormatString = "{:d} %",
475  int step = 1,
476  int formatLabel = 21469,
477  bool delayed = false,
478  bool visible = true,
479  int help = -1);
480  std::shared_ptr<CSettingList> AddRange(const std::shared_ptr<CSettingGroup>& group,
481  const std::string& id,
482  int label,
483  SettingLevel level,
484  int valueLower,
485  int valueUpper,
486  int minimum,
487  int step,
488  int maximum,
489  int valueFormatLabel,
490  int formatLabel = 21469,
491  bool delayed = false,
492  bool visible = true,
493  int help = -1);
494  std::shared_ptr<CSettingList> AddRange(const std::shared_ptr<CSettingGroup>& group,
495  const std::string& id,
496  int label,
497  SettingLevel level,
498  int valueLower,
499  int valueUpper,
500  int minimum,
501  int step,
502  int maximum,
503  const std::string& valueFormatString = "{:d}",
504  int formatLabel = 21469,
505  bool delayed = false,
506  bool visible = true,
507  int help = -1);
508  std::shared_ptr<CSettingList> AddRange(const std::shared_ptr<CSettingGroup>& group,
509  const std::string& id,
510  int label,
511  SettingLevel level,
512  float valueLower,
513  float valueUpper,
514  float minimum,
515  float step,
516  float maximum,
517  int valueFormatLabel,
518  int formatLabel = 21469,
519  bool delayed = false,
520  bool visible = true,
521  int help = -1);
522  std::shared_ptr<CSettingList> AddRange(const std::shared_ptr<CSettingGroup>& group,
523  const std::string& id,
524  int label,
525  SettingLevel level,
526  float valueLower,
527  float valueUpper,
528  float minimum,
529  float step,
530  float maximum,
531  const std::string& valueFormatString = "{:.1f}",
532  int formatLabel = 21469,
533  bool delayed = false,
534  bool visible = true,
535  int help = -1);
536  std::shared_ptr<CSettingList> AddDateRange(const std::shared_ptr<CSettingGroup>& group,
537  const std::string& id,
538  int label,
539  SettingLevel level,
540  int valueLower,
541  int valueUpper,
542  int minimum,
543  int step,
544  int maximum,
545  int valueFormatLabel,
546  int formatLabel = 21469,
547  bool delayed = false,
548  bool visible = true,
549  int help = -1);
550  std::shared_ptr<CSettingList> AddDateRange(const std::shared_ptr<CSettingGroup>& group,
551  const std::string& id,
552  int label,
553  SettingLevel level,
554  int valueLower,
555  int valueUpper,
556  int minimum,
557  int step,
558  int maximum,
559  const std::string& valueFormatString = "",
560  int formatLabel = 21469,
561  bool delayed = false,
562  bool visible = true,
563  int help = -1);
564  std::shared_ptr<CSettingList> AddTimeRange(const std::shared_ptr<CSettingGroup>& group,
565  const std::string& id,
566  int label,
567  SettingLevel level,
568  int valueLower,
569  int valueUpper,
570  int minimum,
571  int step,
572  int maximum,
573  int valueFormatLabel,
574  int formatLabel = 21469,
575  bool delayed = false,
576  bool visible = true,
577  int help = -1);
578  std::shared_ptr<CSettingList> AddTimeRange(const std::shared_ptr<CSettingGroup>& group,
579  const std::string& id,
580  int label,
581  SettingLevel level,
582  int valueLower,
583  int valueUpper,
584  int minimum,
585  int step,
586  int maximum,
587  const std::string& valueFormatString = "mm:ss",
588  int formatLabel = 21469,
589  bool delayed = false,
590  bool visible = true,
591  int help = -1);
592 
593  std::shared_ptr<ISettingControl> GetTitleControl(bool separatorBelowLabel = true, bool hideSeparator = false);
594  std::shared_ptr<ISettingControl> GetCheckmarkControl(bool delayed = false);
595  std::shared_ptr<ISettingControl> GetEditControl(const std::string &format, bool delayed = false, bool hidden = false, bool verifyNewValue = false, int heading = -1);
596  std::shared_ptr<ISettingControl> GetButtonControl(const std::string &format, bool delayed = false, int heading = -1, bool hideValue = false, bool showInstalledAddons = true,
597  bool showInstallableAddons = false, bool showMoreAddons = true);
598  std::shared_ptr<ISettingControl> GetSpinnerControl(const std::string &format, bool delayed = false, int minimumLabel = -1, int formatLabel = -1, const std::string &formatString = "");
599  std::shared_ptr<ISettingControl> GetListControl(
600  const std::string& format,
601  bool delayed = false,
602  int heading = -1,
603  bool multiselect = false,
604  SettingControlListValueFormatter formatter = nullptr,
605  bool details = false);
606  std::shared_ptr<ISettingControl> GetSliderControl(const std::string &format, bool delayed = false, int heading = -1, bool usePopup = false, int formatLabel = -1, const std::string &formatString = "");
607  std::shared_ptr<ISettingControl> GetRangeControl(const std::string &format, bool delayed = false, int formatLabel = -1, int valueFormatLabel = -1, const std::string &valueFormatString = "");
608 
609 private:
610  std::shared_ptr<CSettingList> AddRange(const std::shared_ptr<CSettingGroup>& group,
611  const std::string& id,
612  int label,
613  SettingLevel level,
614  int valueLower,
615  int valueUpper,
616  int minimum,
617  int step,
618  int maximum,
619  const std::string& format,
620  int formatLabel,
621  int valueFormatLabel,
622  const std::string& valueFormatString,
623  bool delayed,
624  bool visible,
625  int help);
626  std::shared_ptr<CSettingList> AddRange(const std::shared_ptr<CSettingGroup>& group,
627  const std::string& id,
628  int label,
629  SettingLevel level,
630  float valueLower,
631  float valueUpper,
632  float minimum,
633  float step,
634  float maximum,
635  const std::string& format,
636  int formatLabel,
637  int valueFormatLabel,
638  const std::string& valueFormatString,
639  bool delayed,
640  bool visible,
641  int help);
642 
643  void setSettingDetails(const std::shared_ptr<CSetting>& setting,
644  SettingLevel level,
645  bool visible,
646  int help);
647 
648  mutable CSettingsManager *m_settingsManager;
649  std::shared_ptr<CSettingSection> m_section;
650 };
Category of groups of settings being part of a section.
Definition: SettingSection.h:85
Definition: SettingDateTime.h:15
List setting implementation.
Definition: Setting.h:168
Setting base class containing all the properties which are common to all settings independent of the ...
Definition: Setting.h:46
String setting implementation.
Definition: Setting.h:423
Definition: GUIDialogSettingsManagerBase.h:15
Section of setting categories.
Definition: SettingSection.h:144
Definition: SettingDateTime.h:31
Real number setting implementation.
Definition: Setting.h:363
Action setting implementation.
Definition: Setting.h:506
Definition: SettingAddon.h:19
Definition: SmartPlayList.cpp:137
Definition: SettingPath.h:17
Settings manager responsible for initializing, loading and handling all settings. ...
Definition: SettingsManager.h:41
Group of settings being part of a category.
Definition: SettingSection.h:28
Boolean setting implementation.
Definition: Setting.h:229
Integer setting implementation.
Definition: Setting.h:274
SettingLevel
Levels which every setting is assigned to.
Definition: SettingLevel.h:15
Definition: GUIDialogSettingsManualBase.h:37