vlc | branch: master | David Fuhrmann <[email protected]> | Sat Dec 9 20:39:28 2017 +0100| [7bf09f9bcfcc850735ca59289d88497c5a2de624] | committer: David Fuhrmann
macosx: profiles: Fix rules when new "CustomXXX" profiles are created * Fix bug where default video profile was at an older version, resulting in a new profile always created after opening the vout effects * On termination, only create a new profile if the apply button is on, the user is at default profile and actually changed something. This profile will be also marked as to be selected at next startup (which is the meaning of that check box) refs #19260 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7bf09f9bcfcc850735ca59289d88497c5a2de624 --- modules/gui/macosx/VLCAudioEffectsWindowController.m | 5 +++++ modules/gui/macosx/VLCVideoEffectsWindowController.m | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/gui/macosx/VLCAudioEffectsWindowController.m b/modules/gui/macosx/VLCAudioEffectsWindowController.m index 89f7744453..b0d5c18cc8 100644 --- a/modules/gui/macosx/VLCAudioEffectsWindowController.m +++ b/modules/gui/macosx/VLCAudioEffectsWindowController.m @@ -386,6 +386,9 @@ if (i_old_profile_index) return [self saveCurrentProfile]; + if (_applyProfileCheckbox.state == NSOffState) + return; + playlist_t *p_playlist = pl_Get(getIntf()); NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *newPresetString = [NSString stringWithCString:var_InheritString(p_playlist, "equalizer-bands") encoding:NSASCIIStringEncoding]; @@ -454,6 +457,8 @@ [workArray addObject:newProfileName]; [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfileNames"]; + [defaults setInteger:([workArray count] - 1) forKey:@"AudioEffectSelectedProfile"]; + [defaults synchronize]; } diff --git a/modules/gui/macosx/VLCVideoEffectsWindowController.m b/modules/gui/macosx/VLCVideoEffectsWindowController.m index d9d8b1a04f..303b288c72 100644 --- a/modules/gui/macosx/VLCVideoEffectsWindowController.m +++ b/modules/gui/macosx/VLCVideoEffectsWindowController.m @@ -47,11 +47,18 @@ + (void)initialize { - NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObject:@";;;0;1.000000;1.000000;1.000000;1.000000;0.050000;16;2.000000;OTA=;4;4;16711680;20;15;120;Z3JhZGllbnQ=;1;0;16711680;6;80;VkxD;-1;;-1;255;2;3;3"], @"VideoEffectProfiles", - [NSArray arrayWithObject:_NS("Default")], @"VideoEffectProfileNames", nil]; + NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: + [NSArray arrayWithObject:[VLCVideoEffectsWindowController defaultProfileString]], @"VideoEffectProfiles", + [NSArray arrayWithObject:_NS("Default")], @"VideoEffectProfileNames", + nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; } ++ (NSString *)defaultProfileString +{ + return @";;;0;1.000000;1.000000;1.000000;1.000000;0.050000;16;2.000000;OTA=;4;4;16711680;20;15;120;Z3JhZGllbnQ=;1;0;16711680;6;80;VkxD;-1;;-1;255;2;3;3;0;-180.000000"; +} + - (id)init { self = [super initWithWindowNibName:@"VideoEffects"]; @@ -680,6 +687,11 @@ if (i_old_profile_index) return [self saveCurrentProfile]; + // A new "Custom profile" is only created if the user wants to load this as new profile at startup ... + if (_applyProfileCheckbox.state == NSOffState) + return; + + // ... and some settings are changed NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *newProfile = [self generateProfileString]; if ([newProfile compare:[[defaults objectForKey:@"VideoEffectProfiles"] firstObject]] == NSOrderedSame) @@ -701,6 +713,8 @@ [workArray addObject:newProfileName]; [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"VideoEffectProfileNames"]; + [defaults setInteger:([workArray count] - 1) forKey:@"VideoEffectSelectedProfile"]; + [defaults synchronize]; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
