From dfa1f8dd4bbaed3fba144a5afead99a1ea102c44 Mon Sep 17 00:00:00 2001 From: ritsuka Date: Thu, 22 Jan 2015 10:30:26 +0000 Subject: MacGui: move the application delegate to its own class. Removed the "Open Source (Title Specific)" menu item, now integrated in the standard open panel. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6784 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/HBQueueController.mm | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'macosx/HBQueueController.mm') diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm index b835599a9..1a8712653 100644 --- a/macosx/HBQueueController.mm +++ b/macosx/HBQueueController.mm @@ -9,6 +9,7 @@ #import "HBCore.h" #import "Controller.h" +#import "HBAppDelegate.h" #import "HBOutputPanelController.h" #import "HBQueueOutlineView.h" @@ -136,6 +137,45 @@ #pragma mark Toolbar +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + SEL action = menuItem.action; + + if (action == @selector(rip:)) + { + if (self.core.state == HBStateIdle) + { + menuItem.title = NSLocalizedString(@"Start Encoding", nil); + menuItem.keyEquivalent = @"s"; + + return (self.pendingItemsCount > 0); + } + else if (self.core.state != HBStateIdle) + { + menuItem.title = NSLocalizedString(@"Stop Encoding", nil); + menuItem.keyEquivalent = @"."; + + return YES; + } + } + + if (action == @selector(pause:)) + { + if (self.core.state != HBStatePaused) + { + menuItem.title = NSLocalizedString(@"Pause Encoding", nil); + } + else + { + menuItem.title = NSLocalizedString(@"Resume Encoding", nil); + } + + return (self.core.state == HBStateWorking || self.core.state == HBStatePaused); + } + + return YES; +} + - (BOOL)validateToolbarItem:(NSToolbarItem *)theItem { SEL action = theItem.action; @@ -898,7 +938,7 @@ NSInteger response = [alert runModal]; if (response == NSAlertSecondButtonReturn) { - [self.controller showPreferencesWindow:nil]; + [self.delegate showPreferencesWindow:nil]; } [alert release]; } @@ -917,7 +957,7 @@ NSInteger response = [alert runModal]; if (response == NSAlertSecondButtonReturn) { - [self.controller showPreferencesWindow:nil]; + [self.delegate showPreferencesWindow:nil]; } [alert release]; } -- cgit v1.2.3