Commit 8f9a8755 authored by Rafaël Carré's avatar Rafaël Carré

Adds CONFIG_ITEM_PASSWORD for showing stars in preferences dialog (still to be...

Adds CONFIG_ITEM_PASSWORD for showing stars in preferences dialog (still to be implemented in interfaces)
parent fa2ab17f
......@@ -66,6 +66,7 @@ extern "C" {
#define CONFIG_ITEM_MODULE_LIST 0x00A0 /* Module option */
#define CONFIG_ITEM_MODULE_LIST_CAT 0x00B0 /* Module option */
#define CONFIG_ITEM_FONT 0x00C0 /* Font option */
#define CONFIG_ITEM_PASSWORD 0x00D0 /* Password option (*) */
#define CONFIG_ITEM 0x00F0
......@@ -263,6 +264,10 @@ VLC_EXPORT(const char *, config_GetDataDir, ( void ));
add_typename_inner( type, name, text, longtext, advc, cb ); \
p_config[i_config].value.psz = v
#define add_password_inner( type, name, text, longtext, advc, cb, v ) \
add_typename_inner( type, name, text, longtext, advc, cb ); \
p_config[i_config].value.psz = v
#define add_int_inner( type, name, text, longtext, advc, cb, v ) \
add_typename_inner( type, name, text, longtext, advc, cb ); \
p_config[i_config].value.i = v
......@@ -294,6 +299,9 @@ VLC_EXPORT(const char *, config_GetDataDir, ( void ));
#define add_string( name, value, p_callback, text, longtext, advc ) \
add_string_inner( CONFIG_ITEM_STRING, name, text, longtext, advc, p_callback, value )
#define add_password( name, value, p_callback, text, longtext, advc ) \
add_password_inner( CONFIG_ITEM_PASSWORD, name, text, longtext, advc, p_callback, value )
#define add_file( name, value, p_callback, text, longtext, advc ) \
add_string_inner( CONFIG_ITEM_FILE, name, text, longtext, advc, p_callback, value )
......
......@@ -102,6 +102,14 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
p_control = new StringListConfigControl( p_this, p_item,
parent, false, l, line );
break;
case CONFIG_ITEM_PASSWORD:
if( !p_item->i_list )
p_control = new StringConfigControl( p_this, p_item, parent,
l, line, true );
else
p_control = new StringListConfigControl( p_this, p_item,
parent, true, l, line );
break;
case CONFIG_ITEM_INTEGER:
if( p_item->i_list )
p_control = new IntegerListConfigControl( p_this, p_item,
......
......@@ -151,7 +151,7 @@ vlc_module_begin();
set_description( N_("Audioscrobbler submission Plugin") );
add_string( "lastfm-username", "", NULL,
USERNAME_TEXT, USERNAME_LONGTEXT, VLC_FALSE );
add_string( "lastfm-password", "", NULL,
add_password( "lastfm-password", "", NULL,
PASSWORD_TEXT, PASSWORD_LONGTEXT, VLC_FALSE );
set_capability( "interface", 0 );
set_callbacks( Open, Close );
......
......@@ -90,7 +90,7 @@ int IsConfigStringType (int type)
static const unsigned char config_types[] =
{
CONFIG_ITEM_STRING, CONFIG_ITEM_FILE, CONFIG_ITEM_MODULE,
CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_MODULE_CAT,
CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_MODULE_CAT, CONFIG_ITEM_PASSWORD,
CONFIG_ITEM_MODULE_LIST, CONFIG_ITEM_MODULE_LIST_CAT
};
......@@ -161,6 +161,10 @@ int __config_GetType( vlc_object_t *p_this, const char *psz_name )
i_type = VLC_VAR_STRING;
break;
case CONFIG_ITEM_PASSWORD:
i_type = VLC_VAR_STRING;
break;
case CONFIG_ITEM_FILE:
i_type = VLC_VAR_FILE;
break;
......@@ -239,7 +243,7 @@ float __config_GetFloat( vlc_object_t *p_this, const char *psz_name )
*****************************************************************************
* This function is used to get the value of variables which are internally
* represented by a string (CONFIG_ITEM_STRING, CONFIG_ITEM_FILE,
* CONFIG_ITEM_DIRECTORY, and CONFIG_ITEM_MODULE).
* CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_PASSWORD, and CONFIG_ITEM_MODULE).
*
* Important note: remember to free() the returned char* because it's a
* duplicate of the actual value. It isn't safe to return a pointer to the
......@@ -277,7 +281,7 @@ char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name )
*****************************************************************************
* This function is used to set the value of variables which are internally
* represented by a string (CONFIG_ITEM_STRING, CONFIG_ITEM_FILE,
* CONFIG_ITEM_DIRECTORY, and CONFIG_ITEM_MODULE).
* CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_PASSWORD, and CONFIG_ITEM_MODULE).
*****************************************************************************/
void __config_PutPsz( vlc_object_t *p_this,
const char *psz_name, const char *psz_value )
......@@ -1586,6 +1590,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
switch( p_conf->i_type )
{
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_PASSWORD:
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE:
......@@ -1617,6 +1622,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
switch( pp_shortopts[i_cmd]->i_type )
{
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_PASSWORD:
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE:
......
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