diff options
author | Rodeo <[email protected]> | 2013-04-12 20:14:05 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-04-12 20:14:05 +0000 |
commit | 3d9d937ed4c21aa6ffde4710d044de71fc54330e (patch) | |
tree | 9ef03cf51f8572e092e4e57cd83cdab420af90ec /macosx | |
parent | da8a0f3ace2b71ef1cbb911d194dd1f9561017b0 (diff) |
MacGui: simplify queue display code.
Add detailed summaries to the queue item dictionary and use them in HBQueueController.
This helps remove a lot of duplicate logic.
Uses existing methods pictureSettingsSummary, pictureFiltersSummary and new muxerOptionsSummary.
Also add a few height rows for long lines that often wrap to a second row.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5398 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 1 | ||||
-rw-r--r-- | macosx/Controller.m | 45 | ||||
-rw-r--r-- | macosx/HBQueueController.mm | 215 |
3 files changed, 64 insertions, 197 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index d69438d26..6020f64f8 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -347,6 +347,7 @@ BOOL fIsDragging; /* Text summaries of various settings */ - (NSString*) pictureSettingsSummary; - (NSString*) pictureFiltersSummary; +- (NSString*) muxerOptionsSummary; /* Add All titles to the queue */ - (IBAction) addAllTitlesToQueue: (id) sender; diff --git a/macosx/Controller.m b/macosx/Controller.m index f0b20f379..893e65473 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -2664,17 +2664,14 @@ fWorkingCount = 0; [queueFileJob setObject:[NSNumber numberWithFloat:fTitle->job->anamorphic.dar_height] forKey:@"PicturePARDisplayHeight"]; } - - /* Summary for the queue display */ - NSString *pictureSizingSummary = [NSString stringWithFormat:@"%@", - [fPictureController getPictureSizeInfoString]]; - if (fTitle->job->anamorphic.mode != 1) - { - pictureSizingSummary = [pictureSizingSummary - stringByAppendingFormat:@", Modulus: %d", - fTitle->job->modulus]; - } - [queueFileJob setObject:pictureSizingSummary forKey:@"PictureSizingSummary"]; + + /* Text summaries of various settings */ + [queueFileJob setObject:[NSString stringWithString:[self pictureSettingsSummary]] + forKey:@"PictureSettingsSummary"]; + [queueFileJob setObject:[NSString stringWithString:[self pictureFiltersSummary]] + forKey:@"PictureFiltersSummary"]; + [queueFileJob setObject:[NSString stringWithString:[self muxerOptionsSummary]] + forKey:@"MuxerOptionsSummary"]; /* Set crop settings here */ [queueFileJob setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"]; @@ -5889,6 +5886,32 @@ the user is using "Custom" settings by determining the sender*/ return [NSString stringWithString:summary]; } +- (NSString*) muxerOptionsSummary +{ + NSMutableString *summary = [NSMutableString stringWithString:@""]; + if (([fDstFormatPopUp selectedItem]) && + [[fDstFormatPopUp selectedItem] tag] == HB_MUX_MP4) + { + if ([fDstMp4LargeFileCheck state]) + { + [summary appendString:@" - Large file size"]; + } + if ([fDstMp4HttpOptFileCheck state]) + { + [summary appendString:@" - Web optimized"]; + } + if ([fDstMp4iPodFileCheck state]) + { + [summary appendString:@" - iPod 5G support"]; + } + } + if ([summary hasPrefix:@" - "]) + { + [summary deleteCharactersInRange:NSMakeRange(0, 3)]; + } + return [NSString stringWithString:summary]; +} + #pragma mark - #pragma mark - Audio and Subtitles diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm index 92e9dafc8..a121c1826 100644 --- a/macosx/HBQueueController.mm +++ b/macosx/HBQueueController.mm @@ -839,66 +839,26 @@ return ![(HBQueueOutlineView*)outlineView isDragging]; int itemRowNum = [outlineView rowForItem: item]; NSMutableDictionary *queueItemToCheck = [outlineView itemAtRow: itemRowNum]; - /* Check to see if we need to allow for mp4 opts */ - BOOL mp4OptsPresent = NO; - if ([[queueItemToCheck objectForKey:@"FileFormat"] isEqualToString: @"MP4 file"]) + /* Check to see if we need to allow for container options */ + if ([[queueItemToCheck objectForKey:@"MuxerOptionsSummary"] length]) { - - if( [[queueItemToCheck objectForKey:@"Mp4LargeFile"] intValue] == 1) - { - mp4OptsPresent = YES; - } - if( [[queueItemToCheck objectForKey:@"Mp4HttpOptimize"] intValue] == 1) - { - mp4OptsPresent = YES; - } - if( [[queueItemToCheck objectForKey:@"Mp4iPodCompatible"] intValue] == 1) - { - mp4OptsPresent = YES; - } - } - - if (mp4OptsPresent == YES) - { - itemHeightForDisplay += rowHeightNonTitle; + itemHeightForDisplay += rowHeightNonTitle; } /* check to see if we need to allow for the Picture Filters row */ - BOOL pictureFiltersPresent = NO; - if( [[queueItemToCheck objectForKey:@"PictureDetelecine"] intValue] > 0) + if ([[queueItemToCheck objectForKey:@"PictureFiltersSummary"] length]) { - pictureFiltersPresent = YES; - } - if( [[queueItemToCheck objectForKey:@"PictureDecomb"] intValue] > 0) - { - pictureFiltersPresent = YES; - } - if( [[queueItemToCheck objectForKey:@"PictureDeinterlace"] intValue] > 0) - { - pictureFiltersPresent = YES; - } - if( [[queueItemToCheck objectForKey:@"PictureDenoise"] intValue] > 0) - { - pictureFiltersPresent = YES; - } - if( [[queueItemToCheck objectForKey:@"PictureDeblock"] intValue] > 0) - { - pictureFiltersPresent = YES; - } - if( [[queueItemToCheck objectForKey:@"VideoGrayScale"] intValue] > 0) - { - pictureFiltersPresent = YES; + itemHeightForDisplay += rowHeightNonTitle; } - if (pictureFiltersPresent == YES) + /* check to see if we need a line to display x264/lavc options */ + if ([[queueItemToCheck objectForKey:@"VideoEncoder"] isEqualToString: @"H.264 (x264)"]) { - itemHeightForDisplay += rowHeightNonTitle; + itemHeightForDisplay += rowHeightNonTitle * 2; } - - /* check to see if we need a line to display x264 options */ - if ([[queueItemToCheck objectForKey:@"VideoEncoder"] isEqualToString: @"H.264 (x264)"]) + else if (![[queueItemToCheck objectForKey:@"VideoEncoder"] isEqualToString: @"VP3 (Theora)"]) { - itemHeightForDisplay += rowHeightNonTitle; + itemHeightForDisplay += rowHeightNonTitle; } /* check to see how many audio track lines to allow for */ @@ -915,7 +875,7 @@ return ![(HBQueueOutlineView*)outlineView isDragging]; autoPassthruPresent = YES; } } - itemHeightForDisplay += (actualCountOfAudioTracks * rowHeightNonTitle); + itemHeightForDisplay += (actualCountOfAudioTracks * rowHeightNonTitle * 2); if (autoPassthruPresent == YES) { @@ -1113,33 +1073,14 @@ return ![(HBQueueOutlineView*)outlineView isDragging]; [finalString appendString: @"Format: " withAttributes:detailBoldAttr]; [finalString appendString: jobFormatInfo withAttributes:detailAttr]; - /* Optional String for mp4 options */ - if ([[item objectForKey:@"FileFormat"] isEqualToString: @"MP4 file"]) + /* Optional String for muxer options */ + if ([[item objectForKey:@"MuxerOptionsSummary"] length]) { - NSString * MP4Opts = @""; - BOOL mp4OptsPresent = NO; - if( [[item objectForKey:@"Mp4LargeFile"] intValue] == 1) - { - mp4OptsPresent = YES; - MP4Opts = [MP4Opts stringByAppendingString:@" - Large file size"]; - } - if( [[item objectForKey:@"Mp4HttpOptimize"] intValue] == 1) - { - mp4OptsPresent = YES; - MP4Opts = [MP4Opts stringByAppendingString:@" - Web optimized"]; - } - - if( [[item objectForKey:@"Mp4iPodCompatible"] intValue] == 1) - { - mp4OptsPresent = YES; - MP4Opts = [MP4Opts stringByAppendingString:@" - iPod 5G support "]; - } - if (mp4OptsPresent == YES) - { - [finalString appendString: @"MP4 Options: " withAttributes:detailBoldAttr]; - [finalString appendString: MP4Opts withAttributes:detailAttr]; - [finalString appendString:@"\n" withAttributes:detailAttr]; - } + NSString *containerOptions = [NSString stringWithFormat:@"%@", + [item objectForKey:@"MuxerOptionsSummary"]]; + [finalString appendString:@"Container Options: " withAttributes:detailBoldAttr]; + [finalString appendString:containerOptions withAttributes:detailAttr]; + [finalString appendString:@"\n" withAttributes:detailAttr]; } /* Fourth Line (Destination Path)*/ @@ -1148,122 +1089,24 @@ return ![(HBQueueOutlineView*)outlineView isDragging]; [finalString appendString:@"\n" withAttributes:detailAttr]; /* Fifth Line Picture Details*/ - NSString * pictureInfo; - pictureInfo = [NSString stringWithFormat:@"%@", [item objectForKey:@"PictureSizingSummary"]]; + NSString *pictureInfo = [NSString stringWithFormat:@"%@", + [item objectForKey:@"PictureSettingsSummary"]]; if ([[item objectForKey:@"PictureKeepRatio"] intValue] == 1) { pictureInfo = [pictureInfo stringByAppendingString:@" Keep Aspect Ratio"]; } - - [finalString appendString: @"Picture: " withAttributes:detailBoldAttr]; - [finalString appendString: pictureInfo withAttributes:detailAttr]; - [finalString appendString:@"\n" withAttributes:detailAttr]; + [finalString appendString:@"Picture: " withAttributes:detailBoldAttr]; + [finalString appendString:pictureInfo withAttributes:detailAttr]; + [finalString appendString:@"\n" withAttributes:detailAttr]; /* Optional String for Picture Filters */ - NSString * pictureFilters = @""; - BOOL pictureFiltersPresent = NO; - - if( [[item objectForKey:@"PictureDetelecine"] intValue] == 1) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:[NSString stringWithFormat:@" - Detelecine (%@)",[item objectForKey:@"PictureDetelecineCustom"]]]; - } - else if( [[item objectForKey:@"PictureDetelecine"] intValue] == 2) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Detelecine (Default)"]; - } - - if( [[item objectForKey:@"PictureDecombDeinterlace"] intValue] == 1) + if ([[item objectForKey:@"PictureFiltersSummary"] length]) { - if( [[item objectForKey:@"PictureDecomb"] intValue] == 1) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:[NSString stringWithFormat:@" - Decomb (%@)",[item objectForKey:@"PictureDecombCustom"]]]; - } - else if( [[item objectForKey:@"PictureDecomb"] intValue] == 2) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Decomb (Default)"]; - } - else if( [[item objectForKey:@"PictureDecomb"] intValue] == 3) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Decomb (Fast)"]; - } - else if( [[item objectForKey:@"PictureDecomb"] intValue] == 4) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Decomb (Bob)"]; - } - } - else - { - if ([[item objectForKey:@"PictureDeinterlace"] intValue] == 1) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:[NSString stringWithFormat:@" - Deinterlace (%@)",[item objectForKey:@"PictureDeinterlaceCustom"]]]; - } - else if ([[item objectForKey:@"PictureDeinterlace"] intValue] == 2) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Deinterlace (Fast)"]; - } - else if ([[item objectForKey:@"PictureDeinterlace"] intValue] == 3) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Deinterlace (Slow)"]; - } - else if ([[item objectForKey:@"PictureDeinterlace"] intValue] == 4) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Deinterlace (Slower)"]; - } - else if ([[item objectForKey:@"PictureDeinterlace"] intValue] == 5) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Deinterlace (Bob)"]; - } - } - - if ([[item objectForKey:@"PictureDenoise"] intValue] == 1) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:[NSString stringWithFormat:@" - Denoise (%@)",[item objectForKey:@"PictureDenoiseCustom"]]]; - } - else if ([[item objectForKey:@"PictureDenoise"] intValue] == 2) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Denoise (Weak)"]; - } - else if ([[item objectForKey:@"PictureDenoise"] intValue] == 3) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Denoise (Medium)"]; - } - else if ([[item objectForKey:@"PictureDenoise"] intValue] == 4) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Denoise (Strong)"]; - } - - if ([[item objectForKey:@"PictureDeblock"] intValue] != 0) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString: [NSString stringWithFormat:@" - Deblock (pp7) (%d)",[[item objectForKey:@"PictureDeblock"] intValue]]]; - } - - if ([[item objectForKey:@"VideoGrayScale"] intValue] == 1) - { - pictureFiltersPresent = YES; - pictureFilters = [pictureFilters stringByAppendingString:@" - Grayscale"]; - } - - if (pictureFiltersPresent == YES) - { - [finalString appendString: @"Filters: " withAttributes:detailBoldAttr]; - [finalString appendString: pictureFilters withAttributes:detailAttr]; - [finalString appendString:@"\n" withAttributes:detailAttr]; + NSString *pictureFilters = [NSString stringWithFormat:@"%@", + [item objectForKey:@"PictureFiltersSummary"]]; + [finalString appendString:@"Filters: " withAttributes:detailBoldAttr]; + [finalString appendString:pictureFilters withAttributes:detailAttr]; + [finalString appendString:@"\n" withAttributes:detailAttr]; } /* Sixth Line Video Details*/ |