![]() |
NDEVR
API Documentation
|
The default object to store data of any type that should persist through sessions of the application. More...
Public Member Functions | |
| ApplicationOption (const TranslatedString &group, const TranslatedString &label, const t_type &value, ApplicationOptions &options=ApplicationOptions::UserOptions()) | |
| Constructs an ApplicationOption with a group, label, and default value using copy semantics. | |
| ApplicationOption (const TranslatedString &label, const t_type &value, ApplicationOptions &options=ApplicationOptions::UserOptions()) | |
| Constructs an ApplicationOption with no group, using the default group. | |
| ApplicationOption (TranslatedString &&group, TranslatedString &&label, const t_type &value, ApplicationOptions &options=ApplicationOptions::UserOptions()) | |
| Constructs an ApplicationOption with a group, label, and default value using move semantics. | |
| void | addListener (ResourceListener *listener, bool silent_add=false) |
| Registers a ResourceListener to be notified when this option's value changes. | |
| virtual void | fromString (const String &value) override |
| Sets the option value by parsing the given string. | |
| template<class t_other_type = t_type> | |
| decltype(auto) | get () const |
| Retrieves the current value of this option. | |
| Resource< t_type > & | getResource () |
| Returns a reference to the underlying Resource holding this option's value. | |
| const TranslatedString & | group () const |
| Returns the translated group name for this option. | |
| virtual INIOption * | iniOption () override |
| Creates an INIOption representation of this option for INI file serialization. | |
| virtual bool | isDefault () const override |
| Checks whether the current value matches the default value. | |
| const TranslatedString & | label () const |
| Returns the translated display label for this option. | |
| void | set (const t_type &value, bool make_default=false) |
| Sets the option to a new value, optionally updating the default as well. | |
| void | setDefaultValue (const t_type &value) |
| Updates the default value without changing the current value. | |
| virtual void | setToDefaultValue () override |
| Resets the option value back to its default. | |
| virtual StringAllocatingView | toString () const override |
| Converts the stored option value to a string representation. | |
| Public Member Functions inherited from ApplicationOptionBase | |
| virtual | ~ApplicationOptionBase () |
| Destructor. | |
Protected Attributes | |
| t_type | m_default_value |
| The default value used for reset operations. | |
| const TranslatedString | m_group |
| The group this option belongs to for categorization. | |
| const TranslatedString | m_label |
| The display label identifying this option. | |
| ApplicationOptions & | m_options |
| Reference to the owning ApplicationOptions container. | |
| Resource< t_type > | m_value |
| The resource holding the current option value. | |
The default object to store data of any type that should persist through sessions of the application.
Stores data of any type that can easily be saved or retrieved at runtime. Option belongs to a specific group for easy sorting and can be used to automatically generate widgets.
Definition at line 170 of file ApplicationOptions.h.
|
inline |
Constructs an ApplicationOption with a group, label, and default value using move semantics.
| [in] | group | The translated group name (moved). |
| [in] | label | The translated display label (moved). |
| [in] | value | The initial and default value for this option. |
| [in] | options | The ApplicationOptions container to register with. |
Definition at line 180 of file ApplicationOptions.h.
References group(), label(), m_default_value, m_group, m_label, m_options, m_value, and ApplicationOptions::UserOptions().
|
inline |
Constructs an ApplicationOption with a group, label, and default value using copy semantics.
| [in] | group | The translated group name. |
| [in] | label | The translated display label. |
| [in] | value | The initial and default value for this option. |
| [in] | options | The ApplicationOptions container to register with. |
Definition at line 197 of file ApplicationOptions.h.
References group(), label(), m_default_value, m_group, m_label, m_options, m_value, and ApplicationOptions::UserOptions().
|
inline |
Constructs an ApplicationOption with no group, using the default group.
| [in] | label | The translated display label. |
| [in] | value | The initial and default value for this option. |
| [in] | options | The ApplicationOptions container to register with. |
Definition at line 213 of file ApplicationOptions.h.
References label(), m_default_value, m_label, m_options, m_value, and ApplicationOptions::UserOptions().
|
inline |
Registers a ResourceListener to be notified when this option's value changes.
| [in] | listener | The listener to add. |
| [in] | silent_add | If true, the listener is not immediately notified of the current value. |
Definition at line 267 of file ApplicationOptions.h.
References m_value.
|
inlineoverridevirtual |
Sets the option value by parsing the given string.
| [in] | value | The string to parse into the option's type. |
Implements ApplicationOptionBase.
Definition at line 285 of file ApplicationOptions.h.
References String::getAs(), and m_value.
|
inline |
Retrieves the current value of this option.
Definition at line 227 of file ApplicationOptions.h.
References m_value.
|
inline |
Returns a reference to the underlying Resource holding this option's value.
Definition at line 236 of file ApplicationOptions.h.
References m_value.
Referenced by QCustomLineEdit::setup().
|
inline |
Returns the translated group name for this option.
Definition at line 329 of file ApplicationOptions.h.
References m_group.
Referenced by ApplicationOption(), and ApplicationOption().
|
inlineoverridevirtual |
Creates an INIOption representation of this option for INI file serialization.
Implements ApplicationOptionBase.
Definition at line 311 of file ApplicationOptions.h.
References m_value, and INIFactory::ToOption().
|
inlineoverridevirtual |
Checks whether the current value matches the default value.
Implements ApplicationOptionBase.
Definition at line 294 of file ApplicationOptions.h.
References m_default_value, and m_value.
|
inline |
Returns the translated display label for this option.
Definition at line 320 of file ApplicationOptions.h.
References m_label.
Referenced by ApplicationOption(), ApplicationOption(), ApplicationOption(), and QCustomLineEdit::setup().
|
inline |
Sets the option to a new value, optionally updating the default as well.
| [in] | value | The new value to assign. |
| [in] | make_default | If true, also updates the default value to match. |
Definition at line 246 of file ApplicationOptions.h.
References m_default_value, and m_value.
|
inline |
Updates the default value without changing the current value.
| [in] | value | The new default value. |
Definition at line 257 of file ApplicationOptions.h.
References m_default_value.
|
inlineoverridevirtual |
Converts the stored option value to a string representation.
Implements ApplicationOptionBase.
Definition at line 276 of file ApplicationOptions.h.
References m_value.