Check-in [1f66c40b78]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:1f66c40b7857081b55e01f0a7cd1be7e7b68e6b2
Date: 2009-10-27 01:37:21
User: dmitry
Comment:Initial commit
Tags And Properties
Changes

Added English.lproj/InfoPlist.strings

cannot compute difference between binary files

Old () New (06716aff1b38d7f4)

Added GeneratePreviewForURL.m

Old () New (26f6a2542d64dd3b)
> 1 #import <QuickLook/QuickLook.h>
> 2 #import <Foundation/Foundation.h>
> 3 #import "TimelineGenerator.h"
> 4
> 5 /* -----------------------------------------------------------------------------
> 6 Generate a preview for file
> 7
> 8 This function's job is to create preview for designated file
> 9 ----------------------------------------------------------------------------- */
> 10
> 11
> 12 OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
> 13 CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options)
> 14 {
> 15 if (QLPreviewRequestIsCancelled(preview))
> 16 return noErr;
> 17
> 18 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> 19
> 20 NSString *html = HTMLTimelineForDatabase(
> 21 [[(NSURL*)url path] fileSystemRepresentation]);
> 22
> 23 if (!html || [html isEqualToString:@""])
> 24 goto out;
> 25
> 26 CFDictionaryRef properties =
> 27 (CFDictionaryRef)[NSDictionary dictionaryWithObject:@"UTF-8"
> 28 forKey:(NSString *)kQLPreviewPropertyTextEncodingNameKey];
> 29
> 30 QLPreviewRequestSetDataRepresentation(preview,
> 31 (CFDataRef)[html dataUsingEncoding:NSUTF8StringEncoding],
> 32 kUTTypeHTML,
> 33 properties);
> 34 out:
> 35 [pool release];
> 36 return noErr;
> 37 }
> 38
> 39 void CancelPreviewGeneration(void* thisInterface, QLPreviewRequestRef preview)
> 40 {
> 41 // implement only if supported
> 42 }

Added GenerateThumbnailForURL.m

Old () New (59429ffa006ee0b0)
> 1 #import <QuickLook/QuickLook.h>
> 2 #import <Foundation/Foundation.h>
> 3 #import <WebKit/WebKit.h>
> 4 #import <AppKit/AppKit.h>
> 5 #import "TimelineGenerator.h"
> 6
> 7 /* -----------------------------------------------------------------------------
> 8 Generate a thumbnail for file
> 9
> 10 This function's job is to create thumbnail for designated file as fast as possible
> 11 ----------------------------------------------------------------------------- */
> 12
> 13 OSStatus GenerateThumbnailForURL(void *thisInterface,
> 14 QLThumbnailRequestRef thumbnail,
> 15 CFURLRef url, CFStringRef contentTypeUTI,
> 16 CFDictionaryRef options, CGSize maxSize)
> 17 {
> 18 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> 19
> 20
> 21 // Use webkit render
> 22
> 23 NSMutableString *html = HTMLTimelineForDatabase(
> 24 [[(NSURL*)url path] fileSystemRepresentation]);
> 25 [html appendString:@"<div style='font-size: 120px; position: absolute; "
> 26 " bottom: 0; background: white; width: 100%; color: #555;"
> 27 " font-weight: bold; "
> 28 " text-align: center; padding: 30px 0'>FOSSIL</div>"];
> 29
> 30
> 31 NSRect webKitRect = NSMakeRect(0.0, 0.0, 600.0, 800.0);
> 32 CGSize thumbSize = NSSizeToCGSize(NSMakeSize(maxSize.width * (600.0/800.0),
> 33 maxSize.height));
> 34 float scale = maxSize.height / 800.0;
> 35 NSSize scaleSize = NSMakeSize(scale, scale);
> 36
> 37 WebView* webView = [[WebView alloc] initWithFrame:webKitRect];
> 38 [webView scaleUnitSquareToSize:scaleSize];
> 39 [[[webView mainFrame] frameView] setAllowsScrolling:NO];
> 40
> 41 [[webView mainFrame] loadData:[html dataUsingEncoding:NSUTF8StringEncoding]
> 42 MIMEType:@"text/html"
> 43 textEncodingName:@"UTF-8" baseURL:nil];
> 44
> 45 while([webView isLoading]) {
> 46 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);
> 47 }
> 48
> 49 // Get a context to render into
> 50 CGContextRef cgContext =
> 51 QLThumbnailRequestCreateContext(thumbnail, thumbSize, false, NULL);
> 52 NSGraphicsContext* context =
> 53 [NSGraphicsContext graphicsContextWithGraphicsPort:(void *)cgContext
> 54 flipped:[webView isFlipped]];
> 55
> 56 [webView displayRectIgnoringOpacity:[webView bounds] inContext:context];
> 57
> 58 QLThumbnailRequestFlushContext(thumbnail, cgContext);
> 59
> 60 CFRelease(cgContext);
> 61
> 62 // Or just fossil image: (put fossil.png into Resources)
> 63 /*
> 64 CFBundleRef bundle = QLThumbnailRequestGetGeneratorBundle(thumbnail);
> 65 CFURLRef imageUrl = CFBundleCopyResourceURL(bundle, CFSTR("fossil"), CFSTR("eps"), NULL);
> 66 //NSData *data = [NSData dataWithContentsOfURL:(NSURL *)imageUrl];
> 67 NSImage *image = [[NSImage alloc] initWithContentsOfURL:(NSURL *)imageUrl];
> 68 [image setSize:NSMakeSize(maxSize.width, maxSize.height)];
> 69 QLThumbnailRequestSetImageWithData(thumbnail, (CFDataRef)[image TIFFRepresentation], nil);
> 70
> 71 CFRelease(bundle);
> 72 CFRelease(url);
> 73 */
> 74
> 75 [pool release];
> 76 return noErr;
> 77 }
> 78
> 79 void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail)
> 80 {
> 81 // implement only if supported
> 82 }

Added Info.plist

Old () New (8a2025adb733a128)
> 1 <?xml version="1.0" encoding="UTF-8"?>
> 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> 3 <plist version="1.0">
> 4 <dict>
> 5 <key>CFBundleDevelopmentRegion</key>
> 6 <string>English</string>
> 7 <key>CFBundleDocumentTypes</key>
> 8 <array>
> 9 <dict>
> 10 <key>CFBundleTypeRole</key>
> 11 <string>QLGenerator</string>
> 12 <key>LSItemContentTypes</key>
> 13 <array>
> 14 <string>org.fossil-scm.repository</string>
> 15 </array>
> 16 </dict>
> 17 </array>
> 18 <key>CFBundleExecutable</key>
> 19 <string>${EXECUTABLE_NAME}</string>
> 20 <key>CFBundleIconFile</key>
> 21 <string></string>
> 22 <key>CFBundleIdentifier</key>
> 23 <string>com.codingrobots.qlgenerator.${PRODUCT_NAME:identifier}</string>
> 24 <key>CFBundleInfoDictionaryVersion</key>
> 25 <string>6.0</string>
> 26 <key>CFBundleName</key>
> 27 <string>${PRODUCT_NAME}</string>
> 28 <key>CFBundleShortVersionString</key>
> 29 <string>1</string>
> 30 <key>CFBundleVersion</key>
> 31 <string>1.0</string>
> 32 <key>CFPlugInDynamicRegisterFunction</key>
> 33 <string></string>
> 34 <key>CFPlugInDynamicRegistration</key>
> 35 <string>NO</string>
> 36 <key>CFPlugInFactories</key>
> 37 <dict>
> 38 <key>67802A85-35C8-4172-8A41-292CF62BD74B</key>
> 39 <string>QuickLookGeneratorPluginFactory</string>
> 40 </dict>
> 41 <key>CFPlugInTypes</key>
> 42 <dict>
> 43 <key>5E2D9680-5022-40FA-B806-43349622E5B9</key>
> 44 <array>
> 45 <string>67802A85-35C8-4172-8A41-292CF62BD74B</string>
> 46 </array>
> 47 </dict>
> 48 <key>CFPlugInUnloadFunction</key>
> 49 <string></string>
> 50 <key>QLNeedsToBeRunInMainThread</key>
> 51 <true/>
> 52 <key>QLPreviewHeight</key>
> 53 <integer>800</integer>
> 54 <key>QLPreviewWidth</key>
> 55 <real>600</real>
> 56 <key>QLSupportsConcurrentRequests</key>
> 57 <false/>
> 58 <key>QLThumbnailMinimumSize</key>
> 59 <real>17</real>
> 60 <key>UTImportedTypeDeclarations</key>
> 61 <array>
> 62 <dict>
> 63 <key>UTTypeIdentifier</key>
> 64 <string>org.fossil-scm.repository</string>
> 65 <key>UTTypeReferenceURL</key>
> 66 <string>http://www.fossil-scm.org/</string>
> 67 <key>UTTypeDescription</key>
> 68 <string>Fossil Repository</string>
> 69 <key>UTTypeConformsTo</key>
> 70 <array>
> 71 <string>public.data</string>
> 72 </array>
> 73 <key>UTTypeTagSpecification</key>
> 74 <dict>
> 75 <key>public.filename-extension</key>
> 76 <array>
> 77 <string>fossil</string>
> 78 <string>fsl</string>
> 79 </array>
> 80 </dict>
> 81 </dict>
> 82 </array>
> 83 </dict>
> 84 </plist>

Added QLFossil.xcodeproj/project.pbxproj

Old () New (1c045f9b2381f99e)
> 1 // !$*UTF8*$!
> 2 {
> 3 archiveVersion = 1;
> 4 classes = {
> 5 };
> 6 objectVersion = 45;
> 7 objects = {
> 8
> 9 /* Begin PBXBuildFile section */
> 10 0A6EDCD51096537F0057314A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A6EDCD41096537F0057314A /* Foundation.framework */; };
> 11 0A6EDD7B109654B20057314A /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A6EDD7A109654B20057314A /* libsqlite3.dylib */; };
> 12 0A6EDDAC109657800057314A /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A6EDDAB109657800057314A /* AppKit.framework */; };
> 13 0AE04F6E10966B31000FDF7D /* TimelineGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AE04F6C10966B31000FDF7D /* TimelineGenerator.h */; };
> 14 0AE04F6F10966B31000FDF7D /* TimelineGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AE04F6D10966B31000FDF7D /* TimelineGenerator.m */; };
> 15 0AE04F7B10966C36000FDF7D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AE04F7A10966C36000FDF7D /* WebKit.framework */; };
> 16 2C05A19C06CAA52B00D84F6F /* GeneratePreviewForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C05A19B06CAA52B00D84F6F /* GeneratePreviewForURL.m */; };
> 17 61E3BCFB0870B4F2002186A0 /* GenerateThumbnailForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 61E3BCFA0870B4F2002186A0 /* GenerateThumbnailForURL.m */; };
> 18 8D576312048677EA00EA77CD /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB77B6FE84183AC02AAC07 /* main.c */; settings = {ATTRIBUTES = (); }; };
> 19 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; };
> 20 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
> 21 C86B05270671AA6E00DD9006 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C86B05260671AA6E00DD9006 /* CoreServices.framework */; };
> 22 F28CFBFD0A3EC0AF000ABFF5 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F28CFBFC0A3EC0AF000ABFF5 /* ApplicationServices.framework */; };
> 23 F28CFC030A3EC0C6000ABFF5 /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F28CFC020A3EC0C6000ABFF5 /* QuickLook.framework */; };
> 24 /* End PBXBuildFile section */
> 25
> 26 /* Begin PBXFileReference section */
> 27 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
> 28 08FB77B6FE84183AC02AAC07 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
> 29 0A6EDCD41096537F0057314A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
> 30 0A6EDD7A109654B20057314A /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = /usr/lib/libsqlite3.dylib; sourceTree = "<absolute>"; };
> 31 0A6EDDAB109657800057314A /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
> 32 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
> 33 0AE04F6C10966B31000FDF7D /* TimelineGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineGenerator.h; sourceTree = "<group>"; };
> 34 0AE04F6D10966B31000FDF7D /* TimelineGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TimelineGenerator.m; sourceTree = "<group>"; };
> 35 0AE04F7A10966C36000FDF7D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; };
> 36 2C05A19B06CAA52B00D84F6F /* GeneratePreviewForURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratePreviewForURL.m; sourceTree = "<group>"; };
> 37 61E3BCFA0870B4F2002186A0 /* GenerateThumbnailForURL.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = GenerateThumbnailForURL.m; sourceTree = "<group>"; };
> 38 8D576316048677EA00EA77CD /* QLFossil.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QLFossil.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; };
> 39 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
> 40 C86B05260671AA6E00DD9006 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
> 41 F28CFBFC0A3EC0AF000ABFF5 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
> 42 F28CFC020A3EC0C6000ABFF5 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = /System/Library/Frameworks/QuickLook.framework; sourceTree = "<absolute>"; };
> 43 /* End PBXFileReference section */
> 44
> 45 /* Begin PBXFrameworksBuildPhase section */
> 46 8D576313048677EA00EA77CD /* Frameworks */ = {
> 47 isa = PBXFrameworksBuildPhase;
> 48 buildActionMask = 2147483647;
> 49 files = (
> 50 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */,
> 51 C86B05270671AA6E00DD9006 /* CoreServices.framework in Frameworks */,
> 52 F28CFBFD0A3EC0AF000ABFF5 /* ApplicationServices.framework in Frameworks */,
> 53 F28CFC030A3EC0C6000ABFF5 /* QuickLook.framework in Frameworks */,
> 54 0A6EDCD51096537F0057314A /* Foundation.framework in Frameworks */,
> 55 0A6EDD7B109654B20057314A /* libsqlite3.dylib in Frameworks */,
> 56 0A6EDDAC109657800057314A /* AppKit.framework in Frameworks */,
> 57 0AE04F7B10966C36000FDF7D /* WebKit.framework in Frameworks */,
> 58 );
> 59 runOnlyForDeploymentPostprocessing = 0;
> 60 };
> 61 /* End PBXFrameworksBuildPhase section */
> 62
> 63 /* Begin PBXGroup section */
> 64 089C166AFE841209C02AAC07 /* QLFossil */ = {
> 65 isa = PBXGroup;
> 66 children = (
> 67 08FB77AFFE84173DC02AAC07 /* Source */,
> 68 089C167CFE841241C02AAC07 /* Resources */,
> 69 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
> 70 19C28FB6FE9D52B211CA2CBB /* Products */,
> 71 0A6EDD7A109654B20057314A /* libsqlite3.dylib */,
> 72 );
> 73 name = QLFossil;
> 74 sourceTree = "<group>";
> 75 };
> 76 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
> 77 isa = PBXGroup;
> 78 children = (
> 79 0A6EDCD41096537F0057314A /* Foundation.framework */,
> 80 F28CFC020A3EC0C6000ABFF5 /* QuickLook.framework */,
> 81 F28CFBFC0A3EC0AF000ABFF5 /* ApplicationServices.framework */,
> 82 C86B05260671AA6E00DD9006 /* CoreServices.framework */,
> 83 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */,
> 84 0A6EDDAB109657800057314A /* AppKit.framework */,
> 85 0AE04F7A10966C36000FDF7D /* WebKit.framework */,
> 86 );
> 87 name = "External Frameworks and Libraries";
> 88 sourceTree = "<group>";
> 89 };
> 90 089C167CFE841241C02AAC07 /* Resources */ = {
> 91 isa = PBXGroup;
> 92 children = (
> 93 8D576317048677EA00EA77CD /* Info.plist */,
> 94 8D5B49A704867FD3000E48DA /* InfoPlist.strings */,
> 95 );
> 96 name = Resources;
> 97 sourceTree = "<group>";
> 98 };
> 99 08FB77AFFE84173DC02AAC07 /* Source */ = {
> 100 isa = PBXGroup;
> 101 children = (
> 102 0AE04F6C10966B31000FDF7D /* TimelineGenerator.h */,
> 103 0AE04F6D10966B31000FDF7D /* TimelineGenerator.m */,
> 104 61E3BCFA0870B4F2002186A0 /* GenerateThumbnailForURL.m */,
> 105 2C05A19B06CAA52B00D84F6F /* GeneratePreviewForURL.m */,
> 106 08FB77B6FE84183AC02AAC07 /* main.c */,
> 107 );
> 108 name = Source;
> 109 sourceTree = "<group>";
> 110 };
> 111 19C28FB6FE9D52B211CA2CBB /* Products */ = {
> 112 isa = PBXGroup;
> 113 children = (
> 114 8D576316048677EA00EA77CD /* QLFossil.qlgenerator */,
> 115 );
> 116 name = Products;
> 117 sourceTree = "<group>";
> 118 };
> 119 /* End PBXGroup section */
> 120
> 121 /* Begin PBXHeadersBuildPhase section */
> 122 8D57630E048677EA00EA77CD /* Headers */ = {
> 123 isa = PBXHeadersBuildPhase;
> 124 buildActionMask = 2147483647;
> 125 files = (
> 126 0AE04F6E10966B31000FDF7D /* TimelineGenerator.h in Headers */,
> 127 );
> 128 runOnlyForDeploymentPostprocessing = 0;
> 129 };
> 130 /* End PBXHeadersBuildPhase section */
> 131
> 132 /* Begin PBXNativeTarget section */
> 133 8D57630D048677EA00EA77CD /* QLFossil */ = {
> 134 isa = PBXNativeTarget;
> 135 buildConfigurationList = 2CA3261E0896AD4900168862 /* Build configuration list for PBXNativeTarget "QLFossil" */;
> 136 buildPhases = (
> 137 8D57630E048677EA00EA77CD /* Headers */,
> 138 8D57630F048677EA00EA77CD /* Resources */,
> 139 8D576311048677EA00EA77CD /* Sources */,
> 140 8D576313048677EA00EA77CD /* Frameworks */,
> 141 8D576315048677EA00EA77CD /* Rez */,
> 142 );
> 143 buildRules = (
> 144 );
> 145 dependencies = (
> 146 );
> 147 name = QLFossil;
> 148 productInstallPath = /Library/QuickLook;
> 149 productName = QLFossil;
> 150 productReference = 8D576316048677EA00EA77CD /* QLFossil.qlgenerator */;
> 151 productType = "com.apple.product-type.bundle";
> 152 };
> 153 /* End PBXNativeTarget section */
> 154
> 155 /* Begin PBXProject section */
> 156 089C1669FE841209C02AAC07 /* Project object */ = {
> 157 isa = PBXProject;
> 158 buildConfigurationList = 2CA326220896AD4900168862 /* Build configuration list for PBXProject "QLFossil" */;
> 159 compatibilityVersion = "Xcode 3.1";
> 160 hasScannedForEncodings = 1;
> 161 mainGroup = 089C166AFE841209C02AAC07 /* QLFossil */;
> 162 projectDirPath = "";
> 163 projectRoot = "";
> 164 targets = (
> 165 8D57630D048677EA00EA77CD /* QLFossil */,
> 166 );
> 167 };
> 168 /* End PBXProject section */
> 169
> 170 /* Begin PBXResourcesBuildPhase section */
> 171 8D57630F048677EA00EA77CD /* Resources */ = {
> 172 isa = PBXResourcesBuildPhase;
> 173 buildActionMask = 2147483647;
> 174 files = (
> 175 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
> 176 );
> 177 runOnlyForDeploymentPostprocessing = 0;
> 178 };
> 179 /* End PBXResourcesBuildPhase section */
> 180
> 181 /* Begin PBXRezBuildPhase section */
> 182 8D576315048677EA00EA77CD /* Rez */ = {
> 183 isa = PBXRezBuildPhase;
> 184 buildActionMask = 2147483647;
> 185 files = (
> 186 );
> 187 runOnlyForDeploymentPostprocessing = 0;
> 188 };
> 189 /* End PBXRezBuildPhase section */
> 190
> 191 /* Begin PBXSourcesBuildPhase section */
> 192 8D576311048677EA00EA77CD /* Sources */ = {
> 193 isa = PBXSourcesBuildPhase;
> 194 buildActionMask = 2147483647;
> 195 files = (
> 196 8D576312048677EA00EA77CD /* main.c in Sources */,
> 197 2C05A19C06CAA52B00D84F6F /* GeneratePreviewForURL.m in Sources */,
> 198 61E3BCFB0870B4F2002186A0 /* GenerateThumbnailForURL.m in Sources */,
> 199 0AE04F6F10966B31000FDF7D /* TimelineGenerator.m in Sources */,
> 200 );
> 201 runOnlyForDeploymentPostprocessing = 0;
> 202 };
> 203 /* End PBXSourcesBuildPhase section */
> 204
> 205 /* Begin PBXVariantGroup section */
> 206 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = {
> 207 isa = PBXVariantGroup;
> 208 children = (
> 209 089C167EFE841241C02AAC07 /* English */,
> 210 );
> 211 name = InfoPlist.strings;
> 212 sourceTree = "<group>";
> 213 };
> 214 /* End PBXVariantGroup section */
> 215
> 216 /* Begin XCBuildConfiguration section */
> 217 2CA3261F0896AD4900168862 /* Debug */ = {
> 218 isa = XCBuildConfiguration;
> 219 buildSettings = {
> 220 COPY_PHASE_STRIP = NO;
> 221 GCC_DYNAMIC_NO_PIC = NO;
> 222 GCC_ENABLE_FIX_AND_CONTINUE = YES;
> 223 GCC_MODEL_TUNING = G5;
> 224 GCC_OPTIMIZATION_LEVEL = 0;
> 225 GCC_PRECOMPILE_PREFIX_HEADER = NO;
> 226 INFOPLIST_FILE = Info.plist;
> 227 INSTALL_PATH = /Library/QuickLook;
> 228 PRODUCT_NAME = QLFossil;
> 229 WRAPPER_EXTENSION = qlgenerator;
> 230 };
> 231 name = Debug;
> 232 };
> 233 2CA326200896AD4900168862 /* Release */ = {
> 234 isa = XCBuildConfiguration;
> 235 buildSettings = {
> 236 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
> 237 GCC_MODEL_TUNING = G5;
> 238 GCC_PRECOMPILE_PREFIX_HEADER = NO;
> 239 INFOPLIST_FILE = Info.plist;
> 240 INSTALL_PATH = /Library/QuickLook;
> 241 PRODUCT_NAME = QLFossil;
> 242 WRAPPER_EXTENSION = qlgenerator;
> 243 };
> 244 name = Release;
> 245 };
> 246 2CA326230896AD4900168862 /* Debug */ = {
> 247 isa = XCBuildConfiguration;
> 248 buildSettings = {
> 249 ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
> 250 GCC_C_LANGUAGE_STANDARD = gnu99;
> 251 GCC_WARN_ABOUT_RETURN_TYPE = YES;
> 252 GCC_WARN_UNUSED_VARIABLE = YES;
> 253 ONLY_ACTIVE_ARCH = YES;
> 254 PREBINDING = NO;
> 255 SDKROOT = macosx10.6;
> 256 };
> 257 name = Debug;
> 258 };
> 259 2CA326240896AD4900168862 /* Release */ = {
> 260 isa = XCBuildConfiguration;
> 261 buildSettings = {
> 262 ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
> 263 GCC_C_LANGUAGE_STANDARD = gnu99;
> 264 GCC_WARN_ABOUT_RETURN_TYPE = YES;
> 265 GCC_WARN_UNUSED_VARIABLE = YES;
> 266 PREBINDING = NO;
> 267 SDKROOT = macosx10.6;
> 268 SYMROOT = /Users/dmitry/Projects/Builds/;
> 269 };
> 270 name = Release;
> 271 };
> 272 /* End XCBuildConfiguration section */
> 273
> 274 /* Begin XCConfigurationList section */
> 275 2CA3261E0896AD4900168862 /* Build configuration list for PBXNativeTarget "QLFossil" */ = {
> 276 isa = XCConfigurationList;
> 277 buildConfigurations = (
> 278 2CA3261F0896AD4900168862 /* Debug */,
> 279 2CA326200896AD4900168862 /* Release */,
> 280 );
> 281 defaultConfigurationIsVisible = 0;
> 282 defaultConfigurationName = Release;
> 283 };
> 284 2CA326220896AD4900168862 /* Build configuration list for PBXProject "QLFossil" */ = {
> 285 isa = XCConfigurationList;
> 286 buildConfigurations = (
> 287 2CA326230896AD4900168862 /* Debug */,
> 288 2CA326240896AD4900168862 /* Release */,
> 289 );
> 290 defaultConfigurationIsVisible = 0;
> 291 defaultConfigurationName = Release;
> 292 };
> 293 /* End XCConfigurationList section */
> 294 };
> 295 rootObject = 089C1669FE841209C02AAC07 /* Project object */;
> 296 }

Added TimelineGenerator.h

Old () New (5b8f65b69386c757)
> 1
> 2 NSMutableString *HTMLTimelineForDatabase(const char *database);

Added TimelineGenerator.m

Old () New (4c161d82e78d1a20)
> 1 #import <Foundation/Foundation.h>
> 2 #import <sqlite3.h>
> 3
> 4 NSMutableString *HTMLTimelineForDatabase(const char *database)
> 5 {
> 6 sqlite3 *db;
> 7 int rc;
> 8 char *sql;
> 9 sqlite3_stmt *st;
> 10 const char *key, *value;
> 11
> 12 NSMutableString *html = [[[NSMutableString alloc] init] autorelease];
> 13
> 14 rc = sqlite3_open(database, &db);
> 15 if (rc) {
> 16 fprintf(stderr, "QLFossil: Can't open database: %s\n", sqlite3_errmsg(db));
> 17 goto out;
> 18 }
> 19
> 20 [html appendString:
> 21 @"<style>"
> 22 "body { background: #fff; color: #111; font: 12px Helvetica; margin: 0 } "
> 23 ".info { padding: 10px; color: #333; background: #D6D6D6 "
> 24 " -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ccc)); "
> 25 " border-bottom: 1px solid #aaa; text-shadow: 0 1px #f4f4f4 } "
> 26 ".project-name { font-size: 20px } "
> 27 ".event { padding: 10px } "
> 28 ".time { display:block; color: #666; font-size: 11px; margin-bottom: 3px }"
> 29 ".uuid { -webkit-border-radius: 5px; font-family: monospace; "
> 30 " color: #555; background: #fff; padding: 0 5px } "
> 31 ".ci .uuid { background: #CCF } "
> 32 ".t .uuid { background: #CF6 } "
> 33 ".w .uuid { background: #FC6 } "
> 34 ".comment { margin-left: 5px } "
> 35 ".user { color: #777; background: #f4f4f4; "
> 36 " font-style: oblique; padding: 0 5px } "
> 37 ".odd { background: #E9F0FC } "
> 38 "</style>"
> 39 ];
> 40
> 41 sql = "SELECT name, value from config";
> 42
> 43 rc = sqlite3_prepare_v2(db, sql, -1, &st, 0);
> 44 if (rc != SQLITE_OK) {
> 45 fprintf(stderr, "QLFossil: SQL error");
> 46 goto out;
> 47 }
> 48
> 49 if (rc != SQLITE_OK) {
> 50 fprintf(stderr, "QLFossil: SQL error");
> 51 goto out;
> 52 }
> 53
> 54 [html appendString:@"<div class=info>"];
> 55
> 56 while (sqlite3_step(st) == SQLITE_ROW) {
> 57 key = (char *)sqlite3_column_text(st, 0);
> 58 value = (char *)sqlite3_column_text(st, 1);
> 59 if (key && value &&
> 60 (strstr(key, "project-name") == key ||
> 61 strstr(key, "project-description") == key /*||
> 62 strstr(key, "last-sync-url") == key*/)) {
> 63 [html appendFormat:@"<div class='%s'>%s</div>", key, value];
> 64 }
> 65 }
> 66 sqlite3_finalize(st);
> 67
> 68 [html appendString:@"</div>"];
> 69
> 70 sql = "SELECT bgcolor, type, datetime(mtime,'localtime') AS timestamp, "
> 71 "substr(uuid,0,10) AS uuid, comment, user FROM event "
> 72 "JOIN blob where blob.rid = event.objid "
> 73 "ORDER BY mtime DESC limit 20";
> 74
> 75 rc = sqlite3_prepare_v2(db, sql, -1, &st, 0);
> 76
> 77 BOOL isOdd = NO;
> 78 while (sqlite3_step(st) == SQLITE_ROW) {
> 79 // 0 - bgcolor
> 80 [html appendString:@"<div "];
> 81 value = (char *)sqlite3_column_text(st, 0);
> 82 if (value)
> 83 [html appendFormat:@" style='background: %s' ", value];
> 84 // 1 - type
> 85 [html appendString:@"class='event"];
> 86 value = (char *)sqlite3_column_text(st, 1);
> 87 if (value)
> 88 [html appendFormat:@" %s", value];
> 89 if (isOdd)
> 90 [html appendString:@" odd"];
> 91 [html appendString:@"'>\n"];
> 92 // 2 - timestamp
> 93 value = (char *)sqlite3_column_text(st, 2);
> 94 if (value)
> 95 [html appendFormat:@"<span class=time>%s</span>\n", value];
> 96 // 3 - uuid
> 97 value = (char *)sqlite3_column_text(st, 3);
> 98 if (value)
> 99 [html appendFormat:@"<span class=uuid>%s</span>\n", value];
> 100 // 4 - comment
> 101 value = (char *)sqlite3_column_text(st, 4);
> 102 if (value)
> 103 [html appendFormat:@"<span class=comment>%s</span>\n", value];
> 104 // 5 - user
> 105 value = (char *)sqlite3_column_text(st, 5);
> 106 if (value)
> 107 [html appendFormat:@"<span class=user>%s</span>\n", value];
> 108 [html appendString:@"</div>\n\n"];
> 109 isOdd = !isOdd;
> 110 }
> 111
> 112 //printf("%s", [html UTF8String]);
> 113
> 114 sqlite3_finalize(st);
> 115
> 116 out:
> 117 sqlite3_close(db);
> 118 return html;
> 119 }

Added main.c

Old () New (9fea9da27544792a)
> 1 //==============================================================================
> 2 //
> 3 // DO NO MODIFY THE CONTENT OF THIS FILE
> 4 //
> 5 // This file contains the generic CFPlug-in code necessary for your generator
> 6 // To complete your generator implement the function in GenerateThumbnailForURL/GeneratePreviewForURL.c
> 7 //
> 8 //==============================================================================
> 9
> 10
> 11
> 12
> 13
> 14
> 15 #include <CoreFoundation/CoreFoundation.h>
> 16 #include <CoreFoundation/CFPlugInCOM.h>
> 17 #include <CoreServices/CoreServices.h>
> 18 #include <QuickLook/QuickLook.h>
> 19
> 20 // -----------------------------------------------------------------------------
> 21 // constants
> 22 // -----------------------------------------------------------------------------
> 23
> 24 // Don't modify this line
> 25 #define PLUGIN_ID "67802A85-35C8-4172-8A41-292CF62BD74B"
> 26
> 27 //
> 28 // Below is the generic glue code for all plug-ins.
> 29 //
> 30 // You should not have to modify this code aside from changing
> 31 // names if you decide to change the names defined in the Info.plist
> 32 //
> 33
> 34
> 35 // -----------------------------------------------------------------------------
> 36 // typedefs
> 37 // -----------------------------------------------------------------------------
> 38
> 39 // The thumbnail generation function to be implemented in GenerateThumbnailForURL.c
> 40 OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize);
> 41 void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail);
> 42
> 43 // The preview generation function to be implemented in GeneratePreviewForURL.c
> 44 OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options);
> 45 void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview);
> 46
> 47 // The layout for an instance of QuickLookGeneratorPlugIn
> 48 typedef struct __QuickLookGeneratorPluginType
> 49 {
> 50 void *conduitInterface;
> 51 CFUUIDRef factoryID;
> 52 UInt32 refCount;
> 53 } QuickLookGeneratorPluginType;
> 54
> 55 // -----------------------------------------------------------------------------
> 56 // prototypes
> 57 // -----------------------------------------------------------------------------
> 58 // Forward declaration for the IUnknown implementation.
> 59 //
> 60
> 61 QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID);
> 62 void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance);
> 63 HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv);
> 64 void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID);
> 65 ULONG QuickLookGeneratorPluginAddRef(void *thisInstance);
> 66 ULONG QuickLookGeneratorPluginRelease(void *thisInstance);
> 67
> 68 // -----------------------------------------------------------------------------
> 69 // myInterfaceFtbl definition
> 70 // -----------------------------------------------------------------------------
> 71 // The QLGeneratorInterfaceStruct function table.
> 72 //
> 73 static QLGeneratorInterfaceStruct myInterfaceFtbl = {
> 74 NULL,
> 75 QuickLookGeneratorQueryInterface,
> 76 QuickLookGeneratorPluginAddRef,
> 77 QuickLookGeneratorPluginRelease,
> 78 NULL,
> 79 NULL,
> 80 NULL,
> 81 NULL
> 82 };
> 83
> 84
> 85 // -----------------------------------------------------------------------------
> 86 // AllocQuickLookGeneratorPluginType
> 87 // -----------------------------------------------------------------------------
> 88 // Utility function that allocates a new instance.
> 89 // You can do some initial setup for the generator here if you wish
> 90 // like allocating globals etc...
> 91 //
> 92 QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID)
> 93 {
> 94 QuickLookGeneratorPluginType *theNewInstance;
> 95
> 96 theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType));
> 97 memset(theNewInstance,0,sizeof(QuickLookGeneratorPluginType));
> 98
> 99 /* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */
> 100 theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct));
> 101 memcpy(theNewInstance->conduitInterface,&myInterfaceFtbl,sizeof(QLGeneratorInterfaceStruct));
> 102
> 103 /* Retain and keep an open instance refcount for each factory. */
> 104 theNewInstance->factoryID = CFRetain(inFactoryID);
> 105 CFPlugInAddInstanceForFactory(inFactoryID);
> 106
> 107 /* This function returns the IUnknown interface so set the refCount to one. */
> 108 theNewInstance->refCount = 1;
> 109 return theNewInstance;
> 110 }
> 111
> 112 // -----------------------------------------------------------------------------
> 113 // DeallocQuickLookGeneratorPluginType
> 114 // -----------------------------------------------------------------------------
> 115 // Utility function that deallocates the instance when
> 116 // the refCount goes to zero.
> 117 // In the current implementation generator interfaces are never deallocated
> 118 // but implement this as this might change in the future
> 119 //
> 120 void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance)
> 121 {
> 122 CFUUIDRef theFactoryID;
> 123
> 124 theFactoryID = thisInstance->factoryID;
> 125 /* Free the conduitInterface table up */
> 126 free(thisInstance->conduitInterface);
> 127
> 128 /* Free the instance structure */
> 129 free(thisInstance);
> 130 if (theFactoryID){
> 131 CFPlugInRemoveInstanceForFactory(theFactoryID);
> 132 CFRelease(theFactoryID);
> 133 }
> 134 }
> 135
> 136 // -----------------------------------------------------------------------------
> 137 // QuickLookGeneratorQueryInterface
> 138 // -----------------------------------------------------------------------------
> 139 // Implementation of the IUnknown QueryInterface function.
> 140 //
> 141 HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv)
> 142 {
> 143 CFUUIDRef interfaceID;
> 144
> 145 interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid);
> 146
> 147 if (CFEqual(interfaceID,kQLGeneratorCallbacksInterfaceID)){
> 148 /* If the Right interface was requested, bump the ref count,
> 149 * set the ppv parameter equal to the instance, and
> 150 * return good status.
> 151 */
> 152 ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GenerateThumbnailForURL = GenerateThumbnailForURL;
> 153 ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelThumbnailGeneration = CancelThumbnailGeneration;
> 154 ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GeneratePreviewForURL = GeneratePreviewForURL;
> 155 ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelPreviewGeneration = CancelPreviewGeneration;
> 156 ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance);
> 157 *ppv = thisInstance;
> 158 CFRelease(interfaceID);
> 159 return S_OK;
> 160 }else{
> 161 /* Requested interface unknown, bail with error. */
> 162 *ppv = NULL;
> 163 CFRelease(interfaceID);
> 164 return E_NOINTERFACE;
> 165 }
> 166 }
> 167
> 168 // -----------------------------------------------------------------------------
> 169 // QuickLookGeneratorPluginAddRef
> 170 // -----------------------------------------------------------------------------
> 171 // Implementation of reference counting for this type. Whenever an interface
> 172 // is requested, bump the refCount for the instance. NOTE: returning the
> 173 // refcount is a convention but is not required so don't rely on it.
> 174 //
> 175 ULONG QuickLookGeneratorPluginAddRef(void *thisInstance)
> 176 {
> 177 ((QuickLookGeneratorPluginType *)thisInstance )->refCount += 1;
> 178 return ((QuickLookGeneratorPluginType*) thisInstance)->refCount;
> 179 }
> 180
> 181 // -----------------------------------------------------------------------------
> 182 // QuickLookGeneratorPluginRelease
> 183 // -----------------------------------------------------------------------------
> 184 // When an interface is released, decrement the refCount.
> 185 // If the refCount goes to zero, deallocate the instance.
> 186 //
> 187 ULONG QuickLookGeneratorPluginRelease(void *thisInstance)
> 188 {
> 189 ((QuickLookGeneratorPluginType*)thisInstance)->refCount -= 1;
> 190 if (((QuickLookGeneratorPluginType*)thisInstance)->refCount == 0){
> 191 DeallocQuickLookGeneratorPluginType((QuickLookGeneratorPluginType*)thisInstance );
> 192 return 0;
> 193 }else{
> 194 return ((QuickLookGeneratorPluginType*) thisInstance )->refCount;
> 195 }
> 196 }
> 197
> 198 // -----------------------------------------------------------------------------
> 199 // QuickLookGeneratorPluginFactory
> 200 // -----------------------------------------------------------------------------
> 201 void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID)
> 202 {
> 203 QuickLookGeneratorPluginType *result;
> 204 CFUUIDRef uuid;
> 205
> 206 /* If correct type is being requested, allocate an
> 207 * instance of kQLGeneratorTypeID and return the IUnknown interface.
> 208 */
> 209 if (CFEqual(typeID,kQLGeneratorTypeID)){
> 210 uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID));
> 211 result = AllocQuickLookGeneratorPluginType(uuid);
> 212 CFRelease(uuid);
> 213 return result;
> 214 }
> 215 /* If the requested type is incorrect, return NULL. */
> 216 return NULL;
> 217 }
> 218

Added version.plist

Old () New (dc85389ea00b477b)
> 1 <?xml version="1.0" encoding="UTF-8"?>
> 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> 3 <plist version="1.0">
> 4 <dict>
> 5 <key>BuildVersion</key>
> 6 <string>1</string>
> 7 <key>CFBundleShortVersionString</key>
> 8 <string>1</string>
> 9 <key>CFBundleVersion</key>
> 10 <string>1.0</string>
> 11 <key>ProjectName</key>
> 12 <string>QuickLook</string>
> 13 <key>SourceVersion</key>
> 14 <string>3270000</string>
> 15 </dict>
> 16 </plist>