diff options
author | dynaflash <[email protected]> | 2007-04-05 16:52:31 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2007-04-05 16:52:31 +0000 |
commit | f6a3ce6f12886c183ef325528011b673e3783c63 (patch) | |
tree | bcb0f0a98b9862983dba2a3cc01cd71f9c07b5e3 /macosx/Controller.mm | |
parent | 943ba99dbe430ae6552753a27d96245fb0b282c5 (diff) |
MacGui: Presets Menu now in Main Menu bar
- New "Update Built-in Presets" function automatically deletes existing built in presets and creates new up to date ones
- New "Delete Built-in Presets" deletes all built in presets
- "New Preset ..." accesses the new preset window
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@480 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/Controller.mm')
-rw-r--r-- | macosx/Controller.mm | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/macosx/Controller.mm b/macosx/Controller.mm index c6232f308..e4314c4e8 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -1580,14 +1580,45 @@ the user is using "Custom" settings by determining the sender*/ { [NSApp stopModal]; } - + /* We use this method to recreate new, updated factory + presets */ - (IBAction)AddFactoryPresets:(id)sender { - /* Here we create each shipped preset */ + /* First, we delete any existing built in presets */ + [self DeleteFactoryPresets: sender]; + /* Then, we re-create new built in presets programmatically */ [UserPresets addObject:[self CreateIpodPreset]]; [UserPresets addObject:[self CreateAppleTVPreset]]; [self AddPreset]; } +- (IBAction)DeleteFactoryPresets:(id)sender +{ + //int status; + NSEnumerator *enumerator = [UserPresets objectEnumerator]; + id tempObject; + + //NSNumber *index; + NSMutableArray *tempArray; + + + tempArray = [NSMutableArray array]; + /* we look here to see if the preset is we move on to the next one */ + while ( tempObject = [enumerator nextObject] ) + { + /* if the preset is "Factory" then we put it in the array of + presets to delete */ + if ([[tempObject objectForKey:@"Type"] intValue] == 0) + { + [tempArray addObject:tempObject]; + } + } + + [UserPresets removeObjectsInArray:tempArray]; + [tableView reloadData]; + [self savePreset]; + +} + - (IBAction)AddUserPreset:(id)sender { /* Here we create a custom user preset */ @@ -2022,12 +2053,14 @@ id theRecord, theValue; theRecord = [UserPresets objectAtIndex:rowIndex]; [theRecord setObject:anObject forKey:[aTableColumn identifier]]; - + /* We Sort the Presets By Factory or Custom */ + NSSortDescriptor * presetTypeDescriptor=[[[NSSortDescriptor alloc] initWithKey:@"Type" + ascending:YES] autorelease]; /* We Sort the Presets Alphabetically by name */ - NSSortDescriptor * lastNameDescriptor=[[[NSSortDescriptor alloc] initWithKey:@"PresetName" + NSSortDescriptor * presetNameDescriptor=[[[NSSortDescriptor alloc] initWithKey:@"PresetName" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease]; - NSArray *sortDescriptors=[NSArray arrayWithObject:lastNameDescriptor]; - NSArray *sortedArray=[UserPresets sortedArrayUsingDescriptors:sortDescriptors]; + NSArray *sortDescriptors=[NSArray arrayWithObjects:presetTypeDescriptor,presetNameDescriptor,nil]; + NSArray *sortedArray=[UserPresets sortedArrayUsingDescriptors:sortDescriptors]; [UserPresets setArray:sortedArray]; /* We Reload the New Table data for presets */ [tableView reloadData]; |