Skip to content

Commit

Permalink
ui/cocoa.m: Add Reset and Power Down menu items to Machine menu
Browse files Browse the repository at this point in the history
Add "Reset" and "Power Down" menu items to Machine menu.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
programmingkidx authored and pm215 committed Jun 19, 2015
1 parent 8524f1c commit 2707461
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ui/cocoa.m
Expand Up @@ -806,6 +806,8 @@ - (void)pauseQEMU:(id)sender;
- (void)resumeQEMU:(id)sender;
- (void)displayPause;
- (void)removePause;
- (void)restartQEMU:(id)sender;
- (void)powerDownQEMU:(id)sender;
@end

@implementation QemuCocoaAppController
Expand Down Expand Up @@ -1033,6 +1035,18 @@ - (void)removePause
[pauseLabel removeFromSuperview];
}

/* Restarts QEMU */
- (void)restartQEMU:(id)sender
{
qmp_system_reset(NULL);
}

/* Powers down QEMU */
- (void)powerDownQEMU:(id)sender
{
qmp_system_powerdown(NULL);
}

@end


Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 2707461

Please sign in to comment.