From 8f9a875552bb69ba4ecf5e075bf127aa96ff7511 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Sun, 19 Aug 2007 18:44:32 +0000 Subject: [PATCH] Adds CONFIG_ITEM_PASSWORD for showing stars in preferences dialog (still to be implemented in interfaces) --- include/vlc_configuration.h | 8 ++++++++ modules/gui/qt4/components/preferences_widgets.cpp | 8 ++++++++ modules/misc/audioscrobbler.c | 2 +- src/modules/configuration.c | 12 +++++++++--- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h index b4d1c47633..6ced4a5c2f 100644 --- a/include/vlc_configuration.h +++ b/include/vlc_configuration.h @@ -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 ) diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index 3e23ff9967..7e6236ddb8 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -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, diff --git a/modules/misc/audioscrobbler.c b/modules/misc/audioscrobbler.c index e08e790280..c41f82ee73 100644 --- a/modules/misc/audioscrobbler.c +++ b/modules/misc/audioscrobbler.c @@ -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 ); diff --git a/src/modules/configuration.c b/src/modules/configuration.c index 57d7a67dc5..3d8eb51a7f 100644 --- a/src/modules/configuration.c +++ b/src/modules/configuration.c @@ -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: -- 2.39.2