From 4b4f074b6659f33b4f9e1c9784861409d8debd97 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Tue, 10 Sep 2013 18:43:18 +0000 Subject: Convert Objective-C code to modern syntax, mainly for the NSDictionaries. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@87115 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/plugins/DFInput/macsrc/PadController.m | 41 +++++++++++---------------- 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'macosx/plugins/DFInput/macsrc/PadController.m') diff --git a/macosx/plugins/DFInput/macsrc/PadController.m b/macosx/plugins/DFInput/macsrc/PadController.m index f667717a..06b1f05a 100755 --- a/macosx/plugins/DFInput/macsrc/PadController.m +++ b/macosx/plugins/DFInput/macsrc/PadController.m @@ -137,12 +137,9 @@ void LoadPADConfig() { SetDefaultConfig(); [[NSUserDefaults standardUserDefaults] registerDefaults: - [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObjectsAndKeys: - DefaultPadArray(0), kDFPad1, - DefaultPadArray(1), kDFPad2, - @YES, kDFThreading, - nil] - forKey:PrefsKey]]; + @{PrefsKey: @{kDFPad1: DefaultPadArray(0), + kDFPad2: DefaultPadArray(1), + kDFThreading: @YES}}]; //Load the old preferences if present. NSFileManager *fm = [NSFileManager defaultManager]; @@ -305,9 +302,9 @@ void LoadPADConfig() [fm removeItemAtPath:oldPrefPath error:NULL]; } else { NSDictionary *dfPrefs = [[NSUserDefaults standardUserDefaults] dictionaryForKey:PrefsKey]; - g.cfg.Threaded = [[dfPrefs objectForKey:kDFThreading] boolValue]; - LoadPadArray(0, [dfPrefs objectForKey:kDFPad1]); - LoadPadArray(1, [dfPrefs objectForKey:kDFPad2]); + g.cfg.Threaded = [dfPrefs[kDFThreading] boolValue]; + LoadPadArray(0, dfPrefs[kDFPad1]); + LoadPadArray(1, dfPrefs[kDFPad2]); } } @@ -316,18 +313,16 @@ void SavePADConfig() NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSMutableDictionary *pad1Dict = nil, *pad2Dict = nil; NSDictionary *prefDict = [defaults dictionaryForKey:PrefsKey]; - pad1Dict = [[NSMutableDictionary alloc] initWithDictionary:[prefDict objectForKey:kDFPad1]]; - pad2Dict = [[NSMutableDictionary alloc] initWithDictionary:[prefDict objectForKey:kDFPad2]]; + pad1Dict = [[NSMutableDictionary alloc] initWithDictionary:prefDict[kDFPad1]]; + pad2Dict = [[NSMutableDictionary alloc] initWithDictionary:prefDict[kDFPad2]]; prefDict = nil; [pad1Dict addEntriesFromDictionary:SavePadArray(0)]; [pad2Dict addEntriesFromDictionary:SavePadArray(1)]; - [defaults setObject:[NSDictionary dictionaryWithObjectsAndKeys: - g.cfg.Threaded ? @YES : @NO, kDFThreading, - pad1Dict, kDFPad1, - pad2Dict, kDFPad2, - nil] forKey:PrefsKey]; + [defaults setObject:@{kDFThreading: g.cfg.Threaded ? @YES : @NO, + kDFPad1: pad1Dict, + kDFPad2: pad2Dict} forKey:PrefsKey]; [defaults synchronize]; } @@ -352,14 +347,12 @@ void DoAbout() [icon setSize:size]; NSDictionary *infoPaneDict = - [[NSDictionary alloc] initWithObjectsAndKeys: - [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", - icon, @"ApplicationIcon", - [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", - [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", - [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", - credits, @"Credits", - nil]; + @{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"], + @"ApplicationIcon": icon, + @"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], + @"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + @"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], + @"Credits": credits}; dispatch_async(dispatch_get_main_queue(), ^{ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict]; }); -- cgit v1.2.3