Commit d2adc9f3 authored by Clément Stenac's avatar Clément Stenac

Implement add_module_cat to add a module by category + use this for intf

parent dc7674b5
...@@ -51,8 +51,9 @@ ...@@ -51,8 +51,9 @@
#define CONFIG_ITEM_FLOAT 0x0060 /* Float option */ #define CONFIG_ITEM_FLOAT 0x0060 /* Float option */
#define CONFIG_ITEM_DIRECTORY 0x0070 /* Directory option */ #define CONFIG_ITEM_DIRECTORY 0x0070 /* Directory option */
#define CONFIG_ITEM_KEY 0x0080 /* Hot key option */ #define CONFIG_ITEM_KEY 0x0080 /* Hot key option */
#define CONFIG_ITEM_MODULE_LIST 0x0090 /* Module option */ #define CONFIG_ITEM_MODULE_CAT 0x0090 /* Module option */
#define CONFIG_ITEM_MODULE_LIST_CAT 0x00A0 /* Module option */ #define CONFIG_ITEM_MODULE_LIST 0x00A0 /* Module option */
#define CONFIG_ITEM_MODULE_LIST_CAT 0x00B0 /* Module option */
#define CONFIG_ITEM 0x00F0 #define CONFIG_ITEM 0x00F0
...@@ -276,6 +277,11 @@ int config_CreateDir( vlc_object_t *, char * ); ...@@ -276,6 +277,11 @@ int config_CreateDir( vlc_object_t *, char * );
(i_config+11) * sizeof(module_config_t)); \ (i_config+11) * sizeof(module_config_t)); \
{ static module_config_t tmp = { CONFIG_ITEM_MODULE, psz_caps, name, '\0', text, longtext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } { static module_config_t tmp = { CONFIG_ITEM_MODULE, psz_caps, name, '\0', text, longtext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
#define add_module_cat( name, i_subcategory, psz_value, p_callback, text, longtext, advc ) \
i_config++; \
if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
(i_config+11) * sizeof(module_config_t)); \
{ static module_config_t tmp = { CONFIG_ITEM_MODULE_CAT, NULL, name, '\0', text, longtext, psz_value, 0, 0.0, i_subcategory }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
#define add_module_list( name, psz_caps, psz_value, p_callback, text, longtext, advc ) \ #define add_module_list( name, psz_caps, psz_value, p_callback, text, longtext, advc ) \
i_config++; \ i_config++; \
......
...@@ -92,7 +92,7 @@ static void Close( vlc_object_t * ); ...@@ -92,7 +92,7 @@ static void Close( vlc_object_t * );
vlc_module_begin(); vlc_module_begin();
set_description( _("HTTP remote control interface") ); set_description( _("HTTP remote control interface") );
set_category( CAT_INTERFACE ); set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_CONTROL ); set_subcategory( SUBCAT_INTERFACE_GENERAL );
add_string ( "http-host", NULL, NULL, HOST_TEXT, HOST_LONGTEXT, VLC_TRUE ); add_string ( "http-host", NULL, NULL, HOST_TEXT, HOST_LONGTEXT, VLC_TRUE );
add_string ( "http-src", NULL, NULL, SRC_TEXT, SRC_LONGTEXT, VLC_TRUE ); add_string ( "http-src", NULL, NULL, SRC_TEXT, SRC_LONGTEXT, VLC_TRUE );
add_string ( "http-intf-cert", NULL, NULL, CERT_TEXT, CERT_LONGTEXT, VLC_TRUE ); add_string ( "http-intf-cert", NULL, NULL, CERT_TEXT, CERT_LONGTEXT, VLC_TRUE );
......
...@@ -96,7 +96,7 @@ struct intf_sys_t ...@@ -96,7 +96,7 @@ struct intf_sys_t
int i_socket; int i_socket;
char *psz_unix_path; char *psz_unix_path;
vlc_bool_t b_extend; vlc_bool_t b_extend;
#ifdef WIN32 #ifdef WIN32
HANDLE hConsoleIn; HANDLE hConsoleIn;
vlc_bool_t b_quiet; vlc_bool_t b_quiet;
...@@ -138,7 +138,6 @@ void __msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... ) ...@@ -138,7 +138,6 @@ void __msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
"You can set the address and port the interface will bind to." ) "You can set the address and port the interface will bind to." )
#define EXTEND_TEXT N_("Extended help") #define EXTEND_TEXT N_("Extended help")
#define EXTEND_LONGTEXT N_("List additional commands.") #define EXTEND_LONGTEXT N_("List additional commands.")
#ifdef WIN32 #ifdef WIN32
#define QUIET_TEXT N_("Do not open a DOS command box interface") #define QUIET_TEXT N_("Do not open a DOS command box interface")
...@@ -151,7 +150,7 @@ void __msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... ) ...@@ -151,7 +150,7 @@ void __msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
vlc_module_begin(); vlc_module_begin();
set_category( CAT_INTERFACE ); set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_CONTROL ); set_subcategory( SUBCAT_INTERFACE_GENERAL );
set_description( _("Remote control interface") ); set_description( _("Remote control interface") );
add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE ); add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
#ifdef HAVE_ISATTY #ifdef HAVE_ISATTY
......
...@@ -102,7 +102,7 @@ struct intf_sys_t ...@@ -102,7 +102,7 @@ struct intf_sys_t
int i_socket; int i_socket;
char *psz_unix_path; char *psz_unix_path;
vlc_bool_t b_extend; vlc_bool_t b_extend;
#ifdef WIN32 #ifdef WIN32
HANDLE hConsoleIn; HANDLE hConsoleIn;
#endif #endif
...@@ -141,7 +141,6 @@ static void __msg_rtci( intf_thread_t *p_intf, const char *psz_fmt, ... ) ...@@ -141,7 +141,6 @@ static void __msg_rtci( intf_thread_t *p_intf, const char *psz_fmt, ... )
"You can set the address and port the interface will bind to." ) "You can set the address and port the interface will bind to." )
#define EXTEND_TEXT N_("Extended help") #define EXTEND_TEXT N_("Extended help")
#define EXTEND_LONGTEXT N_("List additional commands.") #define EXTEND_LONGTEXT N_("List additional commands.")
#ifdef WIN32 #ifdef WIN32
#define QUIET_TEXT N_("Do not open a DOS command box interface") #define QUIET_TEXT N_("Do not open a DOS command box interface")
...@@ -153,7 +152,7 @@ static void __msg_rtci( intf_thread_t *p_intf, const char *psz_fmt, ... ) ...@@ -153,7 +152,7 @@ static void __msg_rtci( intf_thread_t *p_intf, const char *psz_fmt, ... )
vlc_module_begin(); vlc_module_begin();
set_description( _("Real time control interface") ); set_description( _("Real time control interface") );
set_category( CAT_INTERFACE ); set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_CONTROL ); set_subcategory( SUBCAT_INTERFACE_GENERAL );
add_bool( "rtci-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE ); add_bool( "rtci-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
#ifdef HAVE_ISATTY #ifdef HAVE_ISATTY
add_bool( "rtci-fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT, VLC_TRUE ); add_bool( "rtci-fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT, VLC_TRUE );
......
...@@ -82,6 +82,8 @@ static void Close( vlc_object_t * ); ...@@ -82,6 +82,8 @@ static void Close( vlc_object_t * );
#define TELNETPWD_LONGTEXT N_( "Default to admin" ) #define TELNETPWD_LONGTEXT N_( "Default to admin" )
vlc_module_begin(); vlc_module_begin();
set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_GENERAL );
add_integer( "telnet-port", 4212, NULL, TELNETPORT_TEXT, add_integer( "telnet-port", 4212, NULL, TELNETPORT_TEXT,
TELNETPORT_LONGTEXT, VLC_TRUE ); TELNETPORT_LONGTEXT, VLC_TRUE );
add_string( "telnet-password", "admin", NULL, TELNETPWD_TEXT, add_string( "telnet-password", "admin", NULL, TELNETPWD_TEXT,
......
...@@ -53,6 +53,9 @@ ConfigControl *CreateConfigControl( vlc_object_t *p_this, ...@@ -53,6 +53,9 @@ ConfigControl *CreateConfigControl( vlc_object_t *p_this,
case CONFIG_ITEM_MODULE: case CONFIG_ITEM_MODULE:
p_control = new ModuleConfigControl( p_this, p_item, parent ); p_control = new ModuleConfigControl( p_this, p_item, parent );
break; break;
case CONFIG_ITEM_MODULE_CAT:
p_control = new ModuleCatConfigControl( p_this, p_item, parent );
break;
case CONFIG_ITEM_MODULE_LIST_CAT: case CONFIG_ITEM_MODULE_LIST_CAT:
p_control = new ModuleListCatConfigControl( p_this, p_item, parent ); p_control = new ModuleListCatConfigControl( p_this, p_item, parent );
break; break;
...@@ -290,6 +293,68 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this, ...@@ -290,6 +293,68 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this,
this->SetSizerAndFit( sizer ); this->SetSizerAndFit( sizer );
} }
ModuleCatConfigControl::~ModuleCatConfigControl()
{
;
}
wxString ModuleCatConfigControl::GetPszValue()
{
return wxU( (char *)combo->GetClientData( combo->GetSelection() ));
}
/*****************************************************************************
* ModuleCatConfigControl implementation
*****************************************************************************/
ModuleCatConfigControl::ModuleCatConfigControl( vlc_object_t *p_this,
module_config_t *p_item,
wxWindow *parent )
: ConfigControl( p_this, p_item, parent )
{
vlc_list_t *p_list;
module_t *p_parser;
label = new wxStaticText(this, -1, wxU(p_item->psz_text));
combo = new wxComboBox( this, -1, wxL2U(p_item->psz_value),
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY | wxCB_SORT );
combo->Append( wxU(_("Default")), (void *)NULL );
combo->SetSelection( 0 );
/* build a list of available modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( int i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_object_name, "main" ) )
continue;
module_config_t *p_config = p_parser->p_config;
if( p_config ) do
{
/* Hack: required subcategory is stored in i_min */
if( p_config->i_type == CONFIG_SUBCATEGORY &&
p_config->i_value == p_item->i_min )
{
combo->Append( wxU(p_parser->psz_longname),
p_parser->psz_object_name );
if( p_item->psz_value && !strcmp(p_item->psz_value,
p_parser->psz_object_name) )
combo->SetValue( wxU(p_parser->psz_longname) );
}
} while( p_config->i_type != CONFIG_HINT_END && p_config++ );
}
vlc_list_release( p_list );
combo->SetToolTip( wxU(p_item->psz_longtext) );
sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
sizer->Layout();
this->SetSizerAndFit( sizer );
}
ModuleConfigControl::~ModuleConfigControl() ModuleConfigControl::~ModuleConfigControl()
{ {
; ;
...@@ -300,6 +365,7 @@ wxString ModuleConfigControl::GetPszValue() ...@@ -300,6 +365,7 @@ wxString ModuleConfigControl::GetPszValue()
return wxU( (char *)combo->GetClientData( combo->GetSelection() )); return wxU( (char *)combo->GetClientData( combo->GetSelection() ));
} }
/***************************************************************************** /*****************************************************************************
* ModuleListCatonfigControl implementation * ModuleListCatonfigControl implementation
*****************************************************************************/ *****************************************************************************/
......
...@@ -89,6 +89,17 @@ struct moduleCheckBox { ...@@ -89,6 +89,17 @@ struct moduleCheckBox {
char *psz_module; char *psz_module;
}; };
class ModuleCatConfigControl: public ConfigControl
{
public:
ModuleCatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~ModuleCatConfigControl();
virtual wxString GetPszValue();
private:
wxComboBox *combo;
};
class ModuleListCatConfigControl: public ConfigControl class ModuleListCatConfigControl: public ConfigControl
{ {
public: public:
...@@ -99,7 +110,7 @@ private: ...@@ -99,7 +110,7 @@ private:
std::vector<moduleCheckBox *> pp_checkboxes; std::vector<moduleCheckBox *> pp_checkboxes;
void OnUpdate( wxCommandEvent& ); void OnUpdate( wxCommandEvent& );
wxTextCtrl *text; wxTextCtrl *text;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -77,6 +77,8 @@ static int PlaylistNext( vlc_object_t *p_this, const char *psz_variable, ...@@ -77,6 +77,8 @@ static int PlaylistNext( vlc_object_t *p_this, const char *psz_variable,
#define COLOUR_LONGTEXT ("Colour used to display text in the xosd output") #define COLOUR_LONGTEXT ("Colour used to display text in the xosd output")
vlc_module_begin(); vlc_module_begin();
set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_CONTROL );
set_description( _("XOSD interface") ); set_description( _("XOSD interface") );
add_bool( "xosd-position", 1, NULL, POSITION_TEXT, POSITION_LONGTEXT, VLC_TRUE ); add_bool( "xosd-position", 1, NULL, POSITION_TEXT, POSITION_LONGTEXT, VLC_TRUE );
add_integer( "xosd-text-offset", 30, NULL, TXT_OFS_TEXT, TXT_OFS_LONGTEXT, VLC_TRUE ); add_integer( "xosd-text-offset", 30, NULL, TXT_OFS_TEXT, TXT_OFS_LONGTEXT, VLC_TRUE );
......
...@@ -1126,7 +1126,7 @@ vlc_module_begin(); ...@@ -1126,7 +1126,7 @@ vlc_module_begin();
set_subcategory( SUBCAT_INTERFACE_GENERAL ); set_subcategory( SUBCAT_INTERFACE_GENERAL );
set_section ( N_("Interface module" ), NULL ); set_section ( N_("Interface module" ), NULL );
add_module( "intf", "interface", NULL, NULL, INTF_TEXT, add_module_cat( "intf", SUBCAT_INTERFACE_GENERAL, NULL, NULL, INTF_TEXT,
INTF_LONGTEXT, VLC_FALSE ); INTF_LONGTEXT, VLC_FALSE );
change_short('I'); change_short('I');
......
...@@ -205,6 +205,7 @@ char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name ) ...@@ -205,6 +205,7 @@ char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name )
(p_config->i_type!=CONFIG_ITEM_DIRECTORY) && (p_config->i_type!=CONFIG_ITEM_DIRECTORY) &&
(p_config->i_type!=CONFIG_ITEM_MODULE_LIST) && (p_config->i_type!=CONFIG_ITEM_MODULE_LIST) &&
(p_config->i_type!=CONFIG_ITEM_MODULE_LIST_CAT) && (p_config->i_type!=CONFIG_ITEM_MODULE_LIST_CAT) &&
(p_config->i_type!=CONFIG_ITEM_MODULE_CAT) &&
(p_config->i_type!=CONFIG_ITEM_MODULE) ) (p_config->i_type!=CONFIG_ITEM_MODULE) )
{ {
msg_Err( p_this, "option %s does not refer to a string", psz_name ); msg_Err( p_this, "option %s does not refer to a string", psz_name );
......
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