Browse Source

macosx: save default video profile as custom when quiting

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
pull/58/head
Victorien Le Couviour--Tuffet 9 years ago
committed by Jean-Baptiste Kempf
parent
commit
488f9ea4c0
  1. 2
      modules/gui/macosx/VLCMain.m
  2. 2
      modules/gui/macosx/VLCVideoEffectsWindowController.h
  3. 29
      modules/gui/macosx/VLCVideoEffectsWindowController.m

2
modules/gui/macosx/VLCMain.m

@ -335,7 +335,7 @@ static VLCMain *sharedInstance = nil;
playlist_t * p_playlist = pl_Get(p_intf);
/* save current video and audio profiles */
[[self videoEffectsPanel] saveCurrentProfile];
[[self videoEffectsPanel] saveCurrentProfileAtTerminate];
[[self audioEffectsPanel] saveCurrentProfile];
/* Save some interface state in configuration, at module quit */

2
modules/gui/macosx/VLCVideoEffectsWindowController.h

@ -169,7 +169,7 @@
/* generic */
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
- (void)saveCurrentProfile;
- (void)saveCurrentProfileAtTerminate;
- (void)toggleWindow:(id)sender;
- (IBAction)profileSelectorAction:(id)sender;

29
modules/gui/macosx/VLCVideoEffectsWindowController.m

@ -675,6 +675,35 @@
[defaults synchronize];
}
- (void)saveCurrentProfileAtTerminate
{
if (i_old_profile_index)
return [self saveCurrentProfile];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *newProfile = [self generateProfileString];
if ([newProfile compare:[[defaults objectForKey:@"VideoEffectProfiles"] firstObject]] == NSOrderedSame)
return;
NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"VideoEffectProfiles"]];
[workArray addObject:newProfile];
[defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"VideoEffectProfiles"];
NSArray<NSString *> *profileNames = [defaults objectForKey:@"VideoEffectProfileNames"];
NSString *newProfileName;
unsigned int num_custom = 0;
do
newProfileName = [@"Custom" stringByAppendingString:[NSString stringWithFormat:@"%03i",num_custom++]];
while ([profileNames containsObject:newProfileName]);
workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"VideoEffectProfileNames"]];
[workArray addObject:newProfileName];
[defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"VideoEffectProfileNames"];
[defaults synchronize];
}
- (IBAction)toggleWindow:(id)sender
{
if ([self.window isKeyWindow])

Loading…
Cancel
Save