Commit b8a57f96 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove configuration item actions for now

This hinders the following commits. This was only used in a single
plugin on a single platform, and was poorly designed.
parent 8b3d0dd7
......@@ -76,11 +76,6 @@ struct module_config_t
unsigned b_unsaveable:1; /* Config should not be saved */
unsigned b_safe:1; /* Safe to use in web plugins and playlists */
/* Actions list */
int i_action; /* actions list size */
vlc_callback_t *ppf_action; /* List of possible actions for a config */
char **ppsz_action_text; /* Friendly names for actions */
/* Deprecated */
bool b_removed;
};
......
......@@ -95,9 +95,8 @@ enum vlc_module_properties
/* 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 */
};
......@@ -494,8 +493,7 @@ VLC_METADATA_EXPORTS
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() \
......
......@@ -25,7 +25,6 @@
/**
* Todo:
* - i_action handler for IntegerLists, but I don't see any module using it...
* - Validator for modulelist
*/
#ifdef HAVE_CONFIG_H
......@@ -394,23 +393,6 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
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 )
......@@ -419,7 +401,7 @@ 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 );
}
......@@ -429,24 +411,6 @@ void StringListConfigControl::comboIndexChanged( int i_index )
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 )
......@@ -910,24 +874,6 @@ IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
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 )
......@@ -936,7 +882,7 @@ 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 );
}
......@@ -982,24 +928,6 @@ void IntegerListConfigControl::finish(module_config_t *p_module_config )
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();
......
......@@ -196,9 +196,6 @@ private:
QLabel *label;
QComboBox *combo;
QList<QPushButton *> buttons;
private slots:
void actionRequested( int );
};
class BoolConfigControl : public VIntConfigControl
......@@ -456,7 +453,6 @@ private:
QLabel *label;
QList<QPushButton *> buttons;
private slots:
void actionRequested( int );
void comboIndexChanged( int );
};
......
......@@ -550,14 +550,6 @@ void config_Free (module_config_t *config, size_t confsize)
free( p_item->ppsz_list );
free( p_item->ppsz_list_text );
free( p_item->pi_list );
if( p_item->i_action )
{
for (int i = 0; i < p_item->i_action; i++)
free( p_item->ppsz_action_text[i] );
free( p_item->ppf_action );
free( p_item->ppsz_action_text );
}
}
free (config);
......
......@@ -341,20 +341,6 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
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;
......@@ -551,9 +537,6 @@ static int CacheSaveConfig (FILE *file, const module_t *p_module)
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;
......
......@@ -423,36 +423,6 @@ static int vlc_plugin_setter (void *plugin, void *tgt, int propid, ...)
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");
......
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