From 8520e5c0c5ccc2f96f4d7b995ff6a56ecf27babe Mon Sep 17 00:00:00 2001 From: dynaflash Date: Mon, 14 Jan 2008 13:58:19 +0000 Subject: MacGui: Warn of duplicate output filenames when adding to the queue. - Thanks travistex git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1192 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/HBQueueController.mm | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'macosx/HBQueueController.mm') diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm index 6743b378c..75095af69 100644 --- a/macosx/HBQueueController.mm +++ b/macosx/HBQueueController.mm @@ -805,7 +805,7 @@ NSString *HBJobGroupStatusNotification = @"HBJobGroupStatusNotification"; return firstJob ? firstJob->titleName : nil; } -- (NSString *) path +- (NSString *) destinationPath { HBJob * firstJob = [self jobAtIndex:0]; return firstJob ? firstJob->file : nil; @@ -907,6 +907,8 @@ static NSString* HBQueuePauseResumeToolbarIdentifier = @"HBQueuePauseRe return fCurrentJob; } +#pragma mark - + //------------------------------------------------------------------------------------ // Displays and brings the queue window to the front //------------------------------------------------------------------------------------ @@ -976,6 +978,24 @@ static NSString* HBQueuePauseResumeToolbarIdentifier = @"HBQueuePauseRe fCurrentJobGroup = aJobGroup; } +#pragma mark - Finding job groups + +//------------------------------------------------------------------------------------ +// Returns the first pending job with a specified destination path or nil if no such +// job exists. +//------------------------------------------------------------------------------------ +- (HBJobGroup *) pendingJobGroupWithDestinationPath: (NSString *)path +{ + HBJobGroup * aJobGroup; + NSEnumerator * groupEnum = [fJobGroups objectEnumerator]; + while ( (aJobGroup = [groupEnum nextObject]) ) + { + if ([[aJobGroup destinationPath] isEqualToString: path]) + return aJobGroup; + } + return nil; +} + //------------------------------------------------------------------------------------ // Locates and returns a HBJob whose sequence_id matches a specified value. //------------------------------------------------------------------------------------ @@ -1604,8 +1624,8 @@ static NSString* HBQueuePauseResumeToolbarIdentifier = @"HBQueuePauseRe while (row != NSNotFound) { HBJobGroup * jobGroup = [fOutlineView itemAtRow: row]; - if ([[jobGroup path] length]) - [[NSWorkspace sharedWorkspace] selectFile:[jobGroup path] inFileViewerRootedAtPath:nil]; + if ([[jobGroup destinationPath] length]) + [[NSWorkspace sharedWorkspace] selectFile:[jobGroup destinationPath] inFileViewerRootedAtPath:nil]; row = [selectedRows indexGreaterThanIndex: row]; } -- cgit v1.2.3