From patchwork Mon May 11 22:18:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 471056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EFFCC140077 for ; Tue, 12 May 2015 08:19:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=joEdZwF6; dkim-atps=neutral Received: from localhost ([::1]:39882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrw2K-0002IL-Sd for incoming@patchwork.ozlabs.org; Mon, 11 May 2015 18:18:56 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:subject:date:message-id:cc:to:mime-version; bh=umO5KeEJKedhLIapRhvtEQ0trIT3bc0AsZN23OO5Yms=; b=joEdZwF6EgU3QMrOEPaLy/NNhordtpaHr0OGrhdyGbpD8V8LEpUe6Ihipd3/YT9ZI4 BjoyMj2plGpkW2RIiwTRkZ6b85GySxVIA0+zGfXAVMleD/mZjf/oKHn1c49daIKPTXdi BTjeppn24SKGFjsEnxMUyxJwOZdCdR0cJ8ryCeXzueyKUPANw7yKK2ktTV6u1aIHrPxg CP9vd1hghEu40JFphgqlcCNz6lE5CwhbXeCqzUU+jFb/+mr4epUtb7sF7E4s5rg8fL7X 9NXIHHJ4ELP0uV/1MgdZ6osCjZ/1lCfJlETVO5BixahLtmTS09YtbnksgSBm5SkzwIvL aioA== X-Received: by 10.140.235.135 with SMTP id g129mr213630qhc.74.1431382714781; Mon, 11 May 2015 15:18:34 -0700 (PDT) Received: from [192.168.0.3] (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by mx.google.com with ESMTPSA id b141sm11642877qka.11.2015.05.11.15.18.32 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 May 2015 15:18:33 -0700 (PDT) From: Programmingkid Date: Mon, 11 May 2015 18:18:30 -0400 Message-Id: <01A0DC97-BF06-40E4-ADEB-7BD900AE94EB@gmail.com> To: Peter Maydell Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::232 Cc: qemu-devel qemu-devel Subject: [Qemu-devel] [PATCH 3/3] ui/cocoa.m: Add Reset and Power Down menu items to Machine menu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Adds Reset and Power Down menu items to the Machine menu. 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 @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