* [Qemu-devel] [PATCH 3/3] ui/cocoa.m: Add Reset and Power Down menu items to Machine menu
@ 2015-05-11 22:18 Programmingkid
2015-05-16 22:00 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Programmingkid @ 2015-05-11 22:18 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1904 bytes --]
Adds Reset and Power Down menu items to the Machine menu.
Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
---
ui/cocoa.m | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 5e558ea..2c4a61a 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -828,6 +828,8 @@ QemuCocoaView *cocoaView;
- (void)removePause;
- (void)ejectDeviceMedia:(id)sender;
- (void)changeDeviceMedia:(id)sender;
+- (void)restartQemu:(id)sender;
+- (void)powerDown:(id)sender;
@end
@implementation QemuCocoaAppController
@@ -1064,6 +1066,18 @@ QemuCocoaView *cocoaView;
}
}
+/* Restarts QEMU */
+- (void)restartQemu:(id)sender
+{
+ qemu_system_reset_request();
+}
+
+/* Powers down the emulator */
+- (void)powerDown:(id)sender
+{
+ qmp_system_powerdown(NULL);
+}
+
@end
@@ -1202,6 +1216,15 @@ static void addDeviceMenuItems(NSMenu * menu)
}
}
+// Adds the Reset and Power Down menu items to the specifed menu
+static void addResetPowerDownMenuItems(NSMenu* menu)
+{
+ [menu addItem: [NSMenuItem separatorItem]];
+ [menu addItem: [[[NSMenuItem alloc] initWithTitle: @"Reset" action: @selector(restartQemu:) keyEquivalent: @""] autorelease]];
+ [menu addItem: [[[NSMenuItem alloc] initWithTitle: @"Power Down" action: @selector(powerDown:) keyEquivalent: @""] autorelease]];
+}
+
+
/*
Adds the Machine menu to the menu bar.
Has to be added separately because QEMU needs
@@ -1222,6 +1245,7 @@ static void createMachineMenu()
[[NSApp mainMenu] insertItem: menuItem atIndex: 2]; // Insert after View menu
[[menu itemWithTitle: @"Resume"] setEnabled: NO]; // Disables the Resume menu item because it isn't needed right now.
addDeviceMenuItems(menu);
+ addResetPowerDownMenuItems(menu);
}
#pragma mark qemu
--
1.7.5.4
[-- Attachment #2: Type: text/html, Size: 11588 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH 3/3] ui/cocoa.m: Add Reset and Power Down menu items to Machine menu
2015-05-11 22:18 [Qemu-devel] [PATCH 3/3] ui/cocoa.m: Add Reset and Power Down menu items to Machine menu Programmingkid
@ 2015-05-16 22:00 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2015-05-16 22:00 UTC (permalink / raw)
To: Programmingkid; +Cc: qemu-devel qemu-devel
On 11 May 2015 at 23:18, Programmingkid <programmingkidx@gmail.com> wrote:
> Adds Reset and Power Down menu items to the Machine menu.
>
> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
This patch mostly looks good and pretty straightforward.
If you put it as #2 in this series then we can get it into
master even if we need to have another review-go-around
about the device eject/mediachange code.
>
> ---
> ui/cocoa.m | 24 ++++++++++++++++++++++++
> 1 files changed, 24 insertions(+), 0 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 5e558ea..2c4a61a 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -828,6 +828,8 @@ QemuCocoaView *cocoaView;
> - (void)removePause;
> - (void)ejectDeviceMedia:(id)sender;
> - (void)changeDeviceMedia:(id)sender;
> +- (void)restartQemu:(id)sender;
"QEMU"
> +- (void)powerDown:(id)sender;
Why doesn't this method name have "QEMU" in it?
> @end
>
>
>
> @implementation QemuCocoaAppController
> @@ -1064,6 +1066,18 @@ QemuCocoaView *cocoaView;
> }
> }
>
>
>
> +/* Restarts QEMU */
> +- (void)restartQemu:(id)sender
> +{
> + qemu_system_reset_request();
> +}
> +
> +/* Powers down the emulator */
> +- (void)powerDown:(id)sender
> +{
> + qmp_system_powerdown(NULL);
> +}
This is inconsistent -- we should use qmp_system_reset(NULL),
which is then doing the same as the GTK UI and means we're
using QMP functions for both reset and powerdown.
> +
> @end
>
>
>
>
>
> @@ -1202,6 +1216,15 @@ static void addDeviceMenuItems(NSMenu * menu)
> }
> }
>
>
>
> +// Adds the Reset and Power Down menu items to the specifed menu
"specified"
> +static void addResetPowerDownMenuItems(NSMenu* menu)
> +{
> + [menu addItem: [NSMenuItem separatorItem]];
> + [menu addItem: [[[NSMenuItem alloc] initWithTitle: @"Reset" action:
> @selector(restartQemu:) keyEquivalent: @""] autorelease]];
> + [menu addItem: [[[NSMenuItem alloc] initWithTitle: @"Power Down"
> action: @selector(powerDown:) keyEquivalent: @""] autorelease]];
> +}
> +
> +
> /*
> Adds the Machine menu to the menu bar.
> Has to be added separately because QEMU needs
> @@ -1222,6 +1245,7 @@ static void createMachineMenu()
> [[NSApp mainMenu] insertItem: menuItem atIndex: 2]; // Insert after
> View menu
> [[menu itemWithTitle: @"Resume"] setEnabled: NO]; // Disables the
> Resume menu item because it isn't needed right now.
> addDeviceMenuItems(menu);
> + addResetPowerDownMenuItems(menu);
> }
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-16 22:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-11 22:18 [Qemu-devel] [PATCH 3/3] ui/cocoa.m: Add Reset and Power Down menu items to Machine menu Programmingkid
2015-05-16 22:00 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).