From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrw23-00021o-Dl for qemu-devel@nongnu.org; Mon, 11 May 2015 18:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yrw1z-00045y-AZ for qemu-devel@nongnu.org; Mon, 11 May 2015 18:18:39 -0400 Received: from mail-qc0-x232.google.com ([2607:f8b0:400d:c01::232]:35560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrw1z-00045u-4n for qemu-devel@nongnu.org; Mon, 11 May 2015 18:18:35 -0400 Received: by qcbgu10 with SMTP id gu10so76704700qcb.2 for ; Mon, 11 May 2015 15:18:34 -0700 (PDT) From: Programmingkid Content-Type: multipart/alternative; boundary=Apple-Mail-3--43539500 Date: Mon, 11 May 2015 18:18:30 -0400 Message-Id: <01A0DC97-BF06-40E4-ADEB-7BD900AE94EB@gmail.com> Mime-Version: 1.0 (Apple Message framework v1084) Subject: [Qemu-devel] [PATCH 3/3] ui/cocoa.m: Add Reset and Power Down menu items to Machine menu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel qemu-devel --Apple-Mail-3--43539500 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Adds Reset and Power Down menu items to the Machine menu.=20 Signed-off-by: John Arbuckle --- 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 =20 @implementation QemuCocoaAppController @@ -1064,6 +1066,18 @@ QemuCocoaView *cocoaView; } } =20 +/* Restarts QEMU */ +- (void)restartQemu:(id)sender +{ + qemu_system_reset_request(); +} + +/* Powers down the emulator */ +- (void)powerDown:(id)sender +{ + qmp_system_powerdown(NULL); +} + @end =20 =20 @@ -1202,6 +1216,15 @@ static void addDeviceMenuItems(NSMenu * menu) } } =20 +// 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); } =20 #pragma mark qemu --=20 1.7.5.4 --Apple-Mail-3--43539500 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
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

 

@@ = -1064,6 +1066,18 @@ QemuCocoaView *cocoaView;
 }

 

+/* = Restarts QEMU */
+- (void)restartQemu:(id)sender
+    = qemu_system_reset_request();
+}
+
+/* Powers down the emulator = */
+{
+    = 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
+    [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()
     [[menu = itemWithTitle: @"Resume"] setEnabled: NO];  // Disables the Resume = menu item because it isn't needed right now.
 

 #pragma mark qemu
1.7.5.4