/* possible values list
* (args=const char *, size_t, const <type> *, const char *const *) */
- VLC_CONFIG_ADD_ACTION,
- /* add value change callback
- * (args=const char *, vlc_callback_t, const char *) */
+ VLC_CONFIG_ADD_ACTION_OBSOLETE,
+ /* unused (ignored) */
/* Insert new VLC_CONFIG_* here */
};
vlc_config_set (VLC_CONFIG_RANGE, (double)(minv), (double)(maxv));
#define change_action_add( pf_action, text ) \
- vlc_config_set (VLC_CONFIG_ADD_ACTION, \
- (vlc_callback_t)(pf_action), (const char *)(text));
+ (void)(pf_action, text);
/* For options that are saved but hidden from the preferences panel */
#define change_private() \
/**
* Todo:
- * - i_action handler for IntegerLists, but I don't see any module using it...
* - Validator for modulelist
*/
#ifdef HAVE_CONFIG_H
module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
finish( p_module_config );
-
- if( p_item->i_action )
- {
- QSignalMapper *signalMapper = new QSignalMapper(this);
-
- /* Some stringLists like Capture listings have action associated */
- for( int i = 0; i < p_item->i_action; i++ )
- {
- QPushButton *button =
- new QPushButton( qtr( p_item->ppsz_action_text[i] ), p );
- buttons << button;
- CONNECT( button, clicked(), signalMapper, map() );
- signalMapper->setMapping( button, i );
- }
- CONNECT( signalMapper, mapped( int ),
- this, actionRequested( int ) );
- }
}
void StringListConfigControl::fillGrid( QGridLayout *l, int line )
l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
int i = 0;
foreach( QPushButton *button, buttons )
- l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i++,
+ l->addWidget( button, line, LAST_COLUMN + i++,
Qt::AlignRight );
}
emit changed();
}
-void StringListConfigControl::actionRequested( int i_action )
-{
- /* Supplementary check for boundaries */
- if( i_action < 0 || i_action >= p_item->i_action ) return;
-
- module_config_t *p_module_config = config_FindConfig( p_this, getName() );
- if(!p_module_config) return;
-
- vlc_value_t val;
- val.psz_string = const_cast<char *>
- qtu( (combo->itemData( combo->currentIndex() ).toString() ) );
-
- p_module_config->ppf_action[i_action]( p_this, getName(), val, val, 0 );
-
- combo->clear();
- finish( p_module_config );
-}
-
StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
bool ) : VStringConfigControl( _p_this, _p_item )
module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
finish( p_module_config );
-
- if( p_item->i_action )
- {
- QSignalMapper *signalMapper = new QSignalMapper(this);
-
- /* Some stringLists like Capture listings have action associated */
- for( int i = 0; i < p_item->i_action; i++ )
- {
- QPushButton *button =
- new QPushButton( qfu( p_item->ppsz_action_text[i] ), p );
- buttons << button;
- CONNECT( button, clicked(), signalMapper, map() );
- signalMapper->setMapping( button, i );
- }
- CONNECT( signalMapper, mapped( int ),
- this, actionRequested( int ) );
- }
-
}
void IntegerListConfigControl::fillGrid( QGridLayout *l, int line )
l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
int i = 0;
foreach( QPushButton *button, buttons )
- l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i++,
+ l->addWidget( button, line, LAST_COLUMN + i++,
Qt::AlignRight );
}
label->setBuddy( combo );
}
-void IntegerListConfigControl::actionRequested( int i_action )
-{
- /* Supplementary check for boundaries */
- if( i_action < 0 || i_action >= p_item->i_action ) return;
-
- module_config_t *p_module_config = config_FindConfig( p_this, getName() );
- if(!p_module_config) return;
-
-
- vlc_value_t val;
- val.i_int = combo->itemData( combo->currentIndex() ).toInt();
-
- p_module_config->ppf_action[i_action]( p_this, getName(), val, val, 0 );
-
- combo->clear();
- finish( p_module_config );
-}
-
int IntegerListConfigControl::getValue() const
{
return combo->itemData( combo->currentIndex() ).toInt();
xmalloc( p_module->p_config[i].i_list * sizeof(char *) );
for( int j = 0; j < p_module->p_config[i].i_list; j++ )
LOAD_STRING( p_module->p_config[i].ppsz_list_text[j] );
-
- if( p_module->p_config[i].i_action )
- {
- p_module->p_config[i].ppf_action =
- xmalloc( p_module->p_config[i].i_action * sizeof(void *) );
- p_module->p_config[i].ppsz_action_text =
- xmalloc( p_module->p_config[i].i_action * sizeof(char *) );
-
- for (int j = 0; j < p_module->p_config[i].i_action; j++)
- {
- p_module->p_config[i].ppf_action[j] = NULL;
- LOAD_STRING( p_module->p_config[i].ppsz_action_text[j] );
- }
- }
}
return VLC_SUCCESS;
for (int j = 0; j < p_module->p_config[i].i_list; j++)
SAVE_STRING( p_module->p_config[i].ppsz_list_text[j] );
-
- for (int j = 0; j < p_module->p_config[i].i_action; j++)
- SAVE_STRING( p_module->p_config[i].ppsz_action_text[j] );
}
return 0;
break;
}
- case VLC_CONFIG_ADD_ACTION:
- {
- vlc_callback_t cb = va_arg (ap, vlc_callback_t), *tabcb;
- const char *name = va_arg (ap, const char *);
- char **tabtext;
-
- tabcb = realloc (item->ppf_action,
- (item->i_action + 2) * sizeof (cb));
- if (tabcb == NULL)
- break;
- item->ppf_action = tabcb;
- tabcb[item->i_action] = cb;
- tabcb[item->i_action + 1] = NULL;
-
- tabtext = realloc (item->ppsz_action_text,
- (item->i_action + 2) * sizeof (name));
- if (tabtext == NULL)
- break;
- item->ppsz_action_text = tabtext;
-
- if (name)
- tabtext[item->i_action] = strdup (name);
- else
- tabtext[item->i_action] = NULL;
- tabtext[item->i_action + 1] = NULL;
-
- item->i_action++;
- break;
- }
-
default:
fprintf (stderr, "LibVLC: unknown module property %d\n", propid);
fprintf (stderr, "LibVLC: too old to use this module?\n");