Commit b96154a2 authored by André Weber's avatar André Weber

Enable the last parameter of the macros change_integer_list,...

Enable the last parameter of the macros change_integer_list, change_string_list to supply a method to initialize update dynamic selectionlists inside the settings GUI allready on showing the gui. (f.e. the audio device list)
parent 487b2b1e
......@@ -169,6 +169,7 @@ struct module_config_t
int *pi_list; /* Idem for integers */
char **ppsz_list_text; /* Friendly names for list values */
int i_list; /* Options list size */
vlc_callback_t pf_update_list; /*callback to initialize dropdownlists */
/* Actions list */
vlc_callback_t *ppf_action; /* List of possible actions for a config */
......@@ -435,19 +436,22 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, int, ...) );
vlc_config_set (p_config, VLC_CONFIG_LIST, \
(size_t)(sizeof (list) / sizeof (char *)), \
(const char *const *)(list), \
(const char *const *)(list_text))
(const char *const *)(list_text), \
list_update_func)
#define change_integer_list( list, list_text, list_update_func ) \
vlc_config_set (p_config, VLC_CONFIG_LIST, \
(size_t)(sizeof (list) / sizeof (int)), \
(const int *)(list), \
(const char *const *)(list_text))
(const char *const *)(list_text), \
list_update_func)
#define change_float_list( list, list_text, list_update_func ) \
vlc_config_set (p_config, VLC_CONFIG_LIST, \
(size_t)(sizeof (list) / sizeof (float)), \
(const float *)(list), \
(const char *const *)(list_text))
(const char *const *)(list_text), \
list_update_func)
#define change_integer_range( minv, maxv ) \
vlc_config_set (p_config, VLC_CONFIG_RANGE, (int)(minv), (int)(maxv))
......
......@@ -35,8 +35,8 @@
/**
* Current plugin ABI version
*/
# define MODULE_SYMBOL 0_9_0g
# define MODULE_SUFFIX "__0_9_0g"
# define MODULE_SYMBOL 0_9_0h
# define MODULE_SUFFIX "__0_9_0h"
/*****************************************************************************
* Add a few defines. You do not want to read this section. Really.
......
......@@ -373,7 +373,21 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
combo->setMinimumWidth( MINWIDTH_BOX );
combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
module_config_t *p_module_config = config_FindConfig( p_this, getName() );
module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
if(p_module_config && p_module_config->pf_update_list)
{
vlc_value_t val;
val.psz_string = strdup(p_module_config->value.psz);
p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
// assume in a×y case that dirty was set to VLC_TRUE
// because lazy programmes will use the same callback for
// this, like the one behind the refresh push button?
p_module_config->b_dirty = VLC_FALSE;
if(val.psz_string) free(val.psz_string);
}
finish( p_module_config, bycat );
if( !l )
......@@ -473,6 +487,17 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
config_FindConfig( VLC_OBJECT(p_intf), configname );
if( p_config )
{
if(p_config->pf_update_list)
{
vlc_value_t val;
val.i_int = p_config->value.i;
p_config->pf_update_list(VLC_OBJECT(p_intf), configname, val, val, NULL);
// assume in any case that dirty was set to VLC_TRUE
// because lazy programmes will use the same callback for
// this, like the one behind the refresh push button?
p_config->b_dirty = VLC_FALSE;
}
for ( int i_index = 0; i_index < p_config->i_list; i_index++ )
{
combo->addItem( qfu( p_config->ppsz_list_text[i_index] ),
......@@ -837,7 +862,20 @@ IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
combo = new QComboBox();
combo->setMinimumWidth( MINWIDTH_BOX );
module_config_t *p_module_config = config_FindConfig( p_this, getName() );
module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
if(p_module_config && p_module_config->pf_update_list)
{
vlc_value_t val;
val.i_int = p_module_config->value.i;
p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
// assume in any case that dirty was set to VLC_TRUE
// because lazy programmes will use the same callback for
// this, like the one behind the refresh push button?
p_module_config->b_dirty = VLC_FALSE;
}
finish( p_module_config, bycat );
if( !l )
......
......@@ -563,7 +563,26 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *p_this,
combo = new wxComboBox( this, -1, wxT(""),
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
UpdateCombo( p_item );
// was required to do so - because local p_item is a memcpy of
// this one, so it won't see the change done by pf_updat_list
module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
if(p_module_config && p_module_config->pf_update_list)
{
vlc_value_t val;
val.psz_string = strdup(p_module_config->value.psz);
p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
// assume in ay case that dirty was set to VLC_TRUE
// because lazy programmes will use the same callback for
// this, like the one behind the refresh push button?
p_module_config->b_dirty = VLC_FALSE;
if(val.psz_string) free(val.psz_string);
}
UpdateCombo( p_module_config );
combo->SetToolTip( wxU(p_item->psz_longtext) );
sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
......@@ -793,7 +812,21 @@ IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *p_this,
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
UpdateCombo( p_item );
module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
if(p_module_config && p_module_config->pf_update_list)
{
vlc_value_t val;
val.i_int = p_module_config->value.i;
p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
// assume in any case that dirty was set to VLC_TRUE
// because lazy programmes will use the same callback for
// this, like the one behind the refresh push button?
p_module_config->b_dirty = VLC_FALSE;
}
UpdateCombo( p_module_config );
combo->SetToolTip( wxU(p_item->psz_longtext) );
sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
......
......@@ -368,6 +368,7 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
}
item->i_list = len;
item->pf_update_list = va_arg (ap, vlc_callback_t);
ret = 0;
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment