diff options
author | Damiano Galassi <[email protected]> | 2019-07-19 21:17:27 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-07-19 21:17:27 +0200 |
commit | 97734fff76d15a2da60f7956d82d463ac7ce6ece (patch) | |
tree | 11d568970a940eea0bb12dd8594773da39c830a4 /macosx/HBJob+UIAdditions.m | |
parent | f7654c69cb5bad5dcdeaa7375e04327c5178d387 (diff) |
MacGui: refactor the queue and implement part of the new queue ui.
Diffstat (limited to 'macosx/HBJob+UIAdditions.m')
-rw-r--r-- | macosx/HBJob+UIAdditions.m | 68 |
1 files changed, 54 insertions, 14 deletions
diff --git a/macosx/HBJob+UIAdditions.m b/macosx/HBJob+UIAdditions.m index 4f711bacb..28c7edfe5 100644 --- a/macosx/HBJob+UIAdditions.m +++ b/macosx/HBJob+UIAdditions.m @@ -119,13 +119,8 @@ static NSDictionary *shortHeightAttr; } } -- (NSAttributedString *)titleAttributedDescription +- (NSString *)rangeDescription { - NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] init]; - - // Job name - [attrString appendString:self.description withAttributes:titleAttr]; - // Range type NSString *startStopString = @""; if (self.range.type == HBRangeTypeChapters) @@ -163,16 +158,37 @@ static NSDictionary *shortHeightAttr; if (passesString.length) { - [attrString appendString:[NSString stringWithFormat:HBKitLocalizedString(@" (Title %d, %@, %@) ▸ %@\n", @"Title description"), - self.titleIdx, startStopString, passesString, self.outputFileName] - withAttributes:detailAttr]; + return [NSString stringWithFormat:HBKitLocalizedString(@"Title %d, %@, %@", @"Title description"), + self.titleIdx, startStopString, passesString]; } else { - [attrString appendString:[NSString stringWithFormat:HBKitLocalizedString(@" (Title %d, %@) ▸ %@\n", @"Title description"), - self.titleIdx, startStopString, self.outputFileName] - withAttributes:detailAttr]; + return [NSString stringWithFormat:HBKitLocalizedString(@"Title %d, %@", @"Title description"), + self.titleIdx, startStopString]; } +} + +- (NSAttributedString *)rangeAttributedDescription +{ + NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] init]; + + [attrString appendString:@"\t" withAttributes:detailAttr]; + [attrString appendString:HBKitLocalizedString(@"Range:", @"Range description") withAttributes:detailBoldAttr]; + [attrString appendString:@" \t" withAttributes:detailAttr]; + [attrString appendString:self.rangeDescription withAttributes:detailAttr]; + [attrString appendString:@"\n" withAttributes:detailAttr]; + + return attrString; +} +- (NSAttributedString *)titleAttributedDescription +{ + NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] init]; + + // Job name + [attrString appendString:self.description withAttributes:titleAttr]; + + [attrString appendString:[NSString stringWithFormat:@" (%@) ▸ %@\n", [self rangeDescription], self.outputFileName] + withAttributes:detailAttr]; return attrString; } @@ -231,6 +247,19 @@ static NSDictionary *shortHeightAttr; return attrString; } +- (NSAttributedString *)sourceAttributedDescription +{ + NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] init]; + + [attrString appendString:@"\t" withAttributes:detailAttr]; + [attrString appendString:HBKitLocalizedString(@"Source:", @"Source description") withAttributes:detailBoldAttr]; + [attrString appendString:@" \t" withAttributes:detailAttr]; + [attrString appendString:self.fileURL.path withAttributes:detailAttr]; + [attrString appendString:@"\n" withAttributes:detailAttr]; + + return attrString; +} + - (NSAttributedString *)destinationAttributedDescription { NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] init]; @@ -629,21 +658,31 @@ static NSDictionary *shortHeightAttr; @autoreleasepool { - [attrString appendAttributedString:[self titleAttributedDescription]]; [attrString appendAttributedString:[self presetAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; + [attrString appendAttributedString:[self sourceAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; + [attrString appendAttributedString:[self destinationAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; [attrString appendAttributedString:[self formatAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; + [attrString appendAttributedString:[self rangeAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; [attrString appendAttributedString:[self dimensionsAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; [attrString appendAttributedString:[self filtersAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; [attrString appendAttributedString:[self videoAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; if (self.audio.countOfTracks > 1) { [attrString appendAttributedString:[self audioAttributedDescription]]; + [attrString appendString:@"\n" withAttributes: detailAttr]; } if (self.subtitles.countOfTracks > 1) { [attrString appendAttributedString:[self subtitlesAttributedDescription]]; } - [attrString appendAttributedString:[self destinationAttributedDescription]]; } [attrString deleteCharactersInRange:NSMakeRange(attrString.length - 1, 1)]; @@ -651,6 +690,7 @@ static NSDictionary *shortHeightAttr; return attrString; } + #pragma mark - Short descriptions - (NSString *)videoShortDescription |