From a5bf83e7db5c1d75a1a865e5e1e605ee08d0a507 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 10 Aug 2010 12:48:10 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Quicklook=20generator=20-=20increased=20def?= =?UTF-8?q?ault=20preview=20height=20for=20sql=20files=20-=20increased=20d?= =?UTF-8?q?efault=20preview=20heigth=20for=20spfs=20files=20if=20more=20th?= =?UTF-8?q?an=20one=20connection=20-=20show=20for=20spfs=20files=20all=20w?= =?UTF-8?q?indows=20in=20reversed=20order=20to=20show=20the=20active=20win?= =?UTF-8?q?dow=20on=20top?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/GeneratePreviewForURL.m | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m index c6c980d1..68369ccd 100644 --- a/Source/GeneratePreviewForURL.m +++ b/Source/GeneratePreviewForURL.m @@ -76,6 +76,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, if (QLPreviewRequestIsCancelled(preview)) return noErr; + NSInteger previewHeight = 280; + NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[myURL path] error:nil]; // Dispatch different fiel extensions @@ -247,7 +249,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, NSMutableString *spfsHTML = [NSMutableString string]; NSInteger connectionCounter = 0; - NSArray *theWindows = [spf objectForKey:@"windows"]; + NSArray *theWindows = [[[spf objectForKey:@"windows"] reverseObjectEnumerator] allObjects]; for(NSDictionary *window in theWindows) { NSInteger tabCounter = 0; @@ -340,6 +342,9 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, } + if(connectionCounter > 1) + previewHeight = 495; + html = [[NSMutableString alloc] initWithString:[NSString stringWithFormat:template, [[iconImage TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01] base64EncodingWithLineLength:0], connectionCounter, @@ -455,6 +460,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, sqlHTML ]]; + previewHeight = 495; + } else { // No file attributes were read, bail for safety reasons @@ -465,12 +472,14 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, } } - - CFDictionaryRef properties = (CFDictionaryRef)[NSDictionary dictionary]; + NSMutableDictionary *props; + props = [[[NSMutableDictionary alloc] init] autorelease]; + [props setObject:[NSNumber numberWithInt:previewHeight] forKey:(NSString *)kQLPreviewPropertyHeightKey]; + [props setObject:[NSNumber numberWithInt:600] forKey:(NSString *)kQLPreviewPropertyWidthKey]; QLPreviewRequestSetDataRepresentation(preview, (CFDataRef)[html dataUsingEncoding:NSUTF8StringEncoding], kUTTypeHTML, - properties + (CFDictionaryRef)props ); [html release]; -- cgit v1.2.3