1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-22 06:00:41 +00:00

quicklook: alternate row background color (#5216)

This commit is contained in:
Cœur 2023-04-16 00:07:03 +02:00 committed by GitHub
parent ca392ba5da
commit e2c3eb50a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 7 deletions

View file

@ -149,7 +149,7 @@ OSStatus GeneratePreviewForURL(void* thisInterface, QLPreviewRequestRef preview,
for (size_t i = 0; i < n_webseeds; ++i)
{
[listSection appendFormat:@"<tr><td>%s<td></tr>", metainfo.webseed(i).c_str()];
[listSection appendFormat:@"<tr><td>%s</td></tr>", metainfo.webseed(i).c_str()];
}
[listSection appendString:@"</table>"];
@ -169,10 +169,10 @@ OSStatus GeneratePreviewForURL(void* thisInterface, QLPreviewRequestRef preview,
[NSString localizedStringWithFormat:NSLocalizedStringFromTableInBundle(@"%lu Trackers", nil, bundle, "quicklook tracker header"), n];
[listSection appendFormat:@"<tr><th>%@</th></tr>", headerTitleString];
#warning handle tiers?
// TODO: handle tiers?
for (auto const& tracker : announce_list)
{
[listSection appendFormat:@"<tr><td>%s<td></tr>", tracker.announce.c_str()];
[listSection appendFormat:@"<tr><td>%s</td></tr>", tracker.announce.c_str()];
}
[listSection appendString:@"</table>"];
@ -196,15 +196,15 @@ OSStatus GeneratePreviewForURL(void* thisInterface, QLPreviewRequestRef preview,
NSCAssert([fullFilePath hasPrefix:[name stringByAppendingString:@"/"]], @"Expected file path %@ to begin with %@/", fullFilePath, name);
NSString* shortenedFilePath = [fullFilePath substringFromIndex:name.length + 1];
NSString* shortenedFilePathAndSize = [NSString
stringWithFormat:@"%@ - %@", shortenedFilePath, [NSString stringForFileSize:size]];
NSString* fileSize = [NSString stringForFileSize:size];
NSUInteger const width = 16;
[listSection appendFormat:@"<tr><td><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\" />%@<td></tr>",
[listSection appendFormat:@"<tr><td><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\" />%@</td><td class=\"grey\">%@</td></tr>",
generateIconData(shortenedFilePath.pathExtension, width, allImgProps),
width,
width,
shortenedFilePathAndSize];
shortenedFilePath,
fileSize];
}
[listSection appendString:@"</table>"];

View file

@ -4,16 +4,36 @@ html {
text-align: left;
}
table {
width: 100%;
border-spacing: 0;
}
th {
color: rgb(50,50,50);
font-weight: bold;
text-align: left;
}
tr:nth-child(even) {
background: rgb(244,245,245);
}
tr:nth-child(even) td:first-child {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
tr:nth-child(even) td:last-child {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
td {
color: rgb(80,80,80);
text-align: left;
}
td.grey {
color: rgb(133,133,133);
}
img.icon {
margin-right: 8px;