[vlc-commits] macosx: advanced prefs: impelent controls for CONFIG_ITEM_MODULE_LIST

David Fuhrmann git at videolan.org
Sat Jan 18 22:35:45 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat Jan 18 21:00:19 2014 +0100| [b77c3fdf0ecfc4b6a069a61a73f168470d091cfa] | committer: David Fuhrmann

macosx: advanced prefs: impelent controls for CONFIG_ITEM_MODULE_LIST

fixes #7493

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b77c3fdf0ecfc4b6a069a61a73f168470d091cfa
---

 modules/gui/macosx/prefs_widgets.m |  107 +++++++++++++++++++++---------------
 1 file changed, 63 insertions(+), 44 deletions(-)

diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
index 33bae45..af12405 100644
--- a/modules/gui/macosx/prefs_widgets.m
+++ b/modules/gui/macosx/prefs_widgets.m
@@ -1958,9 +1958,7 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain];     \
 - (id) initWithItem: (module_config_t *)_p_item
            withView: (NSView *)o_parent_view
 {
-    if (_p_item->i_type == CONFIG_ITEM_MODULE_LIST)
-        //TODO....
-        return nil;
+    BOOL b_by_cat = _p_item->i_type == CONFIG_ITEM_MODULE_LIST_CAT;
 
     //Fill our array to know how may items we have...
     module_t *p_parser, **p_list;
@@ -1979,56 +1977,77 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain];     \
         if (module_is_main(p_parser))
             continue;
 
-        unsigned int confsize;
-        module_config_t *p_configlist = module_config_get(p_parser, &confsize);
+        if (b_by_cat) {
+            unsigned int confsize;
+            module_config_t *p_configlist = module_config_get(p_parser, &confsize);
 
-        for (i = 0; i < confsize; i++) {
-            unsigned int unused;
-            module_config_t *p_config = &p_configlist[i];
-            NSString *o_modulelongname, *o_modulename;
-            NSNumber *o_moduleenabled = nil;
+            for (i = 0; i < confsize; i++) {
+                unsigned int unused;
+                module_config_t *p_config = &p_configlist[i];
+                NSString *o_modulelongname, *o_modulename;
+                NSNumber *o_moduleenabled = nil;
 
-            /* Hack: required subcategory is stored in i_min */
-            if (p_config->i_type == CONFIG_SUBCATEGORY &&
-               p_config->value.i == _p_item->min.i) {
-                o_modulelongname = [NSString stringWithUTF8String:module_get_name(p_parser, TRUE)];
-                o_modulename = [NSString stringWithUTF8String:module_get_object(p_parser)];
-
-                if (_p_item->value.psz &&
-                   strstr(_p_item->value.psz, module_get_object(p_parser)))
-                    o_moduleenabled = [NSNumber numberWithBool:YES];
-                else
-                    o_moduleenabled = [NSNumber numberWithBool:NO];
-
-                [o_modulearray addObject:[NSMutableArray
-                                          arrayWithObjects: o_modulename, o_modulelongname,
-                                          o_moduleenabled, nil]];
-            }
+                /* Hack: required subcategory is stored in i_min */
+                if (p_config->i_type == CONFIG_SUBCATEGORY &&
+                    p_config->value.i == _p_item->min.i) {
 
-            /* Parental Advisory HACK:
-             * Selecting HTTP, RC and Telnet interfaces is difficult now
-             * since they are just the lua interface module */
-            if (p_config->i_type == CONFIG_SUBCATEGORY &&
-               !strcmp(module_get_object(p_parser), "lua") &&
-               !strcmp(_p_item->psz_name, "extraintf") &&
-               p_config->value.i == _p_item->min.i) {
+                    o_modulelongname = [NSString stringWithUTF8String:module_get_name(p_parser, TRUE)];
+                    o_modulename = [NSString stringWithUTF8String:module_get_object(p_parser)];
 
-#define addLuaIntf(shortname, longname) \
-                if (_p_item->value.psz && strstr(_p_item->value.psz, shortname))\
-                    o_moduleenabled = [NSNumber numberWithBool:YES];\
-                else\
-                    o_moduleenabled = [NSNumber numberWithBool:NO];\
-                [o_modulearray addObject:[NSMutableArray arrayWithObjects: @shortname, _NS(longname), o_moduleenabled, nil]]
+                    if (_p_item->value.psz &&
+                        strstr(_p_item->value.psz, module_get_object(p_parser)))
+                        o_moduleenabled = [NSNumber numberWithBool:YES];
+                    else
+                        o_moduleenabled = [NSNumber numberWithBool:NO];
 
-                addLuaIntf("http", "Web");
-                addLuaIntf("telnet", "Telnet");
-                addLuaIntf("cli", "Console");
+                    [o_modulearray addObject:[NSMutableArray
+                                              arrayWithObjects: o_modulename, o_modulelongname,
+                                              o_moduleenabled, nil]];
+                }
+
+                /* Parental Advisory HACK:
+                 * Selecting HTTP, RC and Telnet interfaces is difficult now
+                 * since they are just the lua interface module */
+                if (p_config->i_type == CONFIG_SUBCATEGORY &&
+                    !strcmp(module_get_object(p_parser), "lua") &&
+                    !strcmp(_p_item->psz_name, "extraintf") &&
+                    p_config->value.i == _p_item->min.i) {
 
+#define addLuaIntf(shortname, longname) \
+if (_p_item->value.psz && strstr(_p_item->value.psz, shortname))\
+    o_moduleenabled = [NSNumber numberWithBool:YES];\
+else\
+    o_moduleenabled = [NSNumber numberWithBool:NO];\
+    [o_modulearray addObject:[NSMutableArray arrayWithObjects: @shortname, _NS(longname), o_moduleenabled, nil]]
+
+                    addLuaIntf("http", "Web");
+                    addLuaIntf("telnet", "Telnet");
+                    addLuaIntf("cli", "Console");
 #undef addLuaIntf
+                }
+
             }
+            module_config_free(p_configlist);
+
+
+        } else if (module_provides(p_parser, _p_item->psz_type)) {
+
+            NSString *o_modulelongname = toNSStr(module_get_name(p_parser, TRUE));
+            NSString *o_modulename = toNSStr(module_get_object(p_parser));
+
+            NSNumber *o_moduleenabled = nil;
+            if (_p_item->value.psz &&
+                strstr(_p_item->value.psz, module_get_object(p_parser)))
+                o_moduleenabled = [NSNumber numberWithBool:YES];
+            else
+                o_moduleenabled = [NSNumber numberWithBool:NO];
+
+            [o_modulearray addObject:[NSMutableArray
+                                      arrayWithObjects: o_modulename, o_modulelongname,
+                                      o_moduleenabled, nil]];
         }
-        module_config_free(p_configlist);
-    }
+
+    } /* FOR i_module_index */
     module_list_free(p_list);
 
     mainFrame.size.height = 30 + 20 * [o_modulearray count];



More information about the vlc-commits mailing list