forked from anthonygelibert/QLColorCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeneratePreviewForURL.m
More file actions
34 lines (25 loc) · 1.2 KB
/
GeneratePreviewForURL.m
File metadata and controls
34 lines (25 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@import Cocoa;
@import CoreFoundation;
@import QuickLook;
#import "Common.h"
OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options);
void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview);
/* -----------------------------------------------------------------------------
Generate a preview for file
This function's job is to create preview for designated file
----------------------------------------------------------------------------- */
OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options)
{
CFBundleRef bundle = QLPreviewRequestGetGeneratorBundle(preview);
int status;
CFDataRef data = (__bridge CFDataRef) colorizeURL(bundle, url, &status, 0);
if (data) {
CFDictionaryRef props = (__bridge CFDictionaryRef) [NSDictionary dictionary];
QLPreviewRequestSetDataRepresentation(preview, data, kUTTypeHTML, props);
}
return noErr;
}
void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview)
{
// Implement only if supported
}