comparison foosdk/sdk/foobar2000/SDK/advconfig.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2
3 //! Entrypoint class for adding items to Advanced Preferences page. \n
4 //! Implementations must derive from one of subclasses: advconfig_branch, advconfig_entry_checkbox, advconfig_entry_string. \n
5 //! Implementations are typically registered using static service_factory_single_t<myclass>, or using provided helper classes in case of standard implementations declared in this header.
6 class NOVTABLE advconfig_entry : public service_base {
7 public:
8 virtual void get_name(pfc::string_base & p_out) = 0;
9 virtual GUID get_guid() = 0;
10 virtual GUID get_parent() = 0;
11 virtual void reset() = 0;
12 virtual double get_sort_priority() = 0;
13
14 bool is_branch();
15 t_uint32 get_preferences_flags_();
16
17 static bool g_find(service_ptr_t<advconfig_entry>& out, const GUID & id);
18
19 template<typename outptr> static bool g_find_t(outptr & out, const GUID & id) {
20 service_ptr_t<advconfig_entry> temp;
21 if (!g_find(temp, id)) return false;
22 return temp->service_query_t(out);
23 }
24
25 static const GUID guid_root;
26 static const GUID guid_branch_tagging,guid_branch_decoding,guid_branch_tools,guid_branch_playback,guid_branch_display,guid_branch_debug, guid_branch_tagging_general, guid_branch_converter;
27
28
29 // \since 2.0
30 static const GUID guid_branch_vis, guid_branch_general;
31
32 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(advconfig_entry);
33 };
34
35 //! Declares a new branch in Advanced Preferences. \n
36 //! Implementation: see advconfig_branch_impl / advconfig_branch_factory.
37 class NOVTABLE advconfig_branch : public advconfig_entry {
38 public:
39 FB2K_MAKE_SERVICE_INTERFACE(advconfig_branch,advconfig_entry);
40 };
41
42 //! Declares a checkbox/radiocheckbox entry in Advanced Preferences. \n
43 //! The difference between checkboxes and radiocheckboxes is different icon (obviously) and that checking a radiocheckbox unchecks all other radiocheckboxes in the same branch. \n
44 //! Implementation: see advconfig_entry_checkbox_impl / advconfig_checkbox_factory_t.
45 class NOVTABLE advconfig_entry_checkbox : public advconfig_entry {
46 public:
47 virtual bool get_state() = 0;
48 virtual void set_state(bool p_state) = 0;
49 virtual bool is_radio() = 0;
50
51 bool get_default_state_();
52
53 FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_checkbox,advconfig_entry);
54 };
55
56 //! Extension to advconfig_entry_checkbox, adds default state and preferences flags.
57 class NOVTABLE advconfig_entry_checkbox_v2 : public advconfig_entry_checkbox {
58 FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_checkbox_v2, advconfig_entry_checkbox)
59 public:
60 virtual bool get_default_state() = 0;
61 virtual t_uint32 get_preferences_flags() {return 0;} //signals whether changing this setting should trigger playback restart or app restart; see: preferences_state::* constants
62 };
63
64 //! Declares a string/integer editbox entry in Advanced Preferences.\n
65 //! Implementation: see advconfig_entry_string_impl / advconfig_string_factory.
66 class NOVTABLE advconfig_entry_string : public advconfig_entry {
67 public:
68 virtual void get_state(pfc::string_base & p_out) = 0;
69 virtual void set_state(const char * p_string,t_size p_length = SIZE_MAX) = 0;
70 virtual t_uint32 get_flags() = 0;
71
72 void get_default_state_(pfc::string_base & out);
73
74 static constexpr uint32_t
75 flag_is_integer = 1 << 0,
76 flag_is_signed = 1 << 1,
77 // Since 2.2: hint to treat these fields as file/folder paths, providing hints if suitable
78 flag_is_file_path = 1 << 2,
79 flag_is_folder_path = 1 << 3,
80 // Since 2.2: multiple values, semicolon delimited
81 flag_semicolon_delimited = 1 << 4;
82
83 FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_string,advconfig_entry);
84 };
85
86 //! Extension to advconfig_entry_string, adds default state, validation and preferences flags.
87 class NOVTABLE advconfig_entry_string_v2 : public advconfig_entry_string {
88 FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_string_v2, advconfig_entry_string)
89 public:
90 virtual void get_default_state(pfc::string_base & out) = 0;
91 virtual void validate(pfc::string_base& val) { (void)val; }
92 virtual t_uint32 get_preferences_flags() {return 0;} //signals whether changing this setting should trigger playback restart or app restart; see: preferences_state::* constants
93 };