qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 2/3] ui/cocoa.m: Add Reset and Power Down menu items


From: Peter Maydell
Subject: [Qemu-devel] [PULL 2/3] ui/cocoa.m: Add Reset and Power Down menu items to Machine menu
Date: Fri, 19 Jun 2015 11:30:36 +0100

From: John Arbuckle <address@hidden>

Add "Reset" and "Power Down" menu items to Machine menu.

Signed-off-by: John Arbuckle <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
 ui/cocoa.m | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index d28140b..559058b 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -806,6 +806,8 @@ QemuCocoaView *cocoaView;
 - (void)resumeQEMU:(id)sender;
 - (void)displayPause;
 - (void)removePause;
+- (void)restartQEMU:(id)sender;
+- (void)powerDownQEMU:(id)sender;
 @end
 
 @implementation QemuCocoaAppController
@@ -1033,6 +1035,18 @@ QemuCocoaView *cocoaView;
     [pauseLabel removeFromSuperview];
 }
 
+/* Restarts QEMU */
+- (void)restartQEMU:(id)sender
+{
+    qmp_system_reset(NULL);
+}
+
+/* Powers down QEMU */
+- (void)powerDownQEMU:(id)sender
+{
+    qmp_system_powerdown(NULL);
+}
+
 @end
 
 
@@ -1099,6 +1113,9 @@ int main (int argc, const char * argv[]) {
     menuItem = [[[NSMenuItem alloc] initWithTitle: @"Resume" action: 
@selector(resumeQEMU:) keyEquivalent: @""] autorelease];
     [menu addItem: menuItem];
     [menuItem setEnabled: NO];
+    [menu addItem: [NSMenuItem separatorItem]];
+    [menu addItem: [[[NSMenuItem alloc] initWithTitle: @"Reset" action: 
@selector(restartQEMU:) keyEquivalent: @""] autorelease]];
+    [menu addItem: [[[NSMenuItem alloc] initWithTitle: @"Power Down" action: 
@selector(powerDownQEMU:) keyEquivalent: @""] autorelease]];
     menuItem = [[[NSMenuItem alloc] initWithTitle: @"Machine" action:nil 
keyEquivalent:@""] autorelease];
     [menuItem setSubmenu:menu];
     [[NSApp mainMenu] addItem:menuItem];
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]