Skip to content
Browse files

#14 added quicklook target

  • Loading branch information...
1 parent aea48fc commit 65e59699ebb7c69e5926b52c2fd1b6d7d0fa084e Tae Won Ha committed May 4, 2013
View
181 Qmind.xcodeproj/project.pbxproj
@@ -102,6 +102,14 @@
4B85653514E46D6800C6FF42 /* QMTextLayoutManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B85653514E46D6800C6FF41 /* QMTextLayoutManager.m */; };
4B85653514E46D6800C6FF60 /* QMTextDrawer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B85653514E46D6800C6FF5F /* QMTextDrawer.m */; };
4B85653514E46D6800C6FF69 /* QMCellLayoutManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B85653514E46D6800C6FF68 /* QMCellLayoutManager.m */; };
+ 4B992EF41735176D00C5844E /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B992EF31735176D00C5844E /* QuickLook.framework */; };
+ 4B992EF61735176D00C5844E /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B992EF51735176D00C5844E /* ApplicationServices.framework */; };
+ 4B992EF81735176D00C5844E /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B992EF71735176D00C5844E /* CoreServices.framework */; };
+ 4B992EFA1735176D00C5844E /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B992EF91735176D00C5844E /* CoreFoundation.framework */; };
+ 4B992F001735176D00C5844E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4B992EFE1735176D00C5844E /* InfoPlist.strings */; };
+ 4B992F021735176D00C5844E /* GenerateThumbnailForURL.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B992F011735176D00C5844E /* GenerateThumbnailForURL.c */; };
+ 4B992F041735176D00C5844E /* GeneratePreviewForURL.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B992F031735176D00C5844E /* GeneratePreviewForURL.c */; };
+ 4B992F061735176D00C5844E /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B992F051735176D00C5844E /* main.c */; };
4B9D981016878B0F00222D03 /* CellSizeManagerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B209E6C81B9C03DE0505 /* CellSizeManagerTest.m */; };
4B9DE3341569367500AAF5C1 /* QmindIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4B9DE3331569367500AAF5C1 /* QmindIcon.icns */; };
4BA52C2B14FA52F5000EB8E5 /* cell-population-test.mm in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BFCD7AC14F3E32A00850952 /* cell-population-test.mm */; };
@@ -376,6 +384,17 @@
4B85653514E46D6800C6FF68 /* QMCellLayoutManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QMCellLayoutManager.m; sourceTree = "<group>"; };
4B85653514E46D6800C6FF6B /* QMCellLayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QMCellLayoutManager.h; sourceTree = "<group>"; };
4B85653514E46D6800C6FF78 /* CellLayoutManagerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CellLayoutManagerTest.m; sourceTree = "<group>"; };
+ 4B992EF21735176D00C5844E /* QmindLook.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QmindLook.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4B992EF31735176D00C5844E /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; };
+ 4B992EF51735176D00C5844E /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; };
+ 4B992EF71735176D00C5844E /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
+ 4B992EF91735176D00C5844E /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
+ 4B992EFD1735176D00C5844E /* QmindLook-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "QmindLook-Info.plist"; sourceTree = "<group>"; };
+ 4B992EFF1735176D00C5844E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 4B992F011735176D00C5844E /* GenerateThumbnailForURL.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = GenerateThumbnailForURL.c; sourceTree = "<group>"; };
+ 4B992F031735176D00C5844E /* GeneratePreviewForURL.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = GeneratePreviewForURL.c; sourceTree = "<group>"; };
+ 4B992F051735176D00C5844E /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
+ 4B992F071735176D00C5844E /* QmindLook-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "QmindLook-Prefix.pch"; sourceTree = "<group>"; };
4B9DE3331569367500AAF5C1 /* QmindIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = QmindIcon.icns; path = Resources/QmindIcon.icns; sourceTree = "<group>"; };
4BCA0464158CB94B0034CB4A /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = /Applications/Xcode.app/Contents/Developer/Library/Frameworks/SenTestingKit.framework; sourceTree = "<absolute>"; };
4BDA77FA170F8080000AB84A /* Sparkle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sparkle.xcodeproj; path = sparke/Sparkle.xcodeproj; sourceTree = "<group>"; };
@@ -441,6 +460,17 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 4B992EED1735176D00C5844E /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4B992EF41735176D00C5844E /* QuickLook.framework in Frameworks */,
+ 4B992EF61735176D00C5844E /* ApplicationServices.framework in Frameworks */,
+ 4B992EF81735176D00C5844E /* CoreServices.framework in Frameworks */,
+ 4B992EFA1735176D00C5844E /* CoreFoundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
4BFCD75214F3D34700850924 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -541,6 +571,7 @@
4B15776516A2EFEF0048480E /* Qkit.xcodeproj */,
4B03B23F1628724000E5ECA2 /* TBCacao.xcodeproj */,
4BDA77FA170F8080000AB84A /* Sparkle.xcodeproj */,
+ 4B992EFB1735176D00C5844E /* QmindLook */,
4B8564C414E461DC00C6FF0A /* Frameworks */,
4B8564C214E461DC00C6FF0A /* Products */,
);
@@ -551,6 +582,7 @@
children = (
4B8564C114E461DC00C6FF0A /* Qmind.app */,
4BFCD75614F3D34700850924 /* QmindSenTesting.octest */,
+ 4B992EF21735176D00C5844E /* QmindLook.qlgenerator */,
);
name = Products;
sourceTree = "<group>";
@@ -562,6 +594,10 @@
4B85653514E46D6800C6FF5D /* OCMockito.framework */,
4B85653514E46D6800C6FF1D /* OCHamcrest.framework */,
4B8564C514E461DC00C6FF0A /* Cocoa.framework */,
+ 4B992EF31735176D00C5844E /* QuickLook.framework */,
+ 4B992EF51735176D00C5844E /* ApplicationServices.framework */,
+ 4B992EF71735176D00C5844E /* CoreServices.framework */,
+ 4B992EF91735176D00C5844E /* CoreFoundation.framework */,
4B8564C714E461DC00C6FF0A /* Other Frameworks */,
);
name = Frameworks;
@@ -792,6 +828,27 @@
name = "Window Controllers";
sourceTree = "<group>";
};
+ 4B992EFB1735176D00C5844E /* QmindLook */ = {
+ isa = PBXGroup;
+ children = (
+ 4B992F011735176D00C5844E /* GenerateThumbnailForURL.c */,
+ 4B992F031735176D00C5844E /* GeneratePreviewForURL.c */,
+ 4B992F051735176D00C5844E /* main.c */,
+ 4B992EFC1735176D00C5844E /* Supporting Files */,
+ );
+ path = QmindLook;
+ sourceTree = "<group>";
+ };
+ 4B992EFC1735176D00C5844E /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 4B992EFD1735176D00C5844E /* QmindLook-Info.plist */,
+ 4B992EFE1735176D00C5844E /* InfoPlist.strings */,
+ 4B992F071735176D00C5844E /* QmindLook-Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
4BDA77FB170F8080000AB84A /* Products */ = {
isa = PBXGroup;
children = (
@@ -830,6 +887,16 @@
};
/* End PBXGroup section */
+/* Begin PBXHeadersBuildPhase section */
+ 4B992EEE1735176D00C5844E /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
/* Begin PBXNativeTarget section */
4B8564C014E461DC00C6FF0A /* Qmind */ = {
isa = PBXNativeTarget;
@@ -852,6 +919,25 @@
productReference = 4B8564C114E461DC00C6FF0A /* Qmind.app */;
productType = "com.apple.product-type.application";
};
+ 4B992EF11735176D00C5844E /* QmindLook */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4B992F081735176D00C5844E /* Build configuration list for PBXNativeTarget "QmindLook" */;
+ buildPhases = (
+ 4B992EEC1735176D00C5844E /* Sources */,
+ 4B992EED1735176D00C5844E /* Frameworks */,
+ 4B992EEE1735176D00C5844E /* Headers */,
+ 4B992EEF1735176D00C5844E /* Resources */,
+ 4B992EF01735176D00C5844E /* Rez */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = QmindLook;
+ productName = QmindLook;
+ productReference = 4B992EF21735176D00C5844E /* QmindLook.qlgenerator */;
+ productType = "com.apple.product-type.bundle";
+ };
4BFCD75514F3D34700850924 /* QmindSenTesting */ = {
isa = PBXNativeTarget;
buildConfigurationList = 4BFCD76314F3D34700850924 /* Build configuration list for PBXNativeTarget "QmindSenTesting" */;
@@ -911,6 +997,7 @@
targets = (
4B8564C014E461DC00C6FF0A /* Qmind */,
4BFCD75514F3D34700850924 /* QmindSenTesting */,
+ 4B992EF11735176D00C5844E /* QmindLook */,
);
};
/* End PBXProject section */
@@ -1012,6 +1099,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 4B992EEF1735176D00C5844E /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4B992F001735176D00C5844E /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
4BFCD75314F3D34700850924 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1024,6 +1119,16 @@
};
/* End PBXResourcesBuildPhase section */
+/* Begin PBXRezBuildPhase section */
+ 4B992EF01735176D00C5844E /* Rez */ = {
+ isa = PBXRezBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXRezBuildPhase section */
+
/* Begin PBXShellScriptBuildPhase section */
4BFCD75414F3D34700850924 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -1078,6 +1183,16 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 4B992EEC1735176D00C5844E /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4B992F021735176D00C5844E /* GenerateThumbnailForURL.c in Sources */,
+ 4B992F041735176D00C5844E /* GeneratePreviewForURL.c in Sources */,
+ 4B992F061735176D00C5844E /* main.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
4BFCD75114F3D34700850924 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1219,6 +1334,14 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
+ 4B992EFE1735176D00C5844E /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 4B992EFF1735176D00C5844E /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
4BDC9D8E1524EEAD008CEB8E /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
@@ -1259,9 +1382,8 @@
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
ONLY_ACTIVE_ARCH = YES;
- SDKROOT = macosx10.7;
VALID_ARCHS = x86_64;
};
name = Debug;
@@ -1281,8 +1403,7 @@
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.7;
- SDKROOT = macosx10.7;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
VALID_ARCHS = x86_64;
};
name = Release;
@@ -1317,6 +1438,50 @@
};
name = Release;
};
+ 4B992F091735176D00C5844E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COMBINE_HIDPI_IMAGES = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "QmindLook/QmindLook-Prefix.pch";
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ INFOPLIST_FILE = "QmindLook/QmindLook-Info.plist";
+ INSTALL_PATH = /Library/QuickLook;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
+ WRAPPER_EXTENSION = qlgenerator;
+ };
+ name = Debug;
+ };
+ 4B992F0A1735176D00C5844E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COMBINE_HIDPI_IMAGES = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "QmindLook/QmindLook-Prefix.pch";
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ INFOPLIST_FILE = "QmindLook/QmindLook-Info.plist";
+ INSTALL_PATH = /Library/QuickLook;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
+ WRAPPER_EXTENSION = qlgenerator;
+ };
+ name = Release;
+ };
4BFCD76414F3D34700850924 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -1372,6 +1537,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 4B992F081735176D00C5844E /* Build configuration list for PBXNativeTarget "QmindLook" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4B992F091735176D00C5844E /* Debug */,
+ 4B992F0A1735176D00C5844E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
4BFCD76314F3D34700850924 /* Build configuration list for PBXNativeTarget "QmindSenTesting" */ = {
isa = XCConfigurationList;
buildConfigurations = (
View
16 QmindLook/GeneratePreviewForURL.c
@@ -0,0 +1,16 @@
+#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);
+
+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
+}
View
16 QmindLook/GenerateThumbnailForURL.c
@@ -0,0 +1,16 @@
+#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);
+
+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
+}
View
61 QmindLook/QmindLook-Info.plist
@@ -0,0 +1,61 @@
+<?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>SUPPORTED_UTI_TYPE</string>
+ </array>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.qvacua.${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>A1E7E366-82DB-40F8-8B63-2131C8C9E647</key>
+ <string>QuickLookGeneratorPluginFactory</string>
+ </dict>
+ <key>CFPlugInTypes</key>
+ <dict>
+ <key>5E2D9680-5022-40FA-B806-43349622E5B9</key>
+ <array>
+ <string>A1E7E366-82DB-40F8-8B63-2131C8C9E647</string>
+ </array>
+ </dict>
+ <key>CFPlugInUnloadFunction</key>
+ <string></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>
View
4 QmindLook/QmindLook-Prefix.pch
@@ -0,0 +1,4 @@
+//
+// Prefix header for all source files of the 'QmindLook' target in the 'QmindLook' project
+//
+
View
2 QmindLook/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
View
218 QmindLook/main.c
@@ -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 "A1E7E366-82DB-40F8-8B63-2131C8C9E647"
+
+//
+// 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;
+}
+

0 comments on commit 65e5969

Please sign in to comment.
Something went wrong with that request. Please try again.