diff options
author | sr55 <[email protected]> | 2013-06-01 21:39:49 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-06-01 21:39:49 +0000 |
commit | 1d0553ef556d8979e0c4897cd77a5d6ceaec8221 (patch) | |
tree | 404ccc522ad9ddfb045fd51d2b5fe43deefe1749 | |
parent | 0c65f4f74c61edb71ef7fbb03be0e0b3c932d810 (diff) |
MacGUI: Patch -Replace some deprecated API Calls https://reviews.handbrake.fr/r/504/
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5543 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/Controller.m | 76 | ||||
-rw-r--r-- | macosx/HBPreferencesController.m | 8 |
2 files changed, 44 insertions, 40 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m index e92f7393a..34891e878 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1757,10 +1757,11 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* we open up the browse sources sheet here and call for browseSourcesDone after the sheet is closed * to evaluate whether we want to specify a title, we pass the sender in the contextInfo variable */ - [panel beginSheetForDirectory: sourceDirectory file: nil types: nil - modalForWindow: fWindow modalDelegate: self - didEndSelector: @selector( browseSourcesDone:returnCode:contextInfo: ) - contextInfo: sender]; + [panel setDirectoryURL:[NSURL fileURLWithPath:sourceDirectory]]; + [panel beginSheetModalForWindow:fWindow completionHandler: + ^(NSInteger result) { + [self browseSourcesDone:panel returnCode:(int)result contextInfo:sender]; + }]; } - (void) browseSourcesDone: (NSOpenPanel *) sheet @@ -2226,10 +2227,12 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* Open a panel to let the user choose and update the text field */ NSSavePanel * panel = [NSSavePanel savePanel]; /* We get the current file name and path from the destination field here */ - [panel beginSheetForDirectory: [[fDstFile2Field stringValue] stringByDeletingLastPathComponent] file: [[fDstFile2Field stringValue] lastPathComponent] - modalForWindow: fWindow modalDelegate: self - didEndSelector: @selector( browseFileDone:returnCode:contextInfo: ) - contextInfo: NULL]; + NSString* destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent]; + [panel setDirectoryURL:[NSURL fileURLWithPath:destinationDirectory]]; + [panel setNameFieldStringValue:[[fDstFile2Field stringValue] lastPathComponent]]; + [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { + [self browseFileDone:panel returnCode:(int)result contextInfo:sender]; + }]; } - (void) browseFileDone: (NSSavePanel *) sheet @@ -5972,13 +5975,14 @@ the user is using "Custom" settings by determining the sender*/ } /* we open up the browse srt sheet here and call for browseImportSrtFileDone after the sheet is closed */ NSArray *fileTypes = [NSArray arrayWithObjects:@"plist", @"srt", nil]; - [panel beginSheetForDirectory: sourceDirectory file: nil types: fileTypes - modalForWindow: fWindow modalDelegate: self - didEndSelector: @selector( browseImportSrtFileDone:returnCode:contextInfo: ) - contextInfo: sender]; + [panel setDirectoryURL:[NSURL fileURLWithPath:sourceDirectory]]; + [panel setAllowedFileTypes:fileTypes]; + [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { + [self browseImportSrtFileDone:panel returnCode:(int)result contextInfo:sender]; + }]; } -- (void) browseImportSrtFileDone: (NSSavePanel *) sheet +- (void) browseImportSrtFileDone: (NSOpenPanel *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo { if( returnCode == NSOKButton ) @@ -7318,11 +7322,11 @@ return YES; NSSavePanel * panel = [NSSavePanel savePanel]; /* We get the current file name and path from the destination field here */ NSString *defaultExportDirectory = [NSString stringWithFormat: @"%@/Desktop/", NSHomeDirectory()]; - - [panel beginSheetForDirectory: defaultExportDirectory file: @"HB_Export.plist" - modalForWindow: fWindow modalDelegate: self - didEndSelector: @selector( browseExportPresetFileDone:returnCode:contextInfo: ) - contextInfo: NULL]; + [panel setDirectoryURL:[NSURL fileURLWithPath:defaultExportDirectory]]; + [panel setNameFieldStringValue:@"HB_Export.plist"]; + [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { + [self browseExportPresetFileDone:panel returnCode: (int)result contextInfo:sender]; + }]; } - (void) browseExportPresetFileDone: (NSSavePanel *) sheet @@ -7381,10 +7385,11 @@ return YES; */ /* set this for allowed file types, not sure if we should allow xml or not */ NSArray *fileTypes = [NSArray arrayWithObjects:@"plist", @"xml", nil]; - [panel beginSheetForDirectory: sourceDirectory file: nil types: fileTypes - modalForWindow: fWindow modalDelegate: self - didEndSelector: @selector( browseImportPresetDone:returnCode:contextInfo: ) - contextInfo: sender]; + [panel setDirectoryURL:[NSURL fileURLWithPath:sourceDirectory]]; + [panel setAllowedFileTypes:fileTypes]; + [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { + [self browseImportPresetDone:panel returnCode:(int)result contextInfo:sender]; + }]; } - (void) browseImportPresetDone: (NSSavePanel *) sheet @@ -7719,13 +7724,13 @@ return YES; /* Open a panel to let the user choose the file */ NSOpenPanel * panel = [NSOpenPanel openPanel]; /* We get the current file name and path from the destination field here */ - [panel beginSheetForDirectory: [NSString stringWithFormat:@"%@/", - [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"]] - file: NULL - types: [NSArray arrayWithObjects:@"csv",nil] - modalForWindow: fWindow modalDelegate: self - didEndSelector: @selector( browseForChapterFileDone:returnCode:contextInfo: ) - contextInfo: NULL]; + NSString* sourceDirectory = [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"]; + NSArray* fileTypes = [NSArray arrayWithObjects:@"csv",nil]; + [panel setDirectoryURL:[NSURL fileURLWithPath:sourceDirectory]]; + [panel setAllowedFileTypes:fileTypes]; + [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { + [self browseForChapterFileDone:panel returnCode:(int)result contextInfo:sender]; + }]; } - (void) browseForChapterFileDone: (NSOpenPanel *) sheet @@ -7800,13 +7805,12 @@ return YES; NSSavePanel *panel = [NSSavePanel savePanel]; /* Open a panel to let the user save to a file */ [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"csv",nil]]; - [panel beginSheetForDirectory: [[fDstFile2Field stringValue] stringByDeletingLastPathComponent] - file: [[[[fDstFile2Field stringValue] lastPathComponent] stringByDeletingPathExtension] - stringByAppendingString:@"-chapters.csv"] - modalForWindow: fWindow - modalDelegate: self - didEndSelector: @selector( browseForChapterFileSaveDone:returnCode:contextInfo: ) - contextInfo: NULL]; + NSString* destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent]; + [panel setDirectoryURL:[NSURL fileURLWithPath:destinationDirectory]]; + [panel setNameFieldStringValue:[[[fDstFile2Field stringValue] lastPathComponent] stringByDeletingPathExtension]]; + [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { + [self browseForChapterFileSaveDone:panel returnCode:(int)result contextInfo:sender]; + }]; } - (void) browseForChapterFileSaveDone: (NSSavePanel *) sheet diff --git a/macosx/HBPreferencesController.m b/macosx/HBPreferencesController.m index 4e5baccd1..d7d52d2c2 100644 --- a/macosx/HBPreferencesController.m +++ b/macosx/HBPreferencesController.m @@ -170,10 +170,10 @@ { sendToAppDirectory = @"/Applications"; } - [panel beginSheetForDirectory: sendToAppDirectory file: nil types: nil - modalForWindow: [self window] modalDelegate: self - didEndSelector: @selector( browseSendToAppDone:returnCode:contextInfo: ) - contextInfo: sender]; + [panel setDirectoryURL:[NSURL fileURLWithPath:sendToAppDirectory]]; + [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { + [self browseSendToAppDone:panel returnCode:(int)result contextInfo:sender]; + }]; } - (void) browseSendToAppDone: (NSOpenPanel *) sheet |