Improve properties API

Improve the properties API so that it can actually respond somewhat to
user input.  Maybe later this might be further improved or replaced with
something script-based.

When creating a property, you can now add a callback to that property
that notifies when the property has been changed in the user interface.
Return true if you want the properties to be refreshed, or false if not.
Though now that I think about it I doubt there would ever be a case
where you would have this callback and *not* refresh the properties.

Regardless, this allows functions to change the values of properties or
settings, or enable/disable/hide other property controls from view
dynamically.
This commit is contained in:
jp9000
2014-04-04 00:30:37 -07:00
parent baa57d4c39
commit 1bca7e0a3e
18 changed files with 466 additions and 174 deletions

View File

@@ -709,7 +709,7 @@ static void *coreaudio_create_output_capture(obs_data_t settings,
static obs_properties_t coreaudio_properties(const char *locale, bool input)
{
obs_properties_t props = obs_properties_create();
obs_properties_t props = obs_properties_create(locale);
obs_property_t property;
struct device_list devices;
@@ -723,17 +723,15 @@ static obs_properties_t coreaudio_properties(const char *locale, bool input)
/* TODO: translate */
if (devices.items.num)
obs_property_list_add_item(property, "Default", "default");
obs_property_list_add_string(property, "Default", "default");
for (size_t i = 0; i < devices.items.num; i++) {
struct device_item *item = devices.items.array+i;
obs_property_list_add_item(property,
obs_property_list_add_string(property,
item->name.array, item->value.array);
}
device_list_free(&devices);
UNUSED_PARAMETER(locale);
return props;
}