summaryrefslogtreecommitdiff
path: root/macosx/Pcsxr-QL
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-07-21 21:54:30 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-07-21 21:54:30 +0000
commit3584a7617b8f43d3622381ea76b4542911d38a5e (patch)
tree268790a6387ae5e02f1625e856379fcc0f20948a /macosx/Pcsxr-QL
parentf6fffad08b0ef0709f8c897cef74ca822d80d802 (diff)
OS X: trim down how much HTML code is in the SpotLight importer.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@91022 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/Pcsxr-QL')
-rw-r--r--macosx/Pcsxr-QL/GeneratePreviewForURL.m15
-rw-r--r--macosx/Pcsxr-QL/Style.css5
-rw-r--r--macosx/Pcsxr-QL/template.html19
3 files changed, 26 insertions, 13 deletions
diff --git a/macosx/Pcsxr-QL/GeneratePreviewForURL.m b/macosx/Pcsxr-QL/GeneratePreviewForURL.m
index afb150d7..89ad191e 100644
--- a/macosx/Pcsxr-QL/GeneratePreviewForURL.m
+++ b/macosx/Pcsxr-QL/GeneratePreviewForURL.m
@@ -95,9 +95,9 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR
{
CFBundleRef cfbundle = QLPreviewRequestGetGeneratorBundle(preview);
NSURL *bundURL = CFBridgingRelease(CFBundleCopyBundleURL(cfbundle));
- Bundle = [NSBundle bundleWithURL:bundURL];
+ Bundle = [[NSBundle alloc] initWithURL:bundURL];
}
- int i;
+ int i = 0;
for (PcsxrMemoryObject *obj in memCards) {
NSImage *theImage = [obj firstMemImage];
NSData *tiffData = [theImage TIFFRepresentation];
@@ -105,18 +105,17 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR
NSData *pngData = [bmImg representationUsingType:NSPNGFileType properties:nil];
NSDictionary *imgProps = @{(NSString *)kQLPreviewPropertyAttachmentDataKey: pngData,
(NSString *)kQLPreviewPropertyMIMETypeKey: @"image/png"};
- NSString *imgName = [[@(i++) stringValue] stringByAppendingPathComponent:@"png"];
+ NSString *imgName = [[@(i++) stringValue] stringByAppendingPathExtension:@"png"];
[htmlStr appendFormat:@"\t\t\t<tr><td><img src=\"cid:%@\"></td> <td>%@</td> <td>%i</td></tr>\n", imgName, obj.sjisName, obj.blockSize];
htmlDict[imgName] = imgProps;
}
- NSURL *cssURL = [Bundle URLForResource:@"Style" withExtension:@"css"];
+ NSURL *cssURL = [Bundle URLForResource:@"template" withExtension:@"html"];
- NSString *attributeStr = [[NSString alloc] initWithContentsOfURL:cssURL encoding:NSUTF8StringEncoding error:NULL];
+ NSMutableString *attributeStr = [[NSMutableString alloc] initWithContentsOfURL:cssURL encoding:NSUTF8StringEncoding error:NULL];
+ [attributeStr replaceOccurrencesOfString:@"(TABLECONTENT)" withString:htmlStr options:NSLiteralSearch range:NSMakeRange(0, [attributeStr length])];
- NSString *theStr = [[NSString alloc] initWithFormat:@"<html>\n\t<body>\n<style>\n%@</style>\n\t\t\t<table>\n<tr> <td ALIGN=center>Image</td> <td ALIGN=center>Name</td> <td ALIGN=center>Count</td> </tr>\n%@\n</table>\n\t</body>\n</html>", attributeStr ? attributeStr : @"", htmlStr];
-
- NSData *data = [theStr dataUsingEncoding:NSUTF8StringEncoding];
+ NSData *data = [attributeStr dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *previewDict =
@{(NSString *)kQLPreviewPropertyAttachmentsKey: htmlDict,
(NSString *)kQLPreviewPropertyDisplayNameKey: [url lastPathComponent],
diff --git a/macosx/Pcsxr-QL/Style.css b/macosx/Pcsxr-QL/Style.css
deleted file mode 100644
index e7f99748..00000000
--- a/macosx/Pcsxr-QL/Style.css
+++ /dev/null
@@ -1,5 +0,0 @@
-table,th,td
-{
- border:1px solid black;
- width:400px;
-}
diff --git a/macosx/Pcsxr-QL/template.html b/macosx/Pcsxr-QL/template.html
new file mode 100644
index 00000000..b0fa812c
--- /dev/null
+++ b/macosx/Pcsxr-QL/template.html
@@ -0,0 +1,19 @@
+<html>
+ <head>
+ <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
+
+ <style>
+ table,th,td
+ {
+ border:1px solid black;
+ width:400px;
+ }
+ </style>
+ </head>
+ <body>
+ <table>
+ <tr> <td ALIGN=center>Image</td> <td ALIGN=center>Name</td> <td ALIGN=center>Count</td> </tr>
+(TABLECONTENT)
+ </table>
+ </body>
+</html> \ No newline at end of file