Received: from eggs.gnu.org ([2001:4830:134:3::10]:58005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaCk1-0003f0-Kk for qemu-devel@nongnu.org; Thu, 10 Sep 2015 21:03:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaCjy-00065Y-B0 for qemu-devel@nongnu.org; Thu, 10 Sep 2015 21:03:01 -0400 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:36412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaCjx-000654-CS for qemu-devel@nongnu.org; Thu, 10 Sep 2015 21:02:58 -0400 Received: by qgx61 with SMTP id 61so51167320qgx.3 for ; Thu, 10 Sep 2015 18:02:55 -0700 (PDT) From: Programmingkid Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/alternative; boundary=Apple-Mail-3--230294264 Date: Thu, 10 Sep 2015 21:02:53 -0400 In-Reply-To: References: Message-Id: <7C86EB94-45CA-43D9-8FCD-16787CBAA45B@gmail.com> Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: remove open dialog code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel qemu-devel --Apple-Mail-3--230294264 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Sep 10, 2015, at 8:49 PM, Programmingkid wrote: > Remove the open dialog code that runs when no arguments are supplied = with QEMU. > Not everyone needs a hard drive or cdrom to boot their target. A user = might only > need to use their target's bios to do work. With that said, this patch = removes > the unneeded open dialog code.=20 >=20 > Signed-off-by: John Arbuckle >=20 > --- > ui/cocoa.m | 56 = ++------------------------------------------------------ > 1 files changed, 2 insertions(+), 54 deletions(-) >=20 > diff --git a/ui/cocoa.m b/ui/cocoa.m > index 334e6f6..1dc9bc6 100644 > --- a/ui/cocoa.m > +++ b/ui/cocoa.m > @@ -814,7 +814,6 @@ QemuCocoaView *cocoaView; > { > } > - (void)startEmulationWithArgc:(int)argc argv:(char**)argv; > -- (void)openPanelDidEnd:(NSOpenPanel *)sheet = returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; > - (void)doToggleFullScreen:(id)sender; > - (void)toggleFullScreen:(id)sender; > - (void)showQEMUDoc:(id)sender; > @@ -895,29 +894,8 @@ QemuCocoaView *cocoaView; > - (void)applicationDidFinishLaunching: (NSNotification *) note > { > COCOA_DEBUG("QemuCocoaAppController: = applicationDidFinishLaunching\n"); > - > - // Display an open dialog box if no arguments were passed or > - // if qemu was launched from the finder ( the Finder passes = "-psn" ) > - if( gArgc <=3D 1 || strncmp ((char *)gArgv[1], "-psn", 4) =3D=3D = 0) { > - NSOpenPanel *op =3D [[NSOpenPanel alloc] init]; > - [op setPrompt:@"Boot image"]; > - [op setMessage:@"Select the disk image you want to = boot.\n\nHit the \"Cancel\" button to quit"]; > -#if (MAC_OS_X_VERSION_MAX_ALLOWED >=3D MAC_OS_X_VERSION_10_6) > - [op setAllowedFileTypes:supportedImageFileTypes]; > - [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]; > - } > + // launch QEMU, with the global args > + [self startEmulationWithArgc:gArgc argv:(char **)gArgv]; > } > =20 > - (void)applicationWillTerminate:(NSNotification *)aNotification > @@ -942,36 +920,6 @@ QemuCocoaView *cocoaView; > exit(status); > } > =20 > -- (void)openPanelDidEnd:(NSOpenPanel *)sheet = returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo > -{ > - COCOA_DEBUG("QemuCocoaAppController: openPanelDidEnd\n"); > - > - /* The = NSFileHandlingPanelOKButton/NSFileHandlingPanelCancelButton values for > - * returnCode strictly only apply for the 10.6-and-up = beginSheetModalForWindow > - * API. For the legacy pre-10.6 beginSheetForDirectory API they = are NSOKButton > - * and NSCancelButton. However conveniently the values are the = same. > - * We use the non-legacy names because the others are deprecated = in OSX 10.10. > - */ > - if (returnCode =3D=3D NSFileHandlingPanelCancelButton) { > - exit(0); > - } else if (returnCode =3D=3D NSFileHandlingPanelOKButton) { > - char *img =3D (char*)[ [ [ sheet URL ] path ] = cStringUsingEncoding:NSASCIIStringEncoding]; > - > - char **argv =3D g_new(char *, 4); > - > - [sheet close]; > - > - argv[0] =3D g_strdup(gArgv[0]); > - argv[1] =3D g_strdup("-hda"); > - argv[2] =3D g_strdup(img); > - argv[3] =3D NULL; > - > - // printf("Using argc %d argv %s -hda %s\n", 3, gArgv[0], = img); > - > - [self startEmulationWithArgc:3 argv:(char**)argv]; > - } > -} > - > /* We abstract the method called by the Enter Fullscreen menu item > * because Mac OS 10.7 and higher disables it. This is because of the > * menu item's old selector's name toggleFullScreen: > --=20 > 1.7.5.4 >=20 Forgot to add that this patch also removes code that was incompatible = with gcc 4.9. --Apple-Mail-3--230294264 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Remove the open dialog code = that runs when no arguments are supplied with QEMU.
Not = everyone needs a hard drive or cdrom to boot their target. A user might = only
need to use their target's bios to do work. With = that said, this patch removes
the unneeded open dialog = code. 

Signed-off-by: John Arbuckle = <programmingkidx@gmail.com>= ;

---
 ui/cocoa.m |   56 = ++------------------------------------------------------

diff --git a/ui/cocoa.m = b/ui/cocoa.m
index 334e6f6..1dc9bc6 100644
--- = a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -814,7 +814,6 @@ = QemuCocoaView *cocoaView;
 {
 }
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet = returnCode:(NSInteger)returnCode contextInfo:(void = *)contextInfo;
 - = (void)doToggleFullScreen:(id)sender;
 - = (void)toggleFullScreen:(id)sender;
 - = (void)showQEMUDoc:(id)sender;
@@ -895,29 +894,8 @@ QemuCocoaView = *cocoaView;
 - (void)applicationDidFinishLaunching: = (NSNotification *) note
 {
     = COCOA_DEBUG("QemuCocoaAppController: = applicationDidFinishLaunching\n");
-
-    // Display an open = dialog box if no arguments were passed or
-    // if qemu was = launched from the finder ( the Finder passes "-psn" )
-        NSOpenPanel *op =3D = [[NSOpenPanel alloc] init];
-        [op = setPrompt:@"Boot image"];
-        [op = setMessage:@"Select the disk image you want to boot.\n\nHit the = \"Cancel\" button to quit"];
-#if (MAC_OS_X_VERSION_MAX_ALLOWED = >=3D MAC_OS_X_VERSION_10_6)
-        [op = setAllowedFileTypes:supportedImageFileTypes];
-        =     completionHandler:^(NSInteger returnCode)
-              =     returnCode:returnCode contextInfo:NULL ]; } ];
-        // Compatibility code = for pre-10.6, using deprecated method
-        = [op beginSheetForDirectory:nil file:nil types:filetypes
-#endif
-    } else {
-        [self = startEmulationWithArgc:gArgc argv:(char **)gArgv];
+    // launch QEMU, with the global = args
+    [self startEmulationWithArgc:gArgc = argv:(char **)gArgv];
 }
 
 - = (void)applicationWillTerminate:(NSNotification *)aNotification
@@ = -942,36 +920,6 @@ QemuCocoaView *cocoaView;
     = exit(status);
 }
 
-- (void)openPanelDidEnd:(NSOpenPanel = *)sheet returnCode:(NSInteger)returnCode contextInfo:(void = *)contextInfo
-{
-    = COCOA_DEBUG("QemuCocoaAppController: openPanelDidEnd\n");
-    /* The = NSFileHandlingPanelOKButton/NSFileHandlingPanelCancelButton values = for
-     * returnCode strictly only apply = for the 10.6-and-up beginSheetModalForWindow
- =     * API. For the legacy pre-10.6 beginSheetForDirectory API = they are NSOKButton
-     * and NSCancelButton. However = conveniently the values are the same.
-     * We use the = non-legacy names because the others are deprecated in OSX = 10.10.
-     */
-    if (returnCode = =3D=3D NSFileHandlingPanelCancelButton) {
-        = exit(0);
-    } else if (returnCode =3D=3D = NSFileHandlingPanelOKButton) {
-        char = *img =3D (char*)[ [ [ sheet URL ] path ] = cStringUsingEncoding:NSASCIIStringEncoding];
-        char **argv =3D = g_new(char *, 4);
-
-        [sheet = close];
-
-        argv[0] =3D = g_strdup(gArgv[0]);
-        argv[1] =3D = g_strdup("-hda");
-        argv[2] =3D = g_strdup(img);
-        argv[3] =3D = NULL;
-
-        // printf("Using argc = %d argv %s -hda %s\n", 3, gArgv[0], img);
-
-        = [self startEmulationWithArgc:3 argv:(char**)argv];
-}
-
 /* We abstract the method = called by the Enter Fullscreen menu item
  * because Mac OS 10.7 = and higher disables it. This is because of the
  = * menu item's old selector's name toggleFullScreen:
1.7.5.4