aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2013-04-22 10:29:49 +0000
committerAndreas Färber <andreas.faerber@web.de>2013-05-29 01:28:31 +0200
commit2ba9de6ed0455f5c55e4fb1841e1597204535430 (patch)
treeaacc04dfaacf25f3fad1502a7090f4ecb79b740e
parent8bb3f1e3742ca8d26af7156e14068435437918a1 (diff)
downloadqemu-2ba9de6ed0455f5c55e4fb1841e1597204535430.zip
qemu-2ba9de6ed0455f5c55e4fb1841e1597204535430.tar.gz
qemu-2ba9de6ed0455f5c55e4fb1841e1597204535430.tar.bz2
cocoa: Avoid deprecated NSOpenPanel beginSheetForDirectory
In MacOSX 10.6 and above the NSOpenPanel beginSheetForDirectory method is deprecated. Use the preferred replacements instead. We retain the original code for use on earlier MacOSX versions because the replacement methods don't exist before 10.6. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
-rw-r--r--ui/cocoa.m16
1 files changed, 15 insertions, 1 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index bb59511..be49179 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -35,6 +35,9 @@
#ifndef MAC_OS_X_VERSION_10_5
#define MAC_OS_X_VERSION_10_5 1050
#endif
+#ifndef MAC_OS_X_VERSION_10_6
+#define MAC_OS_X_VERSION_10_6 1060
+#endif
//#define DEBUG
@@ -771,9 +774,20 @@ QemuCocoaView *cocoaView;
NSOpenPanel *op = [[NSOpenPanel alloc] init];
[op setPrompt:@"Boot image"];
[op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"];
- [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil]
+ NSArray *filetypes = [NSArray arrayWithObjects:@"img", @"iso", @"dmg",
+ @"qcow", @"cow", @"cloop", @"vmdk", nil];
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
+ [op setAllowedFileTypes:filetypes];
+ [op beginSheetModalForWindow:normalWindow
+ completionHandler:^(NSInteger returnCode)
+ { [self openPanelDidEnd:op
+ returnCode:returnCode contextInfo:NULL ]; } ];
+#else
+ // Compatibility code for pre-10.6, using deprecated method
+ [op beginSheetForDirectory:nil file:nil types:filetypes
modalForWindow:normalWindow modalDelegate:self
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
+#endif
} else {
// or launch QEMU, with the global args
[self startEmulationWithArgc:gArgc argv:(char **)gArgv];