[vlc-devel] [PATCH 5/5] macosx: Store subtitle settings from main menu in playlist scope

david.fuhrmann at gmail.com david.fuhrmann at gmail.com
Fri Jun 16 15:46:32 CEST 2017


From: David Fuhrmann <dfuhrmann at videolan.org>

With main menu, the user shall only be able to modify settings
for the currently running VLC instance. All changes shall be
applied equally for all videos, therefore the variables are
created on playlist scope.

This avoid saving those changed to config, but still have them
valid for the overall VLC lifetime.

refs #16185
---
 modules/gui/macosx/VLCMainMenu.m | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index 30d831b..c6dc30f 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -105,7 +105,6 @@ - (void)awakeFromNib
 #endif
 
     NSString* keyString;
-    playlist_t *p_playlist;
     vlc_value_t val;
     VLCStringUtility *stringUtility = [VLCStringUtility sharedInstance];
     char *key;
@@ -262,6 +261,13 @@ - (void)awakeFromNib
     [self refreshAudioDeviceList];
 
     /* 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 setIntValue: config_GetInt(VLC_OBJECT(p_intf), "freetype-background-opacity")];
     [self setupMenu: _subtitle_bgcolorMenu withIntList:"freetype-background-color" andSelector:@selector(switchSubtitleOption:)];
@@ -1045,8 +1051,7 @@ - (void)switchSubtitleOption:(id)sender
     int intValue = [sender tag];
     NSString *representedObject = [sender representedObject];
 
-#warning this won't work anymore and is heritably bad
-    config_PutInt(getIntf(), [representedObject UTF8String], intValue);
+    var_SetInteger(pl_Get(getIntf()), [representedObject UTF8String], intValue);
 
     NSMenu *menu = [sender menu];
     NSUInteger count = (NSUInteger) [menu numberOfItems];
@@ -1057,7 +1062,7 @@ - (void)switchSubtitleOption:(id)sender
 
 - (IBAction)switchSubtitleBackgroundOpacity:(id)sender
 {
-    config_PutInt(getIntf(), "freetype-background-opacity", [sender intValue]);
+    var_SetInteger(pl_Get(getIntf()), "freetype-background-opacity", [sender intValue]);
 }
 
 - (IBAction)telxTransparent:(id)sender
-- 
2.7.4 (Apple Git-66)



More information about the vlc-devel mailing list