qemu-devel
[Top][All Lists]
Advanced

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

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


From: Programmingkid
Subject: [Qemu-devel] [PATCH 3/3] ui/cocoa.m: Add Reset and Power Down menu items to Machine menu
Date: Mon, 11 May 2015 18:18:30 -0400

Adds Reset and Power Down menu items to the Machine menu. 

Signed-off-by: John Arbuckle <address@hidden>

---
 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


reply via email to

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