Commit 139ae598 authored by David Fuhrmann's avatar 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

(cherry picked from commit 7bf09f9b)
Signed-off-by: default avatarDavid Fuhrmann <dfuhrmann@videolan.org>
parent fe171633
......@@ -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];
}
......
......@@ -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];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment