]> granicus.if.org Git - transmission/commitdiff
#4998 Support Quick Look of .torrent files in the Finder
authorMitchell Livingston <livings124@transmissionbt.com>
Sun, 12 Aug 2012 12:11:33 +0000 (12:11 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sun, 12 Aug 2012 12:11:33 +0000 (12:11 +0000)
Transmission.xcodeproj/project.pbxproj
macosx/QuickLookPlugin/GeneratePreviewForURL.m [new file with mode: 0644]
macosx/QuickLookPlugin/GenerateThumbnailForURL.m [new file with mode: 0644]
macosx/QuickLookPlugin/QuickLookPlugin-Info.plist [new file with mode: 0644]
macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch [new file with mode: 0644]
macosx/QuickLookPlugin/en.lproj/InfoPlist.strings [new file with mode: 0644]
macosx/QuickLookPlugin/main.c [new file with mode: 0644]
macosx/QuickLookPlugin/style.css [new file with mode: 0644]

index 9ea3e7f2a0717c0f1bfef91b29e11808c2bf1c77..53899bd7c419e02a284456c4736bef02ef0decb9 100644 (file)
                A284214512DA663E00FBDDBB /* tr-udp.h in Headers */ = {isa = PBXBuildFile; fileRef = A284214312DA663E00FBDDBB /* tr-udp.h */; };
                A28F4F770E085BDC003A3882 /* ColorTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A28F4F760E085BDC003A3882 /* ColorTextField.m */; };
                A292A6E80DFB45FC004B9C0A /* webseed.c in Sources */ = {isa = PBXBuildFile; fileRef = A292A6E50DFB45EC004B9C0A /* webseed.c */; };
+               A29304ED15D7465100B1F726 /* style.css in Resources */ = {isa = PBXBuildFile; fileRef = A29304EC15D7465100B1F726 /* style.css */; };
+               A29304EE15D7497C00B1F726 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = A2F35BCD15C5A0A100EBF632 /* main.c */; };
                A29576030D11D63C0093B167 /* Creator.xib in Resources */ = {isa = PBXBuildFile; fileRef = A29576010D11D63C0093B167 /* Creator.xib */; };
                A2966E8713DAF74C007B52DF /* GlobalOptionsPopoverViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2966E8613DAF74C007B52DF /* GlobalOptionsPopoverViewController.m */; };
                A296EF3B11E560A7004A2781 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A296EF3411E5605E004A2781 /* libiconv.dylib */; };
                A2E57BA713109E6B00A7DAB1 /* FilterBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2E57BA613109E6B00A7DAB1 /* FilterBarController.m */; };
                A2E669790F5B8E5A00B4251A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2E669780F5B8E5A00B4251A /* Security.framework */; };
                A2E9AA760C249AF400085DCF /* ToolbarCreateTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = A2E9AA750C249AF400085DCF /* ToolbarCreateTemplate.png */; };
+               A2EB2E7715C8CF2C00FBD5B4 /* QuickLookPlugin.qlgenerator in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2F35BB915C5A0A100EBF632 /* QuickLookPlugin.qlgenerator */; };
                A2ED7D8F0CEF431B00970975 /* FilterButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A2ED7D8E0CEF431B00970975 /* FilterButton.m */; };
                A2EE726F14DCCC950093C99A /* natpmp_local.h in Headers */ = {isa = PBXBuildFile; fileRef = A2EE726E14DCCC950093C99A /* natpmp_local.h */; };
                A2EF7DEC0C96297400FA9811 /* PurpleDot.png in Resources */ = {isa = PBXBuildFile; fileRef = A2EF7DEB0C96297400FA9811 /* PurpleDot.png */; };
                A2F151190CD438A4001F3B0E /* RedDot.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F151160CD438A4001F3B0E /* RedDot.png */; };
                A2F1511A0CD438A4001F3B0E /* GreenDot.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F151170CD438A4001F3B0E /* GreenDot.png */; };
                A2F151200CD438BA001F3B0E /* Lock.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F1511F0CD438BA001F3B0E /* Lock.png */; };
+               A2F35BBC15C5A0A100EBF632 /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2F35BBB15C5A0A100EBF632 /* QuickLook.framework */; };
+               A2F35BBE15C5A0A100EBF632 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2F35BBD15C5A0A100EBF632 /* ApplicationServices.framework */; };
+               A2F35BC015C5A0A100EBF632 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2F35BBF15C5A0A100EBF632 /* CoreServices.framework */; };
+               A2F35BC215C5A0A100EBF632 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2F35BC115C5A0A100EBF632 /* CoreFoundation.framework */; };
+               A2F35BC815C5A0A100EBF632 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A2F35BC615C5A0A100EBF632 /* InfoPlist.strings */; };
+               A2F35BCA15C5A0A100EBF632 /* GenerateThumbnailForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = A2F35BC915C5A0A100EBF632 /* GenerateThumbnailForURL.m */; };
+               A2F35BCC15C5A0A100EBF632 /* GeneratePreviewForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = A2F35BCB15C5A0A100EBF632 /* GeneratePreviewForURL.m */; };
+               A2F35BD415C5A19A00EBF632 /* libtransmission.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D18389709DEC0030047D688 /* libtransmission.a */; };
+               A2F35BD715C5A46D00EBF632 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A27653A714369C5C009D3CCF /* libcrypto.dylib */; };
+               A2F35BD915C5A48400EBF632 /* libcurl.4.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A2F35BD815C5A48400EBF632 /* libcurl.4.dylib */; };
+               A2F35BDA15C5A49200EBF632 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A2B6141B1395ADE9000E0975 /* libz.dylib */; };
+               A2F35BDB15C5A4A000EBF632 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A296EF3411E5605E004A2781 /* libiconv.dylib */; };
+               A2F35BDE15C5A67100EBF632 /* NSStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DE5CC9C0980656F00BE280E /* NSStringAdditions.m */; };
+               A2F35BDF15C5A7C400EBF632 /* NSApplicationAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A29D84031049C25600D1987A /* NSApplicationAdditions.m */; };
+               A2F35BE115C5A7ED00EBF632 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2F35BE015C5A7ED00EBF632 /* Cocoa.framework */; };
+               A2F35BE315C5A7F900EBF632 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2F35BE215C5A7F900EBF632 /* Foundation.framework */; };
                A2F40AE40A361C00006B8288 /* Transmission.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4D2784360905709500687951 /* Transmission.icns */; };
                A2F41DAB0D0B916B006CE378 /* YingYangTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F41DAA0D0B916B006CE378 /* YingYangTemplate.png */; };
                A2F41F8E0D73595100B82116 /* InfoTracker.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F41F8D0D73595100B82116 /* InfoTracker.png */; };
                        remoteGlobalIDString = A2E384CD130DFB1D001F501B;
                        remoteInfo = libutp;
                };
+               A2EB2E7415C8CCE900FBD5B4 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = A2F35BB815C5A0A100EBF632;
+                       remoteInfo = QuickLookPlugin;
+               };
+               A2F35BD515C5A1A100EBF632 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 4D18389609DEC0030047D688;
+                       remoteInfo = libtransmission;
+               };
                BE1183750CE161040002D0F3 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
                        name = "Copy Files";
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               A2EB2E7615C8CF1C00FBD5B4 /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 2147483647;
+                       dstPath = Contents/Library/QuickLook;
+                       dstSubfolderSpec = 1;
+                       files = (
+                               A2EB2E7715C8CF2C00FBD5B4 /* QuickLookPlugin.qlgenerator in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
                A292C9E01413BA5F00EF710F /* es */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = es; path = macosx/es.lproj/GlobalOptionsPopover.xib; sourceTree = "<group>"; };
                A292C9E2141593DA00EF710F /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = macosx/de.lproj/GlobalOptionsPopover.xib; sourceTree = "<group>"; };
                A292C9E414163AE500EF710F /* it */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = it; path = macosx/it.lproj/GlobalOptionsPopover.xib; sourceTree = "<group>"; };
+               A29304EC15D7465100B1F726 /* style.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = style.css; path = macosx/QuickLookPlugin/style.css; sourceTree = SOURCE_ROOT; };
                A29443271419746A0016143A /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = macosx/ru.lproj/GlobalOptionsPopover.xib; sourceTree = "<group>"; };
                A294432E141B23CD0016143A /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = pt_PT; path = macosx/pt_PT.lproj/GlobalOptionsPopover.xib; sourceTree = "<group>"; };
                A2963CFD1423F2BB00C497B5 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = macosx/fr.lproj/GlobalOptionsPopover.xib; sourceTree = "<group>"; };
                A2F151160CD438A4001F3B0E /* RedDot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = RedDot.png; path = macosx/Images/RedDot.png; sourceTree = "<group>"; };
                A2F151170CD438A4001F3B0E /* GreenDot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = GreenDot.png; path = macosx/Images/GreenDot.png; sourceTree = "<group>"; };
                A2F1511F0CD438BA001F3B0E /* Lock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Lock.png; path = macosx/Images/Lock.png; sourceTree = "<group>"; };
+               A2F35BB915C5A0A100EBF632 /* QuickLookPlugin.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QuickLookPlugin.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; };
+               A2F35BBB15C5A0A100EBF632 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; };
+               A2F35BBD15C5A0A100EBF632 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; };
+               A2F35BBF15C5A0A100EBF632 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
+               A2F35BC115C5A0A100EBF632 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
+               A2F35BC515C5A0A100EBF632 /* QuickLookPlugin-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "QuickLookPlugin-Info.plist"; path = "macosx/QuickLookPlugin/QuickLookPlugin-Info.plist"; sourceTree = SOURCE_ROOT; };
+               A2F35BC715C5A0A100EBF632 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+               A2F35BC915C5A0A100EBF632 /* GenerateThumbnailForURL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GenerateThumbnailForURL.m; path = macosx/QuickLookPlugin/GenerateThumbnailForURL.m; sourceTree = SOURCE_ROOT; };
+               A2F35BCB15C5A0A100EBF632 /* GeneratePreviewForURL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GeneratePreviewForURL.m; path = macosx/QuickLookPlugin/GeneratePreviewForURL.m; sourceTree = SOURCE_ROOT; };
+               A2F35BCD15C5A0A100EBF632 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = main.c; path = macosx/QuickLookPlugin/main.c; sourceTree = SOURCE_ROOT; };
+               A2F35BCF15C5A0A100EBF632 /* QuickLookPlugin-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "QuickLookPlugin-Prefix.pch"; path = "macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch"; sourceTree = SOURCE_ROOT; };
+               A2F35BD815C5A48400EBF632 /* libcurl.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.4.dylib; path = usr/lib/libcurl.4.dylib; sourceTree = SDKROOT; };
+               A2F35BE015C5A7ED00EBF632 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
+               A2F35BE215C5A7F900EBF632 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
                A2F41DAA0D0B916B006CE378 /* YingYangTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = YingYangTemplate.png; path = macosx/Images/YingYangTemplate.png; sourceTree = "<group>"; };
                A2F41F8D0D73595100B82116 /* InfoTracker.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoTracker.png; path = macosx/Images/InfoTracker.png; sourceTree = "<group>"; };
                A2F7CF5413035F7B0016FF10 /* URLSheetWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = URLSheetWindow.xib; path = macosx/URLSheetWindow.xib; sourceTree = "<group>"; };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               A2F35BB415C5A0A100EBF632 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               A2F35BBC15C5A0A100EBF632 /* QuickLook.framework in Frameworks */,
+                               A2F35BBE15C5A0A100EBF632 /* ApplicationServices.framework in Frameworks */,
+                               A2F35BC015C5A0A100EBF632 /* CoreServices.framework in Frameworks */,
+                               A2F35BC215C5A0A100EBF632 /* CoreFoundation.framework in Frameworks */,
+                               A2F35BE115C5A7ED00EBF632 /* Cocoa.framework in Frameworks */,
+                               A2F35BE315C5A7F900EBF632 /* Foundation.framework in Frameworks */,
+                               A2F35BD415C5A19A00EBF632 /* libtransmission.a in Frameworks */,
+                               A2F35BDB15C5A4A000EBF632 /* libiconv.dylib in Frameworks */,
+                               A2F35BDA15C5A49200EBF632 /* libz.dylib in Frameworks */,
+                               A2F35BD915C5A48400EBF632 /* libcurl.4.dylib in Frameworks */,
+                               A2F35BD715C5A46D00EBF632 /* libcrypto.dylib in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                BE1183460CE160960002D0F3 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                                3C7A118D0D0B2EB800B5701F /* libnatpmp.a */,
                                A22CFCBA0FC24F710009BD3E /* libdht.a */,
                                A2E38544130DFEE3001F501B /* libutp.a */,
+                               A2F35BB915C5A0A100EBF632 /* QuickLookPlugin.qlgenerator */,
                        );
                        name = Products;
                        sourceTree = "<group>";
                        isa = PBXGroup;
                        children = (
                                4DDBB70A09E16B3200284745 /* GUI */,
+                               A2F35BC315C5A0A100EBF632 /* QuickLookPlugin */,
                                4D1838DC09DEC04A0047D688 /* libtransmission */,
                                4DDBB71F09E16BFE00284745 /* CLI */,
                                BEFC1C0B0C07754700B0BB3C /* daemon */,
                                BE1183410CE15DF00002D0F3 /* libminiupnp */,
                                3C7A11880D0B2E6700B5701F /* libnatpmp */,
                                4DDBB71509E16B3F00284745 /* Libraries */,
+                               A2F35BBA15C5A0A100EBF632 /* Frameworks */,
                                19C28FACFE9D520D11CA2CBB /* Products */,
                        );
                        name = Transmission;
                        name = Additions;
                        sourceTree = "<group>";
                };
+               A245B88615C5A94A008747AC /* Frameworks */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A2F35BE215C5A7F900EBF632 /* Foundation.framework */,
+                               A2F35BE015C5A7ED00EBF632 /* Cocoa.framework */,
+                               A2F35BD815C5A48400EBF632 /* libcurl.4.dylib */,
+                       );
+                       name = Frameworks;
+                       sourceTree = "<group>";
+               };
                A26AF2220D2DA42800FF7140 /* File Outline View */ = {
                        isa = PBXGroup;
                        children = (
                        name = libutp;
                        sourceTree = "<group>";
                };
+               A2F35BBA15C5A0A100EBF632 /* Frameworks */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A2F35BBB15C5A0A100EBF632 /* QuickLook.framework */,
+                               A2F35BBD15C5A0A100EBF632 /* ApplicationServices.framework */,
+                               A2F35BBF15C5A0A100EBF632 /* CoreServices.framework */,
+                               A2F35BC115C5A0A100EBF632 /* CoreFoundation.framework */,
+                       );
+                       name = Frameworks;
+                       sourceTree = "<group>";
+               };
+               A2F35BC315C5A0A100EBF632 /* QuickLookPlugin */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A2F35BC915C5A0A100EBF632 /* GenerateThumbnailForURL.m */,
+                               A2F35BCB15C5A0A100EBF632 /* GeneratePreviewForURL.m */,
+                               A2F35BCD15C5A0A100EBF632 /* main.c */,
+                               A2F35BC415C5A0A100EBF632 /* Supporting Files */,
+                               A245B88615C5A94A008747AC /* Frameworks */,
+                       );
+                       path = QuickLookPlugin;
+                       sourceTree = "<group>";
+               };
+               A2F35BC415C5A0A100EBF632 /* Supporting Files */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A29304EC15D7465100B1F726 /* style.css */,
+                               A2F35BC515C5A0A100EBF632 /* QuickLookPlugin-Info.plist */,
+                               A2F35BC615C5A0A100EBF632 /* InfoPlist.strings */,
+                               A2F35BCF15C5A0A100EBF632 /* QuickLookPlugin-Prefix.pch */,
+                       );
+                       name = "Supporting Files";
+                       sourceTree = "<group>";
+               };
                BE1183410CE15DF00002D0F3 /* libminiupnp */ = {
                        isa = PBXGroup;
                        children = (
                                8D11072C0486CEB800E47090 /* Sources */,
                                8D11072E0486CEB800E47090 /* Frameworks */,
                                A24F191B0A3A792300C9C145 /* Copy Files */,
+                               A2EB2E7615C8CF1C00FBD5B4 /* CopyFiles */,
                        );
                        buildRules = (
                        );
                        dependencies = (
+                               A2EB2E7515C8CCE900FBD5B4 /* PBXTargetDependency */,
                                4D1838E609DEC1170047D688 /* PBXTargetDependency */,
                        );
                        name = Transmission;
                        productReference = A2E38544130DFEE3001F501B /* libutp.a */;
                        productType = "com.apple.product-type.library.static";
                };
+               A2F35BB815C5A0A100EBF632 /* QuickLookPlugin */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = A2F35BD015C5A0A100EBF632 /* Build configuration list for PBXNativeTarget "QuickLookPlugin" */;
+                       buildPhases = (
+                               A2F35BB315C5A0A100EBF632 /* Sources */,
+                               A2F35BB415C5A0A100EBF632 /* Frameworks */,
+                               A2F35BB615C5A0A100EBF632 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                               A2F35BD615C5A1A100EBF632 /* PBXTargetDependency */,
+                       );
+                       name = QuickLookPlugin;
+                       productName = QuickLookPlugin;
+                       productReference = A2F35BB915C5A0A100EBF632 /* QuickLookPlugin.qlgenerator */;
+                       productType = "com.apple.product-type.bundle";
+               };
                BE1183470CE160960002D0F3 /* miniupnp */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = BE11834C0CE160A80002D0F3 /* Build configuration list for PBXNativeTarget "miniupnp" */;
                        projectRoot = "";
                        targets = (
                                8D1107260486CEB800E47090 /* Transmission */,
+                               A2F35BB815C5A0A100EBF632 /* QuickLookPlugin */,
                                4D18389609DEC0030047D688 /* libtransmission */,
                                4DDBB71809E16BAE00284745 /* transmissioncli */,
                                BEFC1BFF0C07750000B0BB3C /* transmission-daemon */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               A2F35BB615C5A0A100EBF632 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               A2F35BC815C5A0A100EBF632 /* InfoPlist.strings in Resources */,
+                               A29304ED15D7465100B1F726 /* style.css in Resources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
 /* End PBXResourcesBuildPhase section */
 
 /* Begin PBXShellScriptBuildPhase section */
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               A2F35BB315C5A0A100EBF632 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               A29304EE15D7497C00B1F726 /* main.c in Sources */,
+                               A2F35BCA15C5A0A100EBF632 /* GenerateThumbnailForURL.m in Sources */,
+                               A2F35BCC15C5A0A100EBF632 /* GeneratePreviewForURL.m in Sources */,
+                               A2F35BDF15C5A7C400EBF632 /* NSApplicationAdditions.m in Sources */,
+                               A2F35BDE15C5A67100EBF632 /* NSStringAdditions.m in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                BE1183450CE160960002D0F3 /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        target = A2E384CD130DFB1D001F501B /* utp */;
                        targetProxy = A2E384E3130DFB51001F501B /* PBXContainerItemProxy */;
                };
+               A2EB2E7515C8CCE900FBD5B4 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = A2F35BB815C5A0A100EBF632 /* QuickLookPlugin */;
+                       targetProxy = A2EB2E7415C8CCE900FBD5B4 /* PBXContainerItemProxy */;
+               };
+               A2F35BD615C5A1A100EBF632 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 4D18389609DEC0030047D688 /* libtransmission */;
+                       targetProxy = A2F35BD515C5A1A100EBF632 /* PBXContainerItemProxy */;
+               };
                BE1183760CE161040002D0F3 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = BE1183470CE160960002D0F3 /* miniupnp */;
                        name = Creator.xib;
                        sourceTree = "<group>";
                };
+               A2F35BC615C5A0A100EBF632 /* InfoPlist.strings */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               A2F35BC715C5A0A100EBF632 /* en */,
+                       );
+                       name = InfoPlist.strings;
+                       path = macosx/QuickLookPlugin;
+                       sourceTree = SOURCE_ROOT;
+               };
 /* End PBXVariantGroup section */
 
 /* Begin XCBuildConfiguration section */
                                GCC_UNROLL_LOOPS = YES;
                                GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
+                               GCC_WARN_UNINITIALIZED_AUTOS = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
                                HEADER_SEARCH_PATHS = "third-party/curl/include";
                                IBC_FLATTEN_NIBS = YES;
                                GCC_UNROLL_LOOPS = YES;
                                GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
+                               GCC_WARN_UNINITIALIZED_AUTOS = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
                                HEADER_SEARCH_PATHS = "third-party/curl/include";
                                IBC_FLATTEN_NIBS = YES;
                                GCC_UNROLL_LOOPS = YES;
                                GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
                                GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
+                               GCC_WARN_UNINITIALIZED_AUTOS = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
                                HEADER_SEARCH_PATHS = "third-party/curl/include";
                                IBC_FLATTEN_NIBS = YES;
                        };
                        name = Release;
                };
+               A2F35BD115C5A0A100EBF632 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+                               GCC_PREFIX_HEADER = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
+                               INFOPLIST_FILE = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Info.plist";
+                               INSTALL_PATH = /Library/QuickLook;
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                               WRAPPER_EXTENSION = qlgenerator;
+                       };
+                       name = Debug;
+               };
+               A2F35BD215C5A0A100EBF632 /* Release - Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+                               GCC_PREFIX_HEADER = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
+                               INFOPLIST_FILE = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Info.plist";
+                               INSTALL_PATH = /Library/QuickLook;
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                               WRAPPER_EXTENSION = qlgenerator;
+                       };
+                       name = "Release - Debug";
+               };
+               A2F35BD315C5A0A100EBF632 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+                               GCC_PREFIX_HEADER = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
+                               INFOPLIST_FILE = "$(SRCROOT)/macosx/QuickLookPlugin/QuickLookPlugin-Info.plist";
+                               INSTALL_PATH = /Library/QuickLook;
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                               WRAPPER_EXTENSION = qlgenerator;
+                       };
+                       name = Release;
+               };
                BE1183490CE160960002D0F3 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Debug;
                };
+               A2F35BD015C5A0A100EBF632 /* Build configuration list for PBXNativeTarget "QuickLookPlugin" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               A2F35BD115C5A0A100EBF632 /* Debug */,
+                               A2F35BD215C5A0A100EBF632 /* Release - Debug */,
+                               A2F35BD315C5A0A100EBF632 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Debug;
+               };
                BE11834C0CE160A80002D0F3 /* Build configuration list for PBXNativeTarget "miniupnp" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
diff --git a/macosx/QuickLookPlugin/GeneratePreviewForURL.m b/macosx/QuickLookPlugin/GeneratePreviewForURL.m
new file mode 100644 (file)
index 0000000..37cefaf
--- /dev/null
@@ -0,0 +1,149 @@
+#import "transmission.h"
+#import "NSStringAdditions.h"
+
+OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options);
+void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview);
+
+NSString * generateIconData(NSString * fileExtension, NSUInteger width, NSMutableDictionary * allImgProps)
+{
+    NSString * rawFilename = ![fileExtension isEqualToString: @""] ? fileExtension : @"blank_file_name_transmission";
+    NSString * iconFileName = [NSString stringWithFormat: @"%ldx%@.tiff", width, rawFilename]; //we need to do this once per file extension, per size
+    
+    if (!allImgProps[iconFileName])
+    {
+        NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFileType: fileExtension];
+        
+        const NSRect iconFrame = NSMakeRect(0.0, 0.0, width, width);
+        NSImage * renderedIcon = [[NSImage alloc] initWithSize: iconFrame.size];
+        [renderedIcon lockFocus];
+        [icon drawInRect: iconFrame fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1.0];
+        [renderedIcon unlockFocus];
+        
+        NSData * iconData = [renderedIcon TIFFRepresentation];
+        [renderedIcon release];
+        
+        NSDictionary * imgProps = @{
+            (NSString *)kQLPreviewPropertyMIMETypeKey : @"image/png",
+            (NSString *)kQLPreviewPropertyAttachmentDataKey : iconData };
+        [allImgProps setObject: imgProps forKey: iconFileName];
+    }
+    
+    return [@"cid:" stringByAppendingString: iconFileName];
+}
+
+OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options)
+{
+    // Before proceeding make sure the user didn't cancel the request
+    if (QLPreviewRequestIsCancelled(preview))
+        return noErr;
+    
+    //try to parse the torrent file
+    tr_info inf;
+    tr_ctor * ctor = tr_ctorNew(NULL);
+    tr_ctorSetMetainfoFromFile(ctor, [[(NSURL *)url path] UTF8String]);
+    const int err = tr_torrentParse(ctor, &inf);
+    tr_ctorFree(ctor);
+    if (err)
+        return noErr;
+    
+    NSURL * styleURL = [[NSBundle bundleWithIdentifier: @"org.m0k.transmission.QuickLookPlugin"] URLForResource: @"style" withExtension: @"css"];
+    NSString * styleContents = [NSString stringWithContentsOfURL: styleURL encoding: NSUTF8StringEncoding error: NULL];
+    
+    NSMutableString * htmlString = [NSMutableString string];
+    [htmlString appendFormat: @"<html><style type=\"text/css\">%@</style><body>", styleContents];
+    
+    NSMutableDictionary * allImgProps = [NSMutableDictionary dictionary];
+    
+    NSString * name = [NSString stringWithUTF8String: inf.name];
+    NSString * fileTypeString = inf.isMultifile ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : [name pathExtension];
+    
+    const NSUInteger width = 32;
+    [htmlString appendFormat: @"<h2><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\">%@</h2>", generateIconData(fileTypeString, width, allImgProps), width, width, name];
+    
+    NSString * fileSizeString = [NSString stringForFileSize: inf.totalSize];
+    if (inf.isMultifile)
+    {
+        NSString * fileCountString;
+        if (inf.fileCount == 1)
+            fileCountString = NSLocalizedString(@"1 file", "quicklook file count");
+        else
+            fileCountString= [NSString stringWithFormat: NSLocalizedString(@"%@ files", "quicklook file count"), [NSString formattedUInteger: inf.fileCount]];
+        fileSizeString = [NSString stringWithFormat: @"%@, %@", fileCountString, fileSizeString];
+    }
+    [htmlString appendFormat: @"<p>%@</p>", fileSizeString];
+    if (inf.comment)
+    {
+        NSString * comment = [NSString stringWithUTF8String: inf.comment];
+        if (![comment isEqualToString: @""])
+            [htmlString appendFormat: @"<p>%@</p>", comment];
+    }
+    
+    [htmlString appendString: @"<hr/>"];
+    
+    if (inf.webseedCount > 0)
+    {
+        [htmlString appendString: @"<br><br><table>"];
+        
+        NSString * headerTitleString = inf.webseedCount == 1 ? NSLocalizedString(@"1 Web Seed", "quicklook web seed header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Web Seeds", "quicklook web seed header"), [NSString formattedUInteger: inf.webseedCount]];
+        [htmlString appendFormat: @"<tr><th>%@</th></tr>", headerTitleString];
+        
+        for (int i = 0; i < inf.webseedCount; ++i)
+            [htmlString appendFormat: @"<tr><td>%s<td></tr>", inf.webseeds[i]];
+        
+        [htmlString appendString:@"</table>"];
+    }
+    
+    if (inf.trackerCount > 0)
+    {
+        [htmlString appendString: @"<br><br><table>"];
+        
+        NSString * headerTitleString = inf.trackerCount == 1 ? NSLocalizedString(@"1 Tracker", "quicklook tracker header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Trackers", "quicklook tracker header"), [NSString formattedUInteger: inf.trackerCount]];
+        [htmlString appendFormat: @"<tr><th>%@</th></tr>", headerTitleString];
+        
+#warning handle tiers?
+        for (int i = 0; i < inf.trackerCount; ++i)
+            [htmlString appendFormat: @"<tr><td>%s<td></tr>", inf.trackers[i].announce];
+        
+        [htmlString appendString:@"</table>"];
+    }
+    
+    if (inf.isMultifile)
+    {
+        [htmlString appendString: @"<br><br><table>"];
+        
+        NSString * fileTitleString = inf.fileCount == 1 ? NSLocalizedString(@"1 File", "quicklook file header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Files", "quicklook file header"), [NSString formattedUInteger: inf.fileCount]];
+        [htmlString appendFormat: @"<tr><th>%@</th></tr>", fileTitleString];
+        
+#warning display size?
+#warning display folders?
+        for (int i = 0; i < inf.fileCount; ++i)
+        {
+            NSString * fullFilePath = [NSString stringWithUTF8String: inf.files[i].name];
+            NSCAssert([fullFilePath hasPrefix: [name stringByAppendingString: @"/"]], @"Expected file path %@ to begin with %@/", fullFilePath, name);
+            
+            NSString * shortenedFilePath = [fullFilePath substringFromIndex: [name length]+1];
+            
+            const NSUInteger width = 16;
+            [htmlString appendFormat: @"<tr><td><img class=\"icon\" src=\"%@\" width=\"%ld\" height=\"%ld\">%@<td></tr>", generateIconData([shortenedFilePath pathExtension], width, allImgProps), width, width, shortenedFilePath];
+        }
+        
+        [htmlString appendString:@"</table>"];
+    }
+    
+    [htmlString appendString: @"</body></html>"];
+    
+    tr_metainfoFree(&inf);
+    
+    NSDictionary * props = @{ (NSString *)kQLPreviewPropertyTextEncodingNameKey : @"UTF-8",
+                                (NSString *)kQLPreviewPropertyMIMETypeKey : @"text/html",
+                                (NSString *)kQLPreviewPropertyAttachmentsKey : allImgProps };
+    
+    QLPreviewRequestSetDataRepresentation(preview, (CFDataRef)[htmlString dataUsingEncoding: NSUTF8StringEncoding], kUTTypeHTML, (CFDictionaryRef)props);
+    
+    return noErr;
+}
+
+void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview)
+{
+    // Implement only if supported
+}
diff --git a/macosx/QuickLookPlugin/GenerateThumbnailForURL.m b/macosx/QuickLookPlugin/GenerateThumbnailForURL.m
new file mode 100644 (file)
index 0000000..e7c2ced
--- /dev/null
@@ -0,0 +1,23 @@
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreServices/CoreServices.h>
+#include <QuickLook/QuickLook.h>
+
+OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize);
+void CancelThumbnailGeneration(void *thisInterface, QLThumbnailRequestRef thumbnail);
+
+/* -----------------------------------------------------------------------------
+    Generate a thumbnail for file
+
+   This function's job is to create thumbnail for designated file as fast as possible
+   ----------------------------------------------------------------------------- */
+
+OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize)
+{
+    // To complete your generator please implement the function GenerateThumbnailForURL in GenerateThumbnailForURL.c
+    return noErr;
+}
+
+void CancelThumbnailGeneration(void *thisInterface, QLThumbnailRequestRef thumbnail)
+{
+    // Implement only if supported
+}
diff --git a/macosx/QuickLookPlugin/QuickLookPlugin-Info.plist b/macosx/QuickLookPlugin/QuickLookPlugin-Info.plist
new file mode 100644 (file)
index 0000000..367b34c
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleDocumentTypes</key>
+       <array>
+               <dict>
+                       <key>CFBundleTypeRole</key>
+                       <string>QLGenerator</string>
+                       <key>LSItemContentTypes</key>
+                       <array>
+                               <string>org.bittorrent.torrent</string>
+                               <string>com.bittorrent.torrent</string>
+                       </array>
+               </dict>
+       </array>
+       <key>CFBundleExecutable</key>
+       <string>${EXECUTABLE_NAME}</string>
+       <key>CFBundleIconFile</key>
+       <string></string>
+       <key>CFBundleIdentifier</key>
+       <string>org.m0k.transmission.${PRODUCT_NAME:rfc1034identifier}</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>${PRODUCT_NAME}</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1</string>
+       <key>CFBundleVersion</key>
+       <string>1.0</string>
+       <key>CFPlugInDynamicRegisterFunction</key>
+       <string></string>
+       <key>CFPlugInDynamicRegistration</key>
+       <string>NO</string>
+       <key>CFPlugInFactories</key>
+       <dict>
+               <key>FDF02409-6B04-4738-973D-1AADB4FC34D8</key>
+               <string>QuickLookGeneratorPluginFactory</string>
+       </dict>
+       <key>CFPlugInTypes</key>
+       <dict>
+               <key>5E2D9680-5022-40FA-B806-43349622E5B9</key>
+               <array>
+                       <string>FDF02409-6B04-4738-973D-1AADB4FC34D8</string>
+               </array>
+       </dict>
+       <key>CFPlugInUnloadFunction</key>
+       <string></string>
+       <key>NSHumanReadableCopyright</key>
+       <string>Copyright © 2012 The Transmission Project. All rights reserved.</string>
+       <key>QLNeedsToBeRunInMainThread</key>
+       <false/>
+       <key>QLPreviewHeight</key>
+       <integer>600</integer>
+       <key>QLPreviewWidth</key>
+       <integer>600</integer>
+       <key>QLSupportsConcurrentRequests</key>
+       <true/>
+       <key>QLThumbnailMinimumSize</key>
+       <real>17</real>
+</dict>
+</plist>
diff --git a/macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch b/macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch
new file mode 100644 (file)
index 0000000..7e8817c
--- /dev/null
@@ -0,0 +1,4 @@
+#ifdef __OBJC__
+#import <Cocoa/Cocoa.h>
+#import <QuickLook/QuickLook.h>
+#endif
diff --git a/macosx/QuickLookPlugin/en.lproj/InfoPlist.strings b/macosx/QuickLookPlugin/en.lproj/InfoPlist.strings
new file mode 100644 (file)
index 0000000..477b28f
--- /dev/null
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
diff --git a/macosx/QuickLookPlugin/main.c b/macosx/QuickLookPlugin/main.c
new file mode 100644 (file)
index 0000000..7345f8f
--- /dev/null
@@ -0,0 +1,218 @@
+//==============================================================================
+//
+//     DO NO MODIFY THE CONTENT OF THIS FILE
+//
+//     This file contains the generic CFPlug-in code necessary for your generator
+//     To complete your generator implement the function in GenerateThumbnailForURL/GeneratePreviewForURL.c
+//
+//==============================================================================
+
+
+
+
+
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreFoundation/CFPlugInCOM.h>
+#include <CoreServices/CoreServices.h>
+#include <QuickLook/QuickLook.h>
+
+// -----------------------------------------------------------------------------
+//     constants
+// -----------------------------------------------------------------------------
+
+// Don't modify this line
+#define PLUGIN_ID "FDF02409-6B04-4738-973D-1AADB4FC34D8"
+
+//
+// Below is the generic glue code for all plug-ins.
+//
+// You should not have to modify this code aside from changing
+// names if you decide to change the names defined in the Info.plist
+//
+
+
+// -----------------------------------------------------------------------------
+//     typedefs
+// -----------------------------------------------------------------------------
+
+// The thumbnail generation function to be implemented in GenerateThumbnailForURL.c
+OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize);
+void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail);
+
+// The preview generation function to be implemented in GeneratePreviewForURL.c
+OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options);
+void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview);
+
+// The layout for an instance of QuickLookGeneratorPlugIn
+typedef struct __QuickLookGeneratorPluginType
+{
+    void        *conduitInterface;
+    CFUUIDRef    factoryID;
+    UInt32       refCount;
+} QuickLookGeneratorPluginType;
+
+// -----------------------------------------------------------------------------
+//     prototypes
+// -----------------------------------------------------------------------------
+//     Forward declaration for the IUnknown implementation.
+//
+
+QuickLookGeneratorPluginType  *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID);
+void                         DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance);
+HRESULT                      QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv);
+void                        *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID);
+ULONG                        QuickLookGeneratorPluginAddRef(void *thisInstance);
+ULONG                        QuickLookGeneratorPluginRelease(void *thisInstance);
+
+// -----------------------------------------------------------------------------
+//     myInterfaceFtbl definition
+// -----------------------------------------------------------------------------
+//     The QLGeneratorInterfaceStruct function table.
+//
+static QLGeneratorInterfaceStruct myInterfaceFtbl = {
+    NULL,
+    QuickLookGeneratorQueryInterface,
+    QuickLookGeneratorPluginAddRef,
+    QuickLookGeneratorPluginRelease,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+
+
+// -----------------------------------------------------------------------------
+//     AllocQuickLookGeneratorPluginType
+// -----------------------------------------------------------------------------
+//     Utility function that allocates a new instance.
+//      You can do some initial setup for the generator here if you wish
+//      like allocating globals etc...
+//
+QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID)
+{
+    QuickLookGeneratorPluginType *theNewInstance;
+
+    theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType));
+    memset(theNewInstance,0,sizeof(QuickLookGeneratorPluginType));
+
+        /* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */
+    theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct));
+    memcpy(theNewInstance->conduitInterface,&myInterfaceFtbl,sizeof(QLGeneratorInterfaceStruct));
+
+        /*  Retain and keep an open instance refcount for each factory. */
+    theNewInstance->factoryID = CFRetain(inFactoryID);
+    CFPlugInAddInstanceForFactory(inFactoryID);
+
+        /* This function returns the IUnknown interface so set the refCount to one. */
+    theNewInstance->refCount = 1;
+    return theNewInstance;
+}
+
+// -----------------------------------------------------------------------------
+//     DeallocQuickLookGeneratorPluginType
+// -----------------------------------------------------------------------------
+//     Utility function that deallocates the instance when
+//     the refCount goes to zero.
+//      In the current implementation generator interfaces are never deallocated
+//      but implement this as this might change in the future
+//
+void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance)
+{
+    CFUUIDRef theFactoryID;
+
+    theFactoryID = thisInstance->factoryID;
+        /* Free the conduitInterface table up */
+    free(thisInstance->conduitInterface);
+
+        /* Free the instance structure */
+    free(thisInstance);
+    if (theFactoryID){
+        CFPlugInRemoveInstanceForFactory(theFactoryID);
+        CFRelease(theFactoryID);
+    }
+}
+
+// -----------------------------------------------------------------------------
+//     QuickLookGeneratorQueryInterface
+// -----------------------------------------------------------------------------
+//     Implementation of the IUnknown QueryInterface function.
+//
+HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv)
+{
+    CFUUIDRef interfaceID;
+
+    interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid);
+
+    if (CFEqual(interfaceID,kQLGeneratorCallbacksInterfaceID)){
+            /* If the Right interface was requested, bump the ref count,
+             * set the ppv parameter equal to the instance, and
+             * return good status.
+             */
+        ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GenerateThumbnailForURL = GenerateThumbnailForURL;
+        ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelThumbnailGeneration = CancelThumbnailGeneration;
+        ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GeneratePreviewForURL = GeneratePreviewForURL;
+        ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelPreviewGeneration = CancelPreviewGeneration;
+        ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance);
+        *ppv = thisInstance;
+        CFRelease(interfaceID);
+        return S_OK;
+    }else{
+        /* Requested interface unknown, bail with error. */
+        *ppv = NULL;
+        CFRelease(interfaceID);
+        return E_NOINTERFACE;
+    }
+}
+
+// -----------------------------------------------------------------------------
+// QuickLookGeneratorPluginAddRef
+// -----------------------------------------------------------------------------
+//     Implementation of reference counting for this type. Whenever an interface
+//     is requested, bump the refCount for the instance. NOTE: returning the
+//     refcount is a convention but is not required so don't rely on it.
+//
+ULONG QuickLookGeneratorPluginAddRef(void *thisInstance)
+{
+    ((QuickLookGeneratorPluginType *)thisInstance )->refCount += 1;
+    return ((QuickLookGeneratorPluginType*) thisInstance)->refCount;
+}
+
+// -----------------------------------------------------------------------------
+// QuickLookGeneratorPluginRelease
+// -----------------------------------------------------------------------------
+//     When an interface is released, decrement the refCount.
+//     If the refCount goes to zero, deallocate the instance.
+//
+ULONG QuickLookGeneratorPluginRelease(void *thisInstance)
+{
+    ((QuickLookGeneratorPluginType*)thisInstance)->refCount -= 1;
+    if (((QuickLookGeneratorPluginType*)thisInstance)->refCount == 0){
+        DeallocQuickLookGeneratorPluginType((QuickLookGeneratorPluginType*)thisInstance );
+        return 0;
+    }else{
+        return ((QuickLookGeneratorPluginType*) thisInstance )->refCount;
+    }
+}
+
+// -----------------------------------------------------------------------------
+//  QuickLookGeneratorPluginFactory
+// -----------------------------------------------------------------------------
+void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID)
+{
+    QuickLookGeneratorPluginType *result;
+    CFUUIDRef                 uuid;
+
+        /* If correct type is being requested, allocate an
+         * instance of kQLGeneratorTypeID and return the IUnknown interface.
+         */
+    if (CFEqual(typeID,kQLGeneratorTypeID)){
+        uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID));
+        result = AllocQuickLookGeneratorPluginType(uuid);
+        CFRelease(uuid);
+        return result;
+    }
+        /* If the requested type is incorrect, return NULL. */
+    return NULL;
+}
+
diff --git a/macosx/QuickLookPlugin/style.css b/macosx/QuickLookPlugin/style.css
new file mode 100644 (file)
index 0000000..12e3344
--- /dev/null
@@ -0,0 +1,22 @@
+html
+{
+       color: rgb(0,0,0);
+       font-family:'Lucida Grande';
+    text-align:left;
+}
+th
+{
+       color: rgb(50,50,50);
+       font-weight: bold;
+    text-align:left; 
+}
+td
+{
+       color: rgb(80,80,80);
+    text-align:left; 
+}
+img.icon
+{
+    vertical-align:text-bottom;
+    margin-right:8px;
+}