[vlc-commits] macosx: Store subtitle settings from main menu in playlist scope

David Fuhrmann git at videolan.org
Sun Jun 18 22:58:08 CEST 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Fri Jun 16 15:40:26 2017 +0200| [51a9afa6e787a9476b6c7e1e4308b71101bf1f93] | committer: David Fuhrmann

macosx: Store subtitle settings from main menu in playlist scope

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

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

 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 30d831b5e5..c6dc30fbfb 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -105,7 +105,6 @@
 #endif
 
     NSString* keyString;
-    playlist_t *p_playlist;
     vlc_value_t val;
     VLCStringUtility *stringUtility = [VLCStringUtility sharedInstance];
     char *key;
@@ -262,6 +261,13 @@
     [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 @@
     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 @@
 
 - (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



More information about the vlc-commits mailing list