I am traveling down the QuickLook path ...

I have followed all directions but my code is not being called by qlmange as evidenced here:

7/12/09 4:46:08 PM qlmanage[855] [QL] Thumbnailing /users/davidblanton/ Aibnb18.pes. Content type UTI: dyn.ah62d4rv4ge81a3px. Generator used: None 7/12/09 4:46:08 PM qlmanage[855] [QL] Thumbnailing for /users/ davidblanton/Aibnb18.pes done (No image created).


Is there some known secret sauce not divulged in the docs?





On Jul 12, 2009, at 12:24 AM, Graham Cox wrote:


On 12/07/2009, at 1:02 PM, David Blanton wrote:

What is the preferred method of showing a file preview (my unique content) in an NSOpenPanel ?

The Accessory View looks 'hooky' to use , I want the preview in the next browser column.



If you can image your content to a JPEG and/or PDF, it's very easy to add these as Quicklook thumbnails and previews to a document package. That avoids the need to write a QL plug-in for your format, and the Open panel and Finder and QL preview in the Finder will display these directly.

You need to use particular names for these preview images - it's given in the docs somewhere. Here's the code I use to add them in my app (subclass of NSDocument):



- (NSFileWrapper*) fileWrapperOfType:(NSString*) typeName error: (NSError**) outError
{
                NSData* mainContent = [self dataOfType:typeName error:outError];

                if( mainContent == nil )
                {
                        if( outError )
*outError = [NSError errorWithDomain:kOrteliusErrorDomain code:kOrteliusNoDataErrorCode userInfo:nil];
                        return nil;
                }

NSFileWrapper* fw = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:nil]; [fw addRegularFileWithContents:mainContent preferredFilename:kOrteliusFilePackageMainContentFile];
                
                // add "Quick Look" preview folder:
                
NSFileWrapper* qlFolder = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:nil];
                [qlFolder setPreferredFilename:@"QuickLook"];
                [fw addFileWrapper:qlFolder];
                [qlFolder release];
                
                // add preview and thumbnail
                
                NSData* preview = [[self drawing] thumbnailData];       // JPEG 
data
                
                if( preview )
[qlFolder addRegularFileWithContents:preview preferredFilename:@"Thumbnail.jpg"];
                
                preview = [[self drawing] pdf]; // PDF data
                if( preview )
[qlFolder addRegularFileWithContents:preview preferredFilename:@"Preview.pdf"];
                
                return [fw autorelease];
}


--Graham







_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to