From 8b64ca8414e1dcf56b1d3d3a481090e551499445 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Sat, 24 Aug 2013 02:19:14 +0000 Subject: Continual improvement to OS X code. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86890 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/PluginController.m | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'macosx/PluginController.m') diff --git a/macosx/PluginController.m b/macosx/PluginController.m index 1d74f9cc..27ff6f01 100755 --- a/macosx/PluginController.m +++ b/macosx/PluginController.m @@ -3,7 +3,14 @@ #import "PcsxrController.h" #import "ARCBridge.h" +@interface PluginController () +@property (arcstrong) NSArray *plugins; +@property (arcstrong) NSString *defaultKey; +@end + @implementation PluginController +@synthesize defaultKey; +@synthesize plugins; - (IBAction)doAbout:(id)sender { @@ -14,13 +21,12 @@ - (IBAction)doConfigure:(id)sender { PcsxrPlugin *plugin = [plugins objectAtIndex:[pluginMenu indexOfSelectedItem]]; - [plugin configureAs:pluginType]; } - (IBAction)selectPlugin:(id)sender { - if (sender==pluginMenu) { + if (sender == pluginMenu) { NSInteger index = [pluginMenu indexOfSelectedItem]; if (index != -1) { PcsxrPlugin *plugin = [plugins objectAtIndex:index]; @@ -47,12 +53,11 @@ - (void)setPluginsTo:(NSArray *)list withType:(int)type { NSString *sel; - NSUInteger i; // remember the list pluginType = type; - plugins = RETAINOBJ(list); - defaultKey = RETAINOBJ([PcsxrPlugin defaultKeyForType:pluginType]); + self.plugins = list; + self.defaultKey = [PcsxrPlugin defaultKeyForType:pluginType]; // clear the previous menu items [pluginMenu removeAllItems]; @@ -61,12 +66,13 @@ sel = [[NSUserDefaults standardUserDefaults] stringForKey:defaultKey]; // add the menu entries - for (i = 0; i < [plugins count]; i++) { - [pluginMenu addItemWithTitle:[[plugins objectAtIndex:i] description]]; - + for (PcsxrPlugin *plug in plugins) { + NSString *description = [plug description]; + [pluginMenu addItemWithTitle:description]; + // make sure the currently selected is set as such - if ([sel isEqualToString:[[plugins objectAtIndex:i] path]]) { - [pluginMenu selectItemAtIndex:i]; + if ([sel isEqualToString:[plug path]]) { + [pluginMenu selectItemWithTitle:description]; } } @@ -76,8 +82,8 @@ #if !__has_feature(objc_arc) - (void)dealloc { - [plugins release]; - [defaultKey release]; + self.plugins = nil; + self.defaultKey = nil; [super dealloc]; } -- cgit v1.2.3