summaryrefslogtreecommitdiff
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
parentf6fffad08b0ef0709f8c897cef74ca822d80d802 (diff)
downloadpcsxr-3584a7617b8f43d3622381ea76b4542911d38a5e.tar.gz
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
-rw-r--r--macosx/Pcsxr-QL/GeneratePreviewForURL.m15
-rw-r--r--macosx/Pcsxr-QL/Style.css5
-rw-r--r--macosx/Pcsxr-QL/template.html19
-rw-r--r--macosx/Pcsxr.xcodeproj/project.pbxproj8
4 files changed, 30 insertions, 17 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
diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj
index 598a1b9b..3e80b2b9 100644
--- a/macosx/Pcsxr.xcodeproj/project.pbxproj
+++ b/macosx/Pcsxr.xcodeproj/project.pbxproj
@@ -194,7 +194,7 @@
556C37AB197C9C59001A4265 /* PcsxrMemoryObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 55A90228147D89380037E18F /* PcsxrMemoryObject.m */; };
556C37AD197D94C8001A4265 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 554FD70817C6A13E0056CF66 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
556C37AE197D94D6001A4265 /* libSPUSharedCode.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 551A76E71786971B0052D185 /* libSPUSharedCode.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
- 556C37B0197DB3CB001A4265 /* Style.css in Resources */ = {isa = PBXBuildFile; fileRef = 556C37AF197DB3CB001A4265 /* Style.css */; };
+ 556C37B2197DBFD1001A4265 /* template.html in Resources */ = {isa = PBXBuildFile; fileRef = 556C37B1197DBFD1001A4265 /* template.html */; };
5581463917AABCD100862DBF /* PcsxrCheatHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 5581463817AABCD100862DBF /* PcsxrCheatHandler.m */; };
559366CA12B694DF004ACC1E /* iR3000A-64.c in Sources */ = {isa = PBXBuildFile; fileRef = 559366C112B694DF004ACC1E /* iR3000A-64.c */; };
559366CB12B694DF004ACC1E /* ix86-64.c in Sources */ = {isa = PBXBuildFile; fileRef = 559366C212B694DF004ACC1E /* ix86-64.c */; };
@@ -717,7 +717,7 @@
5569B0C1182F0BE100991C9C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/NetPcsxrHIDInputPluginMain.strings; sourceTree = "<group>"; };
556C37A8197C815C001A4265 /* PSXMemEnumerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSXMemEnumerator.m; sourceTree = "<group>"; };
556C37AA197C81F9001A4265 /* PSXMemEnumerator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PSXMemEnumerator.h; sourceTree = "<group>"; };
- 556C37AF197DB3CB001A4265 /* Style.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = Style.css; sourceTree = "<group>"; };
+ 556C37B1197DBFD1001A4265 /* template.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = template.html; sourceTree = "<group>"; };
55707E8E18123579007CC5D0 /* hu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = "<group>"; };
55707E901812357B007CC5D0 /* hu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = "<group>"; };
55707E921812357D007CC5D0 /* hu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -1168,7 +1168,7 @@
550E343F18E6293D00A1AD21 /* Pcsxr-QL-Info.plist */,
550E344018E6293D00A1AD21 /* InfoPlist.strings */,
550E344918E6293D00A1AD21 /* Pcsxr-QL-Prefix.pch */,
- 556C37AF197DB3CB001A4265 /* Style.css */,
+ 556C37B1197DBFD1001A4265 /* template.html */,
);
name = "Supporting Files";
sourceTree = "<group>";
@@ -2111,7 +2111,7 @@
buildActionMask = 2147483647;
files = (
550E344218E6293D00A1AD21 /* InfoPlist.strings in Resources */,
- 556C37B0197DB3CB001A4265 /* Style.css in Resources */,
+ 556C37B2197DBFD1001A4265 /* template.html in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};