diff --git a/Kara Quick View.xcodeproj/project.pbxproj b/Kara Quick View.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 6bd24df..de9dea0 --- a/Kara Quick View.xcodeproj/project.pbxproj +++ b/Kara Quick View.xcodeproj/project.pbxproj @@ -7,17 +7,50 @@ objects = { /* Begin PBXBuildFile section */ + 3B05222A15DD9486004E705C /* Kara.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B05222615DD9486004E705C /* Kara.tiff */; }; + 3B05222B15DD9486004E705C /* Mushroom.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B05222715DD9486004E705C /* Mushroom.tiff */; }; + 3B05222C15DD9486004E705C /* Shamrock.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B05222815DD9486004E705C /* Shamrock.tiff */; }; + 3B05222D15DD9486004E705C /* Tree.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B05222915DD9486004E705C /* Tree.tiff */; }; + 3B05223615DDAD85004E705C /* Kara1.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B05223215DDAD85004E705C /* Kara1.tiff */; }; + 3B05223715DDAD85004E705C /* Kara2.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B05223315DDAD85004E705C /* Kara2.tiff */; }; + 3B05223815DDAD85004E705C /* Kara3.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B05223415DDAD85004E705C /* Kara3.tiff */; }; + 3B05223915DDAD85004E705C /* Kara0.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B05223515DDAD85004E705C /* Kara0.tiff */; }; 3B19AB2515DC06BF00A9737D /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B19AB2415DC06BF00A9737D /* QuickLook.framework */; }; 3B19AB2715DC06BF00A9737D /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B19AB2615DC06BF00A9737D /* ApplicationServices.framework */; }; 3B19AB2915DC06BF00A9737D /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B19AB2815DC06BF00A9737D /* CoreServices.framework */; }; 3B19AB2B15DC06BF00A9737D /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B19AB2A15DC06BF00A9737D /* CoreFoundation.framework */; }; 3B19AB3115DC06BF00A9737D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3B19AB2F15DC06BF00A9737D /* InfoPlist.strings */; }; - 3B19AB3315DC06BF00A9737D /* GenerateThumbnailForURL.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B19AB3215DC06BF00A9737D /* GenerateThumbnailForURL.c */; }; - 3B19AB3515DC06BF00A9737D /* GeneratePreviewForURL.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B19AB3415DC06BF00A9737D /* GeneratePreviewForURL.c */; }; + 3B19AB3315DC06BF00A9737D /* GenerateThumbnailForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B19AB3215DC06BF00A9737D /* GenerateThumbnailForURL.m */; }; + 3B19AB3515DC06BF00A9737D /* GeneratePreviewForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B19AB3415DC06BF00A9737D /* GeneratePreviewForURL.m */; }; 3B19AB3715DC06BF00A9737D /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B19AB3615DC06BF00A9737D /* main.c */; }; + 3B19AB4315DC3E6500A9737D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B19AB4215DC3E6500A9737D /* Cocoa.framework */; }; + 3B19AB4915DC41DC00A9737D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B19AB4815DC41DC00A9737D /* AppKit.framework */; }; + 3B19AB4B15DC41E200A9737D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B19AB4A15DC41E200A9737D /* Foundation.framework */; }; + 3B19AB5115DC493300A9737D /* Kara Quick View.qlgenerator in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B19AB2115DC06BF00A9737D /* Kara Quick View.qlgenerator */; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + 3B19AB4F15DC491500A9737D /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "~/Library/QuickLook"; + dstSubfolderSpec = 0; + files = ( + 3B19AB5115DC493300A9737D /* Kara Quick View.qlgenerator in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ + 3B05222615DD9486004E705C /* Kara.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Kara.tiff; sourceTree = ""; }; + 3B05222715DD9486004E705C /* Mushroom.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Mushroom.tiff; sourceTree = ""; }; + 3B05222815DD9486004E705C /* Shamrock.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Shamrock.tiff; sourceTree = ""; }; + 3B05222915DD9486004E705C /* Tree.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Tree.tiff; sourceTree = ""; }; + 3B05223215DDAD85004E705C /* Kara1.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Kara1.tiff; sourceTree = ""; }; + 3B05223315DDAD85004E705C /* Kara2.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Kara2.tiff; sourceTree = ""; }; + 3B05223415DDAD85004E705C /* Kara3.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Kara3.tiff; sourceTree = ""; }; + 3B05223515DDAD85004E705C /* Kara0.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Kara0.tiff; sourceTree = ""; }; 3B19AB2115DC06BF00A9737D /* Kara Quick View.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Kara Quick View.qlgenerator"; sourceTree = BUILT_PRODUCTS_DIR; }; 3B19AB2415DC06BF00A9737D /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; }; 3B19AB2615DC06BF00A9737D /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; }; @@ -25,10 +58,14 @@ 3B19AB2A15DC06BF00A9737D /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 3B19AB2E15DC06BF00A9737D /* Kara Quick View-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Kara Quick View-Info.plist"; sourceTree = ""; }; 3B19AB3015DC06BF00A9737D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 3B19AB3215DC06BF00A9737D /* GenerateThumbnailForURL.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = GenerateThumbnailForURL.c; sourceTree = ""; }; - 3B19AB3415DC06BF00A9737D /* GeneratePreviewForURL.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = GeneratePreviewForURL.c; sourceTree = ""; }; + 3B19AB3215DC06BF00A9737D /* GenerateThumbnailForURL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GenerateThumbnailForURL.m; sourceTree = ""; }; + 3B19AB3415DC06BF00A9737D /* GeneratePreviewForURL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GeneratePreviewForURL.m; sourceTree = ""; }; 3B19AB3615DC06BF00A9737D /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; 3B19AB3815DC06BF00A9737D /* Kara Quick View-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Kara Quick View-Prefix.pch"; sourceTree = ""; }; + 3B19AB4215DC3E6500A9737D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 3B19AB4815DC41DC00A9737D /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 3B19AB4A15DC41E200A9737D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 3BB78A0B15DE82D900DA6913 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -36,6 +73,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3B19AB4B15DC41E200A9737D /* Foundation.framework in Frameworks */, + 3B19AB4915DC41DC00A9737D /* AppKit.framework in Frameworks */, + 3B19AB4315DC3E6500A9737D /* Cocoa.framework in Frameworks */, 3B19AB2515DC06BF00A9737D /* QuickLook.framework in Frameworks */, 3B19AB2715DC06BF00A9737D /* ApplicationServices.framework in Frameworks */, 3B19AB2915DC06BF00A9737D /* CoreServices.framework in Frameworks */, @@ -46,6 +86,21 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3B05222515DD9486004E705C /* Icons */ = { + isa = PBXGroup; + children = ( + 3B05222615DD9486004E705C /* Kara.tiff */, + 3B05223215DDAD85004E705C /* Kara1.tiff */, + 3B05223315DDAD85004E705C /* Kara2.tiff */, + 3B05223415DDAD85004E705C /* Kara3.tiff */, + 3B05223515DDAD85004E705C /* Kara0.tiff */, + 3B05222715DD9486004E705C /* Mushroom.tiff */, + 3B05222815DD9486004E705C /* Shamrock.tiff */, + 3B05222915DD9486004E705C /* Tree.tiff */, + ); + path = Icons; + sourceTree = ""; + }; 3B19AB1415DC06BF00A9737D = { isa = PBXGroup; children = ( @@ -66,6 +121,9 @@ 3B19AB2315DC06BF00A9737D /* Frameworks */ = { isa = PBXGroup; children = ( + 3B19AB4A15DC41E200A9737D /* Foundation.framework */, + 3B19AB4815DC41DC00A9737D /* AppKit.framework */, + 3B19AB4215DC3E6500A9737D /* Cocoa.framework */, 3B19AB2415DC06BF00A9737D /* QuickLook.framework */, 3B19AB2615DC06BF00A9737D /* ApplicationServices.framework */, 3B19AB2815DC06BF00A9737D /* CoreServices.framework */, @@ -77,8 +135,9 @@ 3B19AB2C15DC06BF00A9737D /* Kara Quick View */ = { isa = PBXGroup; children = ( - 3B19AB3215DC06BF00A9737D /* GenerateThumbnailForURL.c */, - 3B19AB3415DC06BF00A9737D /* GeneratePreviewForURL.c */, + 3B19AB3215DC06BF00A9737D /* GenerateThumbnailForURL.m */, + 3B19AB3415DC06BF00A9737D /* GeneratePreviewForURL.m */, + 3B05222515DD9486004E705C /* Icons */, 3B19AB3615DC06BF00A9737D /* main.c */, 3B19AB2D15DC06BF00A9737D /* Supporting Files */, ); @@ -117,6 +176,7 @@ 3B19AB1D15DC06BF00A9737D /* Headers */, 3B19AB1E15DC06BF00A9737D /* Resources */, 3B19AB1F15DC06BF00A9737D /* Rez */, + 3B19AB4F15DC491500A9737D /* CopyFiles */, ); buildRules = ( ); @@ -158,6 +218,14 @@ buildActionMask = 2147483647; files = ( 3B19AB3115DC06BF00A9737D /* InfoPlist.strings in Resources */, + 3B05222A15DD9486004E705C /* Kara.tiff in Resources */, + 3B05222B15DD9486004E705C /* Mushroom.tiff in Resources */, + 3B05222C15DD9486004E705C /* Shamrock.tiff in Resources */, + 3B05222D15DD9486004E705C /* Tree.tiff in Resources */, + 3B05223615DDAD85004E705C /* Kara1.tiff in Resources */, + 3B05223715DDAD85004E705C /* Kara2.tiff in Resources */, + 3B05223815DDAD85004E705C /* Kara3.tiff in Resources */, + 3B05223915DDAD85004E705C /* Kara0.tiff in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -178,8 +246,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 3B19AB3315DC06BF00A9737D /* GenerateThumbnailForURL.c in Sources */, - 3B19AB3515DC06BF00A9737D /* GeneratePreviewForURL.c in Sources */, + 3B19AB3315DC06BF00A9737D /* GenerateThumbnailForURL.m in Sources */, + 3B19AB3515DC06BF00A9737D /* GeneratePreviewForURL.m in Sources */, 3B19AB3715DC06BF00A9737D /* main.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -191,6 +259,7 @@ isa = PBXVariantGroup; children = ( 3B19AB3015DC06BF00A9737D /* en */, + 3BB78A0B15DE82D900DA6913 /* de */, ); name = InfoPlist.strings; sourceTree = ""; @@ -250,6 +319,7 @@ 3B19AB3C15DC06BF00A9737D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Kara Quick View/Kara Quick View-Prefix.pch"; @@ -263,6 +333,7 @@ 3B19AB3D15DC06BF00A9737D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Kara Quick View/Kara Quick View-Prefix.pch"; @@ -292,6 +363,7 @@ 3B19AB3D15DC06BF00A9737D /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/Kara Quick View.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Kara Quick View.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100755 index 0000000..ff3b8b9 --- /dev/null +++ b/Kara Quick View.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Kara Quick View.xcodeproj/project.xcworkspace/xcuserdata/kim.xcuserdatad/UserInterfaceState.xcuserstate b/Kara Quick View.xcodeproj/project.xcworkspace/xcuserdata/kim.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100755 index 0000000..620f6dc Binary files /dev/null and b/Kara Quick View.xcodeproj/project.xcworkspace/xcuserdata/kim.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Kara Quick View.xcodeproj/project.xcworkspace/xcuserdata/kim.xcuserdatad/WorkspaceSettings.xcsettings b/Kara Quick View.xcodeproj/project.xcworkspace/xcuserdata/kim.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100755 index 0000000..bfffcfe --- /dev/null +++ b/Kara Quick View.xcodeproj/project.xcworkspace/xcuserdata/kim.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges + + SnapshotAutomaticallyBeforeSignificantChanges + + + diff --git a/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100755 index 0000000..05301bc --- /dev/null +++ b/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcschemes/Kara Quick View.xcscheme b/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcschemes/Kara Quick View.xcscheme new file mode 100755 index 0000000..6dda930 --- /dev/null +++ b/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcschemes/Kara Quick View.xcscheme @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcschemes/xcschememanagement.plist b/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100755 index 0000000..975320f --- /dev/null +++ b/Kara Quick View.xcodeproj/xcuserdata/kim.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + Kara Quick View.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 3B19AB2015DC06BF00A9737D + + primary + + + + + diff --git a/Kara Quick View/GeneratePreviewForURL.c b/Kara Quick View/GeneratePreviewForURL.c deleted file mode 100644 index f18fdae..0000000 --- a/Kara Quick View/GeneratePreviewForURL.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -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 -} diff --git a/Kara Quick View/GeneratePreviewForURL.m b/Kara Quick View/GeneratePreviewForURL.m new file mode 100755 index 0000000..f85fec3 --- /dev/null +++ b/Kara Quick View/GeneratePreviewForURL.m @@ -0,0 +1,219 @@ +#import +#import +#import +#import + +@interface FakeClass : NSObject + +@end + +@implementation FakeClass + +@end + +OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options); +void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview); + +struct Kara { + CGFloat x; + CGFloat y; + CGFloat direction; +}; +typedef struct Kara Kara; + +/* ----------------------------------------------------------------------------- + Generate a preview for file + + This function's job is to create preview for designated file + ----------------------------------------------------------------------------- */ + +void HandleError(NSError *error) +{ + +} + +NSPoint ConvertXMLElelementToPoint(NSXMLElement *element) +{ + NSPoint point; + point.x = [[[element attributeForName:@"x"] stringValue] integerValue]; + point.y = [[[element attributeForName:@"y"] stringValue] integerValue]; + return point; +} + +int fieldBorderLength = 10; + +NSPoint ConvertPointToFlipped(NSPoint point, NSSize world) +{ + NSPoint flippedPoint; + flippedPoint.x = point.x; + flippedPoint.y = world.height-point.y-1; + return flippedPoint; +} + +void DrawBackground(NSSize world) { + NSColor *greenBackground = [NSColor colorWithCalibratedRed:180/255.0 green:230/255.0 blue:180/255.0 alpha:1]; + [greenBackground set]; + NSRectFill(NSMakeRect(0, 0, world.width*fieldBorderLength, world.height*fieldBorderLength)); +} + +void DrawField(NSSize world) +{ + for (int y = 0; y 0) { + NSXMLElement *karaElement = [node.children objectAtIndex:0]; + kara.x = [[[karaElement attributeForName:@"x"] stringValue] integerValue]; + kara.y = [[[karaElement attributeForName:@"y"] stringValue] integerValue]; + kara.direction = [[[karaElement attributeForName:@"direction"] stringValue] integerValue]; + karaExists = YES; + } + } + } + + NSSize world = NSMakeSize(worldWidth, worldHeight); + NSSize field = NSMakeSize(worldWidth*fieldBorderLength, worldHeight*fieldBorderLength); + + CGContextRef cgContext = QLPreviewRequestCreateContext(preview, *(CGSize *)&field, false, NULL); + NSGraphicsContext* context = [NSGraphicsContext graphicsContextWithGraphicsPort:(void *)cgContext flipped:YES]; + + if (context) { + [NSGraphicsContext setCurrentContext:context]; + + DrawBackground(world); + DrawField(world); + DrawObjects(trees, @"Tree", world); + DrawObjects(leafs, @"Shamrock", world); + DrawObjects(mushrooms, @"Mushroom", world); + if (karaExists) { + DrawKara(kara, world); + } + + QLPreviewRequestFlushContext(preview, cgContext); + CFRelease(cgContext); + } + + return noErr; + +} + +OSStatus GenerateProgramPreview(QLPreviewRequestRef preview, NSXMLElement *root) +{ + return noErr; +} + +OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options) +{ + NSXMLDocument *xmlDoc; + NSError *err=nil; + NSURL *furl = (__bridge NSURL *)url; + if (!furl) { + NSLog(@"Can't create an URL from file %@.", furl.path); + return noErr; + } + xmlDoc = [[NSXMLDocument alloc] initWithContentsOfURL:furl options:(NSXMLNodePreserveWhitespace|NSXMLNodePreserveCDATA) error:&err]; + if (xmlDoc == nil) { + xmlDoc = [[NSXMLDocument alloc] initWithContentsOfURL:furl options:NSXMLDocumentTidyXML error:&err]; + } + if (xmlDoc == nil) { + if (err) { + HandleError(err); + } + return noErr; + } + + if (err) { + HandleError(err); + return noErr; + } + + NSXMLElement *root = xmlDoc.rootElement; + + if ([furl.pathExtension compare:@"world" options:NSCaseInsensitiveSearch] == NSOrderedSame) { + return GenerateWorldPreview(preview, root); + } else if ([furl.pathExtension compare:@"kara" options:NSCaseInsensitiveSearch] == NSOrderedSame) { + return GenerateProgramPreview(preview, root); + } + return noErr; +} + +void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview) +{ + // Implement only if supported +} diff --git a/Kara Quick View/GenerateThumbnailForURL.c b/Kara Quick View/GenerateThumbnailForURL.m old mode 100644 new mode 100755 similarity index 100% rename from Kara Quick View/GenerateThumbnailForURL.c rename to Kara Quick View/GenerateThumbnailForURL.m diff --git a/Kara Quick View/Icons/Kara.tiff b/Kara Quick View/Icons/Kara.tiff new file mode 100755 index 0000000..1704129 Binary files /dev/null and b/Kara Quick View/Icons/Kara.tiff differ diff --git a/Kara Quick View/Icons/Kara0.tiff b/Kara Quick View/Icons/Kara0.tiff new file mode 100755 index 0000000..1704129 Binary files /dev/null and b/Kara Quick View/Icons/Kara0.tiff differ diff --git a/Kara Quick View/Icons/Kara1.tiff b/Kara Quick View/Icons/Kara1.tiff new file mode 100755 index 0000000..ce77fc1 Binary files /dev/null and b/Kara Quick View/Icons/Kara1.tiff differ diff --git a/Kara Quick View/Icons/Kara2.tiff b/Kara Quick View/Icons/Kara2.tiff new file mode 100755 index 0000000..24fd869 Binary files /dev/null and b/Kara Quick View/Icons/Kara2.tiff differ diff --git a/Kara Quick View/Icons/Kara3.tiff b/Kara Quick View/Icons/Kara3.tiff new file mode 100755 index 0000000..354bbca Binary files /dev/null and b/Kara Quick View/Icons/Kara3.tiff differ diff --git a/Kara Quick View/Icons/Mushroom.tiff b/Kara Quick View/Icons/Mushroom.tiff new file mode 100755 index 0000000..d93177d Binary files /dev/null and b/Kara Quick View/Icons/Mushroom.tiff differ diff --git a/Kara Quick View/Icons/Shamrock.tiff b/Kara Quick View/Icons/Shamrock.tiff new file mode 100755 index 0000000..06a1259 Binary files /dev/null and b/Kara Quick View/Icons/Shamrock.tiff differ diff --git a/Kara Quick View/Icons/Tree.tiff b/Kara Quick View/Icons/Tree.tiff new file mode 100755 index 0000000..958b26e Binary files /dev/null and b/Kara Quick View/Icons/Tree.tiff differ diff --git a/Kara Quick View/Kara Quick View-Info.plist b/Kara Quick View/Kara Quick View-Info.plist old mode 100644 new mode 100755 index ed1e2a1..b3bbef9 --- a/Kara Quick View/Kara Quick View-Info.plist +++ b/Kara Quick View/Kara Quick View-Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - English + de_DE CFBundleDocumentTypes @@ -11,7 +11,7 @@ QLGenerator LSItemContentTypes - SUPPORTED_UTI_TYPE + ch.karatojava.Kara-World @@ -57,5 +57,7 @@ QLThumbnailMinimumSize 17 + UTImportedTypeDeclarations + diff --git a/Kara Quick View/Kara Quick View-Prefix.pch b/Kara Quick View/Kara Quick View-Prefix.pch old mode 100644 new mode 100755 diff --git a/Kara Quick View/de.lproj/InfoPlist.strings b/Kara Quick View/de.lproj/InfoPlist.strings new file mode 100755 index 0000000..c2f11ff --- /dev/null +++ b/Kara Quick View/de.lproj/InfoPlist.strings @@ -0,0 +1,4 @@ +/* Localized versions of Info.plist keys */ + +/* Kara Welt */ +"Kara World" = "Kara Welt"; \ No newline at end of file diff --git a/Kara Quick View/en.lproj/InfoPlist.strings b/Kara Quick View/en.lproj/InfoPlist.strings old mode 100644 new mode 100755 index 477b28f..35a160e --- a/Kara Quick View/en.lproj/InfoPlist.strings +++ b/Kara Quick View/en.lproj/InfoPlist.strings @@ -1,2 +1,4 @@ /* Localized versions of Info.plist keys */ +/* Kara World */ +"Kara World" = "Kara World"; \ No newline at end of file diff --git a/Kara Quick View/main.c b/Kara Quick View/main.c old mode 100644 new mode 100755 diff --git a/qlmanage b/qlmanage new file mode 100755 index 0000000..f0fd57d Binary files /dev/null and b/qlmanage differ diff --git a/test.kara b/test.kara new file mode 100755 index 0000000..a8487ab --- /dev/null +++ b/test.kara @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test.world b/test.world new file mode 100755 index 0000000..e1ae71d --- /dev/null +++ b/test.world @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + +