Bob Rudis
8 years ago
commit
88ee8ccdd3
8 changed files with 677 additions and 0 deletions
@ -0,0 +1,275 @@ |
|||
// !$*UTF8*$! |
|||
{ |
|||
archiveVersion = 1; |
|||
classes = { |
|||
}; |
|||
objectVersion = 46; |
|||
objects = { |
|||
|
|||
/* Begin PBXBuildFile section */ |
|||
C4291BEF1D552859001238D2 /* GenerateThumbnailForURL.c in Sources */ = {isa = PBXBuildFile; fileRef = C4291BEE1D552859001238D2 /* GenerateThumbnailForURL.c */; }; |
|||
C4291BF11D552859001238D2 /* GeneratePreviewForURL.c in Sources */ = {isa = PBXBuildFile; fileRef = C4291BF01D552859001238D2 /* GeneratePreviewForURL.c */; }; |
|||
C4291BF31D552859001238D2 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = C4291BF21D552859001238D2 /* main.c */; }; |
|||
/* End PBXBuildFile section */ |
|||
|
|||
/* Begin PBXFileReference section */ |
|||
C4291BEB1D552859001238D2 /* QuickLookR.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QuickLookR.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; }; |
|||
C4291BEE1D552859001238D2 /* GenerateThumbnailForURL.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = GenerateThumbnailForURL.c; sourceTree = "<group>"; }; |
|||
C4291BF01D552859001238D2 /* GeneratePreviewForURL.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = GeneratePreviewForURL.c; sourceTree = "<group>"; }; |
|||
C4291BF21D552859001238D2 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; }; |
|||
C4291BF41D552859001238D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
|||
/* End PBXFileReference section */ |
|||
|
|||
/* Begin PBXFrameworksBuildPhase section */ |
|||
C4291BE71D552859001238D2 /* Frameworks */ = { |
|||
isa = PBXFrameworksBuildPhase; |
|||
buildActionMask = 2147483647; |
|||
files = ( |
|||
); |
|||
runOnlyForDeploymentPostprocessing = 0; |
|||
}; |
|||
/* End PBXFrameworksBuildPhase section */ |
|||
|
|||
/* Begin PBXGroup section */ |
|||
C4291BE11D552859001238D2 = { |
|||
isa = PBXGroup; |
|||
children = ( |
|||
C4291BED1D552859001238D2 /* QuickLookR */, |
|||
C4291BEC1D552859001238D2 /* Products */, |
|||
); |
|||
sourceTree = "<group>"; |
|||
}; |
|||
C4291BEC1D552859001238D2 /* Products */ = { |
|||
isa = PBXGroup; |
|||
children = ( |
|||
C4291BEB1D552859001238D2 /* QuickLookR.qlgenerator */, |
|||
); |
|||
name = Products; |
|||
sourceTree = "<group>"; |
|||
}; |
|||
C4291BED1D552859001238D2 /* QuickLookR */ = { |
|||
isa = PBXGroup; |
|||
children = ( |
|||
C4291BEE1D552859001238D2 /* GenerateThumbnailForURL.c */, |
|||
C4291BF01D552859001238D2 /* GeneratePreviewForURL.c */, |
|||
C4291BF21D552859001238D2 /* main.c */, |
|||
C4291BF41D552859001238D2 /* Info.plist */, |
|||
); |
|||
path = QuickLookR; |
|||
sourceTree = "<group>"; |
|||
}; |
|||
/* End PBXGroup section */ |
|||
|
|||
/* Begin PBXHeadersBuildPhase section */ |
|||
C4291BE81D552859001238D2 /* Headers */ = { |
|||
isa = PBXHeadersBuildPhase; |
|||
buildActionMask = 2147483647; |
|||
files = ( |
|||
); |
|||
runOnlyForDeploymentPostprocessing = 0; |
|||
}; |
|||
/* End PBXHeadersBuildPhase section */ |
|||
|
|||
/* Begin PBXNativeTarget section */ |
|||
C4291BEA1D552859001238D2 /* QuickLookR */ = { |
|||
isa = PBXNativeTarget; |
|||
buildConfigurationList = C4291BF71D552859001238D2 /* Build configuration list for PBXNativeTarget "QuickLookR" */; |
|||
buildPhases = ( |
|||
C4291BE61D552859001238D2 /* Sources */, |
|||
C4291BE71D552859001238D2 /* Frameworks */, |
|||
C4291BE81D552859001238D2 /* Headers */, |
|||
C4291BE91D552859001238D2 /* Resources */, |
|||
); |
|||
buildRules = ( |
|||
); |
|||
dependencies = ( |
|||
); |
|||
name = QuickLookR; |
|||
productName = QuickLookR; |
|||
productReference = C4291BEB1D552859001238D2 /* QuickLookR.qlgenerator */; |
|||
productType = "com.apple.product-type.bundle"; |
|||
}; |
|||
/* End PBXNativeTarget section */ |
|||
|
|||
/* Begin PBXProject section */ |
|||
C4291BE21D552859001238D2 /* Project object */ = { |
|||
isa = PBXProject; |
|||
attributes = { |
|||
LastUpgradeCheck = 0730; |
|||
ORGANIZATIONNAME = "Bob Rudis"; |
|||
TargetAttributes = { |
|||
C4291BEA1D552859001238D2 = { |
|||
CreatedOnToolsVersion = 7.3.1; |
|||
}; |
|||
}; |
|||
}; |
|||
buildConfigurationList = C4291BE51D552859001238D2 /* Build configuration list for PBXProject "QuickLookR" */; |
|||
compatibilityVersion = "Xcode 3.2"; |
|||
developmentRegion = English; |
|||
hasScannedForEncodings = 0; |
|||
knownRegions = ( |
|||
en, |
|||
); |
|||
mainGroup = C4291BE11D552859001238D2; |
|||
productRefGroup = C4291BEC1D552859001238D2 /* Products */; |
|||
projectDirPath = ""; |
|||
projectRoot = ""; |
|||
targets = ( |
|||
C4291BEA1D552859001238D2 /* QuickLookR */, |
|||
); |
|||
}; |
|||
/* End PBXProject section */ |
|||
|
|||
/* Begin PBXResourcesBuildPhase section */ |
|||
C4291BE91D552859001238D2 /* Resources */ = { |
|||
isa = PBXResourcesBuildPhase; |
|||
buildActionMask = 2147483647; |
|||
files = ( |
|||
); |
|||
runOnlyForDeploymentPostprocessing = 0; |
|||
}; |
|||
/* End PBXResourcesBuildPhase section */ |
|||
|
|||
/* Begin PBXSourcesBuildPhase section */ |
|||
C4291BE61D552859001238D2 /* Sources */ = { |
|||
isa = PBXSourcesBuildPhase; |
|||
buildActionMask = 2147483647; |
|||
files = ( |
|||
C4291BEF1D552859001238D2 /* GenerateThumbnailForURL.c in Sources */, |
|||
C4291BF11D552859001238D2 /* GeneratePreviewForURL.c in Sources */, |
|||
C4291BF31D552859001238D2 /* main.c in Sources */, |
|||
); |
|||
runOnlyForDeploymentPostprocessing = 0; |
|||
}; |
|||
/* End PBXSourcesBuildPhase section */ |
|||
|
|||
/* Begin XCBuildConfiguration section */ |
|||
C4291BF51D552859001238D2 /* Debug */ = { |
|||
isa = XCBuildConfiguration; |
|||
buildSettings = { |
|||
ALWAYS_SEARCH_USER_PATHS = NO; |
|||
CLANG_ANALYZER_NONNULL = YES; |
|||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; |
|||
CLANG_CXX_LIBRARY = "libc++"; |
|||
CLANG_ENABLE_MODULES = YES; |
|||
CLANG_ENABLE_OBJC_ARC = YES; |
|||
CLANG_WARN_BOOL_CONVERSION = YES; |
|||
CLANG_WARN_CONSTANT_CONVERSION = YES; |
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; |
|||
CLANG_WARN_EMPTY_BODY = YES; |
|||
CLANG_WARN_ENUM_CONVERSION = YES; |
|||
CLANG_WARN_INT_CONVERSION = YES; |
|||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; |
|||
CLANG_WARN_UNREACHABLE_CODE = YES; |
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; |
|||
CODE_SIGN_IDENTITY = "-"; |
|||
COPY_PHASE_STRIP = NO; |
|||
DEBUG_INFORMATION_FORMAT = dwarf; |
|||
ENABLE_STRICT_OBJC_MSGSEND = YES; |
|||
ENABLE_TESTABILITY = YES; |
|||
GCC_C_LANGUAGE_STANDARD = gnu99; |
|||
GCC_DYNAMIC_NO_PIC = NO; |
|||
GCC_NO_COMMON_BLOCKS = YES; |
|||
GCC_OPTIMIZATION_LEVEL = 0; |
|||
GCC_PREPROCESSOR_DEFINITIONS = ( |
|||
"DEBUG=1", |
|||
"$(inherited)", |
|||
); |
|||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; |
|||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; |
|||
GCC_WARN_UNDECLARED_SELECTOR = YES; |
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
|||
GCC_WARN_UNUSED_FUNCTION = YES; |
|||
GCC_WARN_UNUSED_VARIABLE = YES; |
|||
MACOSX_DEPLOYMENT_TARGET = 10.11; |
|||
MTL_ENABLE_DEBUG_INFO = YES; |
|||
ONLY_ACTIVE_ARCH = YES; |
|||
SDKROOT = macosx; |
|||
}; |
|||
name = Debug; |
|||
}; |
|||
C4291BF61D552859001238D2 /* Release */ = { |
|||
isa = XCBuildConfiguration; |
|||
buildSettings = { |
|||
ALWAYS_SEARCH_USER_PATHS = NO; |
|||
CLANG_ANALYZER_NONNULL = YES; |
|||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; |
|||
CLANG_CXX_LIBRARY = "libc++"; |
|||
CLANG_ENABLE_MODULES = YES; |
|||
CLANG_ENABLE_OBJC_ARC = YES; |
|||
CLANG_WARN_BOOL_CONVERSION = YES; |
|||
CLANG_WARN_CONSTANT_CONVERSION = YES; |
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; |
|||
CLANG_WARN_EMPTY_BODY = YES; |
|||
CLANG_WARN_ENUM_CONVERSION = YES; |
|||
CLANG_WARN_INT_CONVERSION = YES; |
|||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; |
|||
CLANG_WARN_UNREACHABLE_CODE = YES; |
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; |
|||
CODE_SIGN_IDENTITY = "-"; |
|||
COPY_PHASE_STRIP = NO; |
|||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; |
|||
ENABLE_NS_ASSERTIONS = NO; |
|||
ENABLE_STRICT_OBJC_MSGSEND = YES; |
|||
GCC_C_LANGUAGE_STANDARD = gnu99; |
|||
GCC_NO_COMMON_BLOCKS = YES; |
|||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; |
|||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; |
|||
GCC_WARN_UNDECLARED_SELECTOR = YES; |
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
|||
GCC_WARN_UNUSED_FUNCTION = YES; |
|||
GCC_WARN_UNUSED_VARIABLE = YES; |
|||
MACOSX_DEPLOYMENT_TARGET = 10.11; |
|||
MTL_ENABLE_DEBUG_INFO = NO; |
|||
SDKROOT = macosx; |
|||
}; |
|||
name = Release; |
|||
}; |
|||
C4291BF81D552859001238D2 /* Debug */ = { |
|||
isa = XCBuildConfiguration; |
|||
buildSettings = { |
|||
COMBINE_HIDPI_IMAGES = YES; |
|||
INFOPLIST_FILE = QuickLookR/Info.plist; |
|||
INSTALL_PATH = /Library/QuickLook; |
|||
PRODUCT_BUNDLE_IDENTIFIER = is.rud.QuickLookR; |
|||
PRODUCT_NAME = "$(TARGET_NAME)"; |
|||
WRAPPER_EXTENSION = qlgenerator; |
|||
}; |
|||
name = Debug; |
|||
}; |
|||
C4291BF91D552859001238D2 /* Release */ = { |
|||
isa = XCBuildConfiguration; |
|||
buildSettings = { |
|||
COMBINE_HIDPI_IMAGES = YES; |
|||
INFOPLIST_FILE = QuickLookR/Info.plist; |
|||
INSTALL_PATH = /Library/QuickLook; |
|||
PRODUCT_BUNDLE_IDENTIFIER = is.rud.QuickLookR; |
|||
PRODUCT_NAME = "$(TARGET_NAME)"; |
|||
WRAPPER_EXTENSION = qlgenerator; |
|||
}; |
|||
name = Release; |
|||
}; |
|||
/* End XCBuildConfiguration section */ |
|||
|
|||
/* Begin XCConfigurationList section */ |
|||
C4291BE51D552859001238D2 /* Build configuration list for PBXProject "QuickLookR" */ = { |
|||
isa = XCConfigurationList; |
|||
buildConfigurations = ( |
|||
C4291BF51D552859001238D2 /* Debug */, |
|||
C4291BF61D552859001238D2 /* Release */, |
|||
); |
|||
defaultConfigurationIsVisible = 0; |
|||
defaultConfigurationName = Release; |
|||
}; |
|||
C4291BF71D552859001238D2 /* Build configuration list for PBXNativeTarget "QuickLookR" */ = { |
|||
isa = XCConfigurationList; |
|||
buildConfigurations = ( |
|||
C4291BF81D552859001238D2 /* Debug */, |
|||
C4291BF91D552859001238D2 /* Release */, |
|||
); |
|||
defaultConfigurationIsVisible = 0; |
|||
}; |
|||
/* End XCConfigurationList section */ |
|||
}; |
|||
rootObject = C4291BE21D552859001238D2 /* Project object */; |
|||
} |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<Workspace |
|||
version = "1.0"> |
|||
<FileRef |
|||
location = "self:QuickLookR.xcodeproj"> |
|||
</FileRef> |
|||
</Workspace> |
@ -0,0 +1,46 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<Scheme |
|||
LastUpgradeVersion = "0730" |
|||
version = "1.3"> |
|||
<BuildAction |
|||
parallelizeBuildables = "YES" |
|||
buildImplicitDependencies = "YES"> |
|||
</BuildAction> |
|||
<TestAction |
|||
buildConfiguration = "Debug" |
|||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
|||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
|||
shouldUseLaunchSchemeArgsEnv = "YES"> |
|||
<Testables> |
|||
</Testables> |
|||
<AdditionalOptions> |
|||
</AdditionalOptions> |
|||
</TestAction> |
|||
<LaunchAction |
|||
buildConfiguration = "Debug" |
|||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
|||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
|||
launchStyle = "0" |
|||
useCustomWorkingDirectory = "NO" |
|||
ignoresPersistentStateOnLaunch = "NO" |
|||
debugDocumentVersioning = "YES" |
|||
debugServiceExtension = "internal" |
|||
allowLocationSimulation = "YES"> |
|||
<AdditionalOptions> |
|||
</AdditionalOptions> |
|||
</LaunchAction> |
|||
<ProfileAction |
|||
buildConfiguration = "Release" |
|||
shouldUseLaunchSchemeArgsEnv = "YES" |
|||
savedToolIdentifier = "" |
|||
useCustomWorkingDirectory = "NO" |
|||
debugDocumentVersioning = "YES"> |
|||
</ProfileAction> |
|||
<AnalyzeAction |
|||
buildConfiguration = "Debug"> |
|||
</AnalyzeAction> |
|||
<ArchiveAction |
|||
buildConfiguration = "Release" |
|||
revealArchiveInOrganizer = "YES"> |
|||
</ArchiveAction> |
|||
</Scheme> |
@ -0,0 +1,22 @@ |
|||
<?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>SchemeUserState</key> |
|||
<dict> |
|||
<key>QuickLookR.xcscheme</key> |
|||
<dict> |
|||
<key>orderHint</key> |
|||
<integer>0</integer> |
|||
</dict> |
|||
</dict> |
|||
<key>SuppressBuildableAutocreation</key> |
|||
<dict> |
|||
<key>C4291BEA1D552859001238D2</key> |
|||
<dict> |
|||
<key>primary</key> |
|||
<true/> |
|||
</dict> |
|||
</dict> |
|||
</dict> |
|||
</plist> |
@ -0,0 +1,23 @@ |
|||
#include <CoreFoundation/CoreFoundation.h> |
|||
#include <CoreServices/CoreServices.h> |
|||
#include <QuickLook/QuickLook.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) |
|||
{ |
|||
// To complete your generator please implement the function GeneratePreviewForURL in GeneratePreviewForURL.c
|
|||
return noErr; |
|||
} |
|||
|
|||
void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview) |
|||
{ |
|||
// Implement only if supported
|
|||
} |
@ -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
|
|||
} |
@ -0,0 +1,63 @@ |
|||
<?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>en</string> |
|||
<key>CFBundleDocumentTypes</key> |
|||
<array> |
|||
<dict> |
|||
<key>CFBundleTypeRole</key> |
|||
<string>QLGenerator</string> |
|||
<key>LSItemContentTypes</key> |
|||
<array> |
|||
<string>SUPPORTED_UTI_TYPE</string> |
|||
</array> |
|||
</dict> |
|||
</array> |
|||
<key>CFBundleExecutable</key> |
|||
<string>$(EXECUTABLE_NAME)</string> |
|||
<key>CFBundleIdentifier</key> |
|||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> |
|||
<key>CFBundleInfoDictionaryVersion</key> |
|||
<string>6.0</string> |
|||
<key>CFBundleName</key> |
|||
<string>$(PRODUCT_NAME)</string> |
|||
<key>CFBundleShortVersionString</key> |
|||
<string>1.0</string> |
|||
<key>CFBundleSignature</key> |
|||
<string>????</string> |
|||
<key>CFBundleVersion</key> |
|||
<string>1</string> |
|||
<key>CFPlugInDynamicRegisterFunction</key> |
|||
<string></string> |
|||
<key>CFPlugInDynamicRegistration</key> |
|||
<string>NO</string> |
|||
<key>CFPlugInFactories</key> |
|||
<dict> |
|||
<key>786049CE-3ED2-49F7-8F4E-588A57CA2BDB</key> |
|||
<string>QuickLookGeneratorPluginFactory</string> |
|||
</dict> |
|||
<key>CFPlugInTypes</key> |
|||
<dict> |
|||
<key>5E2D9680-5022-40FA-B806-43349622E5B9</key> |
|||
<array> |
|||
<string>786049CE-3ED2-49F7-8F4E-588A57CA2BDB</string> |
|||
</array> |
|||
</dict> |
|||
<key>CFPlugInUnloadFunction</key> |
|||
<string></string> |
|||
<key>NSHumanReadableCopyright</key> |
|||
<string>Copyright © 2016 Bob Rudis. All rights reserved.</string> |
|||
<key>QLNeedsToBeRunInMainThread</key> |
|||
<false/> |
|||
<key>QLPreviewHeight</key> |
|||
<real>600</real> |
|||
<key>QLPreviewWidth</key> |
|||
<real>800</real> |
|||
<key>QLSupportsConcurrentRequests</key> |
|||
<false/> |
|||
<key>QLThumbnailMinimumSize</key> |
|||
<real>17</real> |
|||
</dict> |
|||
</plist> |
@ -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 "786049CE-3ED2-49F7-8F4E-588A57CA2BDB" |
|||
|
|||
//
|
|||
// 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; |
|||
} |
|||
|
Loading…
Reference in new issue