From: Mitchell Livingston Date: Sun, 12 Aug 2012 20:14:26 +0000 (+0000) Subject: better spacing of the file/tracker/webseed list in Quick Look X-Git-Tag: 2.70~101 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0f60662945ffaee7aff15c8d47f5e12d5c5a71c6;p=transmission better spacing of the file/tracker/webseed list in Quick Look --- diff --git a/macosx/QuickLookPlugin/GeneratePreviewForURL.m b/macosx/QuickLookPlugin/GeneratePreviewForURL.m index 1bb30124c..75cca38bd 100644 --- a/macosx/QuickLookPlugin/GeneratePreviewForURL.m +++ b/macosx/QuickLookPlugin/GeneratePreviewForURL.m @@ -58,7 +58,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, NSString * fileTypeString = inf.isMultifile ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [name pathExtension]; const NSUInteger width = 32; - [htmlString appendFormat: @"

%@

", generateIconData(fileTypeString, width, allImgProps), width, width, name]; + [htmlString appendFormat: @"

%@

", generateIconData(fileTypeString, width, allImgProps), width, width, name]; NSString * fileSizeString = [NSString stringForFileSize: inf.totalSize]; if (inf.isMultifile) @@ -92,41 +92,48 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, [htmlString appendFormat: @"

%@

", comment]; } - [htmlString appendString: @"
"]; + NSMutableArray * lists = [NSMutableArray array]; if (inf.webseedCount > 0) { - [htmlString appendString: @"

"]; + NSMutableString * listSection = [NSMutableString string]; + [listSection appendString: @"
"]; NSString * headerTitleString = inf.webseedCount == 1 ? NSLocalizedString(@"1 Web Seed", "quicklook web seed header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Web Seeds", "quicklook web seed header"), [NSString formattedUInteger: inf.webseedCount]]; - [htmlString appendFormat: @"", headerTitleString]; + [listSection appendFormat: @"", headerTitleString]; for (int i = 0; i < inf.webseedCount; ++i) - [htmlString appendFormat: @"", inf.webseeds[i]]; + [listSection appendFormat: @"", inf.webseeds[i]]; - [htmlString appendString:@"
%@
%@
%s
%s
"]; + [listSection appendString:@""]; + + [lists addObject: listSection]; } if (inf.trackerCount > 0) { - [htmlString appendString: @"

"]; + NSMutableString * listSection = [NSMutableString string]; + [listSection appendString: @"
"]; NSString * headerTitleString = inf.trackerCount == 1 ? NSLocalizedString(@"1 Tracker", "quicklook tracker header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Trackers", "quicklook tracker header"), [NSString formattedUInteger: inf.trackerCount]]; - [htmlString appendFormat: @"", headerTitleString]; + [listSection appendFormat: @"", headerTitleString]; #warning handle tiers? for (int i = 0; i < inf.trackerCount; ++i) - [htmlString appendFormat: @"", inf.trackers[i].announce]; + [listSection appendFormat: @"", inf.trackers[i].announce]; + + [listSection appendString:@"
%@
%@
%s
%s
"]; - [htmlString appendString:@""]; + [lists addObject: listSection]; } if (inf.isMultifile) { - [htmlString appendString: @"

"]; + NSMutableString * listSection = [NSMutableString string]; + [listSection appendString: @"
"]; NSString * fileTitleString = inf.fileCount == 1 ? NSLocalizedString(@"1 File", "quicklook file header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Files", "quicklook file header"), [NSString formattedUInteger: inf.fileCount]]; - [htmlString appendFormat: @"", fileTitleString]; + [listSection appendFormat: @"", fileTitleString]; #warning display size? #warning display folders? @@ -138,12 +145,17 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, NSString * shortenedFilePath = [fullFilePath substringFromIndex: [name length]+1]; const NSUInteger width = 16; - [htmlString appendFormat: @"", generateIconData([shortenedFilePath pathExtension], width, allImgProps), width, width, shortenedFilePath]; + [listSection appendFormat: @"", generateIconData([shortenedFilePath pathExtension], width, allImgProps), width, width, shortenedFilePath]; } - [htmlString appendString:@"
%@
%@
%@
%@
"]; + [listSection appendString:@""]; + + [lists addObject: listSection]; } + if ([lists count] > 0) + [htmlString appendFormat: @"

%@", [lists componentsJoinedByString: @"

"]]; + [htmlString appendString: @""]; tr_metainfoFree(&inf); diff --git a/macosx/QuickLookPlugin/style.css b/macosx/QuickLookPlugin/style.css index 12e33444e..508863ac5 100644 --- a/macosx/QuickLookPlugin/style.css +++ b/macosx/QuickLookPlugin/style.css @@ -8,7 +8,7 @@ th { color: rgb(50,50,50); font-weight: bold; - text-align:left; + text-align:left; } td {