[vlc-devel] [Patch] Initialize the drop down lists - inside settings on creation, instead of let the user push buttons...

Dennis Lou dlou99 at yahoo.com
Thu Feb 28 03:00:33 CET 2008


I svn updated and recompiled, but I'm not sure how your patches have changed the behavior so far.  Can you give a v4l example?

-Dennis

----- Original Message ----
From: Andre Weber <WeberAndre at gmx.de>
To: Mailing list for VLC media player developers <vlc-devel at videolan.org>
Sent: Wednesday, February 27, 2008 1:31:56 PM
Subject: [vlc-devel] [Patch] Initialize the drop down lists - inside settings on creation, instead of let the user push buttons...

Hello,

today I talked to xtophe, j-b and some more... about an option to initialize the selectionlists
of dropdownfields durring settings dialog creation of the controls.

This "will / should / may" work for options defined with the macros

* change_integer_list
* change_string_list
* change_float_list (seems to be never used?)

these macro's have a third parameter "list_update_func" which isn't currently used ...
some modules pass 0 to it, and some like DirectShow pass there the same function pointer to it
- which they use for the refresh button -- what is closer to this? to store this function pointer
inside "module_config_t" - to call this method durring creation of the input controls of the setup gui?
to startup with fully functional and initialized drop down lists?
(I think the user - will appreciate this?)

so I added "vlc_callback_t pf_update_list" to this structure, as a possible callback for initializing/updating
the value lists of such a choice variable. Be aware - that this change will force a full rebuild of the sourcetree,
and also brake one time the caching...)
But its better to do so --- instead of a bad hack and missuse of a existing parameter / value inside this
structure - which may break - more than the cache - and gives me / us / you - more trouble to find
and fix.

To achieve this I modified also the function "vlc_config_set" if it is called with the ID=VLC_CONFIG_LIST
the last parameter in the open parameter list - is now the function pointer - I found no code location
which calls this method directly so I see no danger in changing this. this Method with this signature
is only used in the Macros named above.

My Patches in this mail contain all required changes ... to settings (QT), WxWidgets may be possible
to also use that option, but this is no must ... the refresh buttons are still there and will work.

A little bit ... may be more to look after is my change on the function "setfillVLCConfigCombo" inside
prefrerences_widgets.cpp - which is used in some initialization for the simple setting gui? so far I understand
- I added there  the same initialization code for the list - but I'am not sure if it could work - so please
check this - before finally applying the patch in the full version...

With best regards

André
----
atmo


-----Inline Attachment Follows-----

Index: entry.c
===================================================================
--- entry.c    (Revision 25377)
+++ entry.c    (Arbeitskopie)
@@ -368,6 +368,7 @@
             }
 
             item->i_list = len;
+            item->pf_update_list = va_arg (ap, vlc_callback_t);
             ret = 0;
             break;
         }



-----Inline Attachment Follows-----

Index: vlc_configuration.h
===================================================================
--- vlc_configuration.h    (Revision 25377)
+++ vlc_configuration.h    (Arbeitskopie)
@@ -169,6 +169,7 @@
     int         *pi_list;                              /* Idem for integers */
     char       **ppsz_list_text;          /* Friendly names for list values */
     int          i_list;                               /* Options list size */
+    vlc_callback_t pf_update_list;
 
     /* Actions list */
     vlc_callback_t *ppf_action;    /* List of possible actions for a config */
@@ -435,19 +436,22 @@
     vlc_config_set (p_config, VLC_CONFIG_LIST, \
                     (size_t)(sizeof (list) / sizeof (char *)), \
                     (const char *const *)(list), \
-                    (const char *const *)(list_text))
+                    (const char *const *)(list_text), \
+                    list_update_func)
 
 #define change_integer_list( list, list_text, list_update_func ) \
     vlc_config_set (p_config, VLC_CONFIG_LIST, \
                     (size_t)(sizeof (list) / sizeof (int)), \
                     (const int *)(list), \
-                    (const char *const *)(list_text))
+                    (const char *const *)(list_text), \
+                    list_update_func)
 
 #define change_float_list( list, list_text, list_update_func ) \
     vlc_config_set (p_config, VLC_CONFIG_LIST, \
                     (size_t)(sizeof (list) / sizeof (float)), \
                     (const float *)(list), \
-                    (const char *const *)(list_text))
+                    (const char *const *)(list_text), \
+                    list_update_func)
 
 #define change_integer_range( minv, maxv ) \
     vlc_config_set (p_config, VLC_CONFIG_RANGE, (int)(minv), (int)(maxv))



-----Inline Attachment Follows-----

Index: preferences_widgets.cpp
===================================================================
--- preferences_widgets.cpp    (Revision 25382)
+++ preferences_widgets.cpp    (Arbeitskopie)
@@ -374,6 +374,20 @@
     combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
 
     module_config_t *p_module_config = config_FindConfig( p_this, getName() );
+    if(p_item->pf_update_list) 
+    {
+       vlc_value_t val;
+       val.psz_string = strdup(p_item->value.psz);
+       
+       p_item->pf_update_list(p_this, getName(), val, val, NULL);
+
+       // assume in a×y case that dirty was set to VLC_TRUE
+       // because lazy programmes will use the same callback for
+       // this, like the one behind the refresh push button?
+       p_item->b_dirty = VLC_FALSE;
+
+       if(val.psz_string) free(val.psz_string);
+    }
 
     finish( p_module_config, bycat );
     if( !l )
@@ -473,6 +487,17 @@
                       config_FindConfig( VLC_OBJECT(p_intf), configname );
     if( p_config )
     {
+       if(p_config->pf_update_list) 
+        {
+            vlc_value_t val;
+            val.i_int = p_config->value.i;
+            p_config->pf_update_list(VLC_OBJECT(p_intf), configname, val, val, NULL);
+            // assume in any case that dirty was set to VLC_TRUE
+            // because lazy programmes will use the same callback for
+            // this, like the one behind the refresh push button?
+            p_config->b_dirty = VLC_FALSE;
+        }
+
         for ( int i_index = 0; i_index < p_config->i_list; i_index++ )
         {
             combo->addItem( qfu( p_config->ppsz_list_text[i_index] ),
@@ -838,7 +863,20 @@
     combo->setMinimumWidth( MINWIDTH_BOX );
 
     module_config_t *p_module_config = config_FindConfig( p_this, getName() );
+    if(p_module_config->pf_update_list) 
+    {
+       vlc_value_t val;
+       val.i_int = p_module_config->value.i;
+       
+       p_module_config->pf_update_list(p_this, getName(), val, val, NULL);
+
+       // assume in any case that dirty was set to VLC_TRUE
+       // because lazy programmes will use the same callback for
+       // this, like the one behind the refresh push button?
+       p_module_config->b_dirty = VLC_FALSE;
+    }
 
+
     finish( p_module_config, bycat );
     if( !l )
     {



-----Inline Attachment Follows-----

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
http://mailman.videolan.org/listinfo/vlc-devel






      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the vlc-devel mailing list