[vlc-commits] [Git][videolan/vlc][master] 3 commits: macosx: Modernise switchSubtitleOption

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Jan 12 10:55:34 UTC 2025



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
f671c099 by Claudio Cambra at 2025-01-12T10:41:28+00:00
macosx: Modernise switchSubtitleOption

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
421d3d92 by Claudio Cambra at 2025-01-12T10:41:28+00:00
macosx: Apply subtitle options via config_Put function instead of now broken var_SetInteger

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
e456bbf0 by Claudio Cambra at 2025-01-12T10:41:28+00:00
macosx: Re-enable configuration of subtitle menus, remove creation of subtitle variables

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


1 changed file:

- modules/gui/macosx/menus/VLCMainMenu.m


Changes:

=====================================
modules/gui/macosx/menus/VLCMainMenu.m
=====================================
@@ -274,21 +274,11 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
 
     [self refreshAudioDeviceList];
 
-#if 0
-#warning fix advanced subtitles styles (see #22095)
     /* setup subtitles menu */
-    // Persist those variables on the playlist
-    playlist_t *p_playlist = pl_Get(getIntf());
-    var_Create(p_playlist, "freetype-color", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
-    var_Create(p_playlist, "freetype-background-opacity", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
-    var_Create(p_playlist, "freetype-background-color", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
-    var_Create(p_playlist, "freetype-outline-thickness", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
-
     [self setupMenu: _subtitle_textcolorMenu withIntList:"freetype-color" andSelector:@selector(switchSubtitleOption:)];
     [_subtitle_bgopacity_sld setIntegerValue: config_GetInt("freetype-background-opacity")];
     [self setupMenu: _subtitle_bgcolorMenu withIntList:"freetype-background-color" andSelector:@selector(switchSubtitleOption:)];
     [self setupMenu: _subtitle_outlinethicknessMenu withIntList:"freetype-outline-thickness" andSelector:@selector(switchSubtitleOption:)];
-#endif
 
     [_voutMenuplay matchKeyEquivalentsOfMenuItem:_play];
     [_voutMenustop matchKeyEquivalentsOfMenuItem:_stop];
@@ -1303,21 +1293,27 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
 
 - (void)switchSubtitleOption:(id)sender
 {
-    NSInteger intValue = [sender tag];
-    NSString *representedObject = [sender representedObject];
+    NSMenuItem * const menuItem = (NSMenuItem *)sender;
+    if (menuItem == nil) {
+        return;
+    }
 
-    var_SetInteger(VLC_OBJECT(getIntf()), [representedObject UTF8String], intValue);
+    const NSInteger intValue = menuItem.tag;
+    NSString * const representedObject = menuItem.representedObject;
 
-    NSMenu *menu = [sender menu];
-    NSUInteger count = (NSUInteger) [menu numberOfItems];
-    for (NSUInteger x = 0; x < count; x++)
-        [[menu itemAtIndex:x] setState:NSOffState];
-    [[menu itemWithTag:intValue] setState:NSOnState];
+    config_PutInt(representedObject.UTF8String, intValue);
+
+    NSMenu * const menu = menuItem.menu;
+    const NSUInteger count = (NSUInteger)menu.numberOfItems;
+    for (NSUInteger x = 0; x < count; x++) {
+        [menu itemAtIndex:x].state = NSOffState;
+    }
+    [menu itemWithTag:intValue].state = NSOnState;
 }
 
 - (IBAction)switchSubtitleBackgroundOpacity:(id)sender
 {
-    var_SetInteger(VLC_OBJECT(getIntf()), "freetype-background-opacity", [sender intValue]);
+    config_PutInt("freetype-background-opacity", [sender intValue]);
 }
 
 - (IBAction)telxTransparent:(id)sender



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/28a8a51e2fc5aca4449c8a41b5655a64c3b8dd66...e456bbf007423ae91fa8d677bef7c6585dcd902a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/28a8a51e2fc5aca4449c8a41b5655a64c3b8dd66...e456bbf007423ae91fa8d677bef7c6585dcd902a
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list