diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-07-21 21:12:28 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-07-21 21:12:28 +0000 |
| commit | f6fffad08b0ef0709f8c897cef74ca822d80d802 (patch) | |
| tree | 740d07465113d7494a10728d758775605a89f392 /macosx/Pcsxr-QL | |
| parent | 0a350e09575dda4ad7c5bb21c5fe5edc659f1d59 (diff) | |
| download | pcsxr-f6fffad08b0ef0709f8c897cef74ca822d80d802.tar.gz | |
OS X: more improvements to the QuickLook plug-in.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@91020 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/Pcsxr-QL')
| -rw-r--r-- | macosx/Pcsxr-QL/GeneratePreviewForURL.m | 21 | ||||
| -rw-r--r-- | macosx/Pcsxr-QL/GenerateThumbnailForURL.m | 4 | ||||
| -rw-r--r-- | macosx/Pcsxr-QL/Style.css | 5 | ||||
| -rw-r--r-- | macosx/Pcsxr-QL/en.lproj/InfoPlist.strings | 1 |
4 files changed, 26 insertions, 5 deletions
diff --git a/macosx/Pcsxr-QL/GeneratePreviewForURL.m b/macosx/Pcsxr-QL/GeneratePreviewForURL.m index 24031a1c..afb150d7 100644 --- a/macosx/Pcsxr-QL/GeneratePreviewForURL.m +++ b/macosx/Pcsxr-QL/GeneratePreviewForURL.m @@ -77,15 +77,26 @@ OSStatus GeneratePreviewForFreeze(void *thisInterface, QLPreviewRequestRef previ free(pMem); return noErr; #else - return unimpErr; + return noErr; #endif } static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestRef preview, NSURL *url, NSDictionary *options) { NSArray *memCards = CreateArrayByEnumeratingMemoryCardAtURL(url); + + if (!memCards) { + return noErr; + } + NSMutableString *htmlStr = [[NSMutableString alloc] initWithCapacity:memCards.count * 200]; NSMutableDictionary *htmlDict = [[NSMutableDictionary alloc] initWithCapacity:memCards.count]; + NSBundle *Bundle; + { + CFBundleRef cfbundle = QLPreviewRequestGetGeneratorBundle(preview); + NSURL *bundURL = CFBridgingRelease(CFBundleCopyBundleURL(cfbundle)); + Bundle = [NSBundle bundleWithURL:bundURL]; + } int i; for (PcsxrMemoryObject *obj in memCards) { NSImage *theImage = [obj firstMemImage]; @@ -95,11 +106,15 @@ static OSStatus GeneratePreviewForMemCard(void *thisInterface, QLPreviewRequestR NSDictionary *imgProps = @{(NSString *)kQLPreviewPropertyAttachmentDataKey: pngData, (NSString *)kQLPreviewPropertyMIMETypeKey: @"image/png"}; NSString *imgName = [[@(i++) stringValue] stringByAppendingPathComponent:@"png"]; - [htmlStr appendFormat:@"<tr><td><img src=\"cid:%@\"></td><td>%@</td><td>%i</td></tr>\n", imgName, obj.sjisName, obj.blockSize]; + [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; } - NSString *theStr = [[NSString alloc] initWithFormat:@"<html>\n<body>\n<table>\n<tr><td ALIGN=center>Image</td><td ALIGN=name>Image</td><td ALIGN=center>Count</td></tr>%@\n</table>\n</body>\n</html>", htmlStr]; + NSURL *cssURL = [Bundle URLForResource:@"Style" withExtension:@"css"]; + + NSString *attributeStr = [[NSString alloc] initWithContentsOfURL:cssURL encoding:NSUTF8StringEncoding error:NULL]; + + 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]; NSDictionary *previewDict = diff --git a/macosx/Pcsxr-QL/GenerateThumbnailForURL.m b/macosx/Pcsxr-QL/GenerateThumbnailForURL.m index 44830fbd..2e84f4a6 100644 --- a/macosx/Pcsxr-QL/GenerateThumbnailForURL.m +++ b/macosx/Pcsxr-QL/GenerateThumbnailForURL.m @@ -88,12 +88,12 @@ OSStatus GenerateThumbnailForFreeze(void *thisInterface, QLThumbnailRequestRef t } return noErr; #else - return unimpErr; + return noErr; #endif } OSStatus GenerateThumbnailForMemCard(void *thisInterface, QLThumbnailRequestRef thumbnail, NSURL *url, NSDictionary *options, CGSize maxSize) { //NSArray *memCards = CreateArrayByEnumeratingMemoryCardAtURL(url); - return unimpErr; + return noErr; } diff --git a/macosx/Pcsxr-QL/Style.css b/macosx/Pcsxr-QL/Style.css new file mode 100644 index 00000000..e7f99748 --- /dev/null +++ b/macosx/Pcsxr-QL/Style.css @@ -0,0 +1,5 @@ +table,th,td +{ + border:1px solid black; + width:400px; +} diff --git a/macosx/Pcsxr-QL/en.lproj/InfoPlist.strings b/macosx/Pcsxr-QL/en.lproj/InfoPlist.strings index 477b28ff..1de7259d 100644 --- a/macosx/Pcsxr-QL/en.lproj/InfoPlist.strings +++ b/macosx/Pcsxr-QL/en.lproj/InfoPlist.strings @@ -1,2 +1,3 @@ /* Localized versions of Info.plist keys */ +NSHumanReadableCopyright = "Copyright © 2014 Pcsx Reloaded team"; |
