Changeset 13433 for trunk/macosx/QuickLookPlugin/GeneratePreviewForURL.m
- Timestamp:
- Aug 12, 2012, 8:14:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/QuickLookPlugin/GeneratePreviewForURL.m
r13425 r13433 59 59 60 60 const NSUInteger width = 32; 61 [htmlString appendFormat: @"<h2><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\" >%@</h2>", generateIconData(fileTypeString, width, allImgProps), width, width, name];61 [htmlString appendFormat: @"<h2><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\" />%@</h2>", generateIconData(fileTypeString, width, allImgProps), width, width, name]; 62 62 63 63 NSString * fileSizeString = [NSString stringForFileSize: inf.totalSize]; … … 93 93 } 94 94 95 [htmlString appendString: @"<hr/>"];95 NSMutableArray * lists = [NSMutableArray array]; 96 96 97 97 if (inf.webseedCount > 0) 98 98 { 99 [htmlString appendString: @"<br><br><table>"]; 99 NSMutableString * listSection = [NSMutableString string]; 100 [listSection appendString: @"<table>"]; 100 101 101 102 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]]; 102 [ htmlStringappendFormat: @"<tr><th>%@</th></tr>", headerTitleString];103 [listSection appendFormat: @"<tr><th>%@</th></tr>", headerTitleString]; 103 104 104 105 for (int i = 0; i < inf.webseedCount; ++i) 105 [ htmlStringappendFormat: @"<tr><td>%s<td></tr>", inf.webseeds[i]];106 [listSection appendFormat: @"<tr><td>%s<td></tr>", inf.webseeds[i]]; 106 107 107 [htmlString appendString:@"</table>"]; 108 [listSection appendString:@"</table>"]; 109 110 [lists addObject: listSection]; 108 111 } 109 112 110 113 if (inf.trackerCount > 0) 111 114 { 112 [htmlString appendString: @"<br><br><table>"]; 115 NSMutableString * listSection = [NSMutableString string]; 116 [listSection appendString: @"<table>"]; 113 117 114 118 NSString * headerTitleString = inf.trackerCount == 1 ? NSLocalizedString(@"1 Tracker", "quicklook tracker header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Trackers", "quicklook tracker header"), [NSString formattedUInteger: inf.trackerCount]]; 115 [ htmlStringappendFormat: @"<tr><th>%@</th></tr>", headerTitleString];119 [listSection appendFormat: @"<tr><th>%@</th></tr>", headerTitleString]; 116 120 117 121 #warning handle tiers? 118 122 for (int i = 0; i < inf.trackerCount; ++i) 119 [ htmlStringappendFormat: @"<tr><td>%s<td></tr>", inf.trackers[i].announce];123 [listSection appendFormat: @"<tr><td>%s<td></tr>", inf.trackers[i].announce]; 120 124 121 [htmlString appendString:@"</table>"]; 125 [listSection appendString:@"</table>"]; 126 127 [lists addObject: listSection]; 122 128 } 123 129 124 130 if (inf.isMultifile) 125 131 { 126 [htmlString appendString: @"<br><br><table>"]; 132 NSMutableString * listSection = [NSMutableString string]; 133 [listSection appendString: @"<table>"]; 127 134 128 135 NSString * fileTitleString = inf.fileCount == 1 ? NSLocalizedString(@"1 File", "quicklook file header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Files", "quicklook file header"), [NSString formattedUInteger: inf.fileCount]]; 129 [ htmlStringappendFormat: @"<tr><th>%@</th></tr>", fileTitleString];136 [listSection appendFormat: @"<tr><th>%@</th></tr>", fileTitleString]; 130 137 131 138 #warning display size? … … 139 146 140 147 const NSUInteger width = 16; 141 [ htmlString appendFormat: @"<tr><td><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\">%@<td></tr>", generateIconData([shortenedFilePath pathExtension], width, allImgProps), width, width, shortenedFilePath];148 [listSection appendFormat: @"<tr><td><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\" />%@<td></tr>", generateIconData([shortenedFilePath pathExtension], width, allImgProps), width, width, shortenedFilePath]; 142 149 } 143 150 144 [htmlString appendString:@"</table>"]; 151 [listSection appendString:@"</table>"]; 152 153 [lists addObject: listSection]; 145 154 } 155 156 if ([lists count] > 0) 157 [htmlString appendFormat: @"<hr/><br>%@", [lists componentsJoinedByString: @"<br><br>"]]; 146 158 147 159 [htmlString appendString: @"</body></html>"];
Note: See TracChangeset
for help on using the changeset viewer.