diff mbox

ui/cocoa.m: remove open dialog code

Message ID 33856864-321C-4367-9170-FB0BF81E789B@gmail.com
State New
Headers show

Commit Message

Programmingkid Sept. 25, 2015, 9 p.m. UTC
Removes 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 ++------------------------------------------------------
 1 files changed, 2 insertions(+), 54 deletions(-)

Comments

Peter Maydell Sept. 25, 2015, 10 p.m. UTC | #1
On 25 September 2015 at 14:00, Programmingkid <programmingkidx@gmail.com> wrote:
> Removes 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>

Applied to cocoa.next, thanks.

Do you have more patches pending or is now a good time to flush
the cocoa.next queue to master?

-- PMM
Programmingkid Sept. 25, 2015, 10:09 p.m. UTC | #2
On Sep 25, 2015, at 6:00 PM, Peter Maydell wrote:

> On 25 September 2015 at 14:00, Programmingkid <programmingkidx@gmail.com> wrote:
>> Removes 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>
> 
> Applied to cocoa.next, thanks.
> 
> Do you have more patches pending or is now a good time to flush
> the cocoa.next queue to master?

There is the patch that allows the user to use a real CD-ROM disc in
QEMU. It adds a menu item to the Machine menu called "Use real cdrom".
The problem is it wouldn't work because the patch I made to fix access
problems with real CD-ROM disk might not be applied to QEMU yet. It
was sent to Kevin Wolf back in July. Haven't heard back from him yet.
diff mbox

Patch

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 <= 1 || strncmp ((char *)gArgv[1], "-psn", 4) == 0) {
-        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"];
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 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];
 }
 
 - (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 == NSFileHandlingPanelCancelButton) {
-        exit(0);
-    } else if (returnCode == NSFileHandlingPanelOKButton) {
-        char *img = (char*)[ [ [ sheet URL ] path ] cStringUsingEncoding:NSASCIIStringEncoding];
-
-        char **argv = g_new(char *, 4);
-
-        [sheet close];
-
-        argv[0] = g_strdup(gArgv[0]);
-        argv[1] = g_strdup("-hda");
-        argv[2] = g_strdup(img);
-        argv[3] = 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: