[vlc-commits] macosx: show the localized, intended to be user-facing encoding names instead of the variable values to the user .

Felix Paul Kühne git at videolan.org
Tue Oct 9 18:50:43 CEST 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Oct  9 18:37:16 2012 +0200| [66162d9719168b168c9cc73de3204da986711ae1] | committer: Felix Paul Kühne

macosx: show the localized, intended to be user-facing encoding names instead of the variable values to the user.

This way, s/he is never presented an empty menu item for the default value.

This also closes #7539 by preventing stringWithUTF8String calls with empty strings.
(cherry picked from commit d7246593be4f2484d13adaaf5bd8cbd4c8e5b812)

Conflicts:
	modules/gui/macosx/open.m

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

 modules/gui/macosx/open.m |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index b9073fb..0c3cc28 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -323,14 +323,15 @@ static VLCOpen *_o_sharedMainInstance = nil;
 
     if( p_item )
     {
-        for( i_index = 0; p_item->ppsz_list && p_item->ppsz_list[i_index];
-             i_index++ )
-        {
-            [o_file_sub_encoding_pop addItemWithTitle:
-                [NSString stringWithUTF8String: p_item->ppsz_list[i_index]]];
+        for (int i = 0; i < p_item->list_count; i++) {
+            [o_file_sub_encoding_pop addItemWithTitle: _NS(p_item->list_text[i])];
+            [[o_file_sub_encoding_pop lastItem] setRepresentedObject:[NSString stringWithFormat:@"%s", p_item->list.psz[i]]];
+            if (p_item->value.psz && !strcmp(p_item->value.psz, p_item->list.psz[i]))
+                [o_file_sub_encoding_pop selectItem: [o_file_sub_encoding_pop lastItem]];
         }
-        [o_file_sub_encoding_pop selectItemWithTitle:
-                [NSString stringWithUTF8String: p_item->value.psz]];
+
+        if ([o_file_sub_encoding_pop indexOfSelectedItem] < 0)
+            [o_file_sub_encoding_pop selectItemAtIndex:0];
     }
 
     p_item = config_FindConfig( VLC_OBJECT(p_intf), "subsdec-align" );
@@ -389,8 +390,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
                 [o_options addObject: [NSString stringWithFormat: @"sub-fps=%f", [o_file_sub_fps floatValue]]];
             }
             [o_options addObject: [NSString stringWithFormat:
-                    @"subsdec-encoding=%@",
-                    [o_file_sub_encoding_pop titleOfSelectedItem]]];
+                    @"subsdec-encoding=%@", [[o_file_sub_encoding_pop selectedItem] representedObject]]];
             [o_options addObject: [NSString stringWithFormat:
                     @"subsdec-align=%li",
                     [o_file_sub_align_pop indexOfSelectedItem]]];



More information about the vlc-commits mailing list