aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-10 12:48:10 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-10 12:48:10 +0000
commita5bf83e7db5c1d75a1a865e5e1e605ee08d0a507 (patch)
tree037a5ce50eadf0f3e3c2aec20b897b52ef36a01a /Source
parent0ffc3f17de7204040d230f4d322b9d9fdc54a2aa (diff)
downloadsequelpro-a5bf83e7db5c1d75a1a865e5e1e605ee08d0a507.tar.gz
sequelpro-a5bf83e7db5c1d75a1a865e5e1e605ee08d0a507.tar.bz2
sequelpro-a5bf83e7db5c1d75a1a865e5e1e605ee08d0a507.zip
• Quicklook generator
- increased default preview height for sql files - increased default preview heigth for spfs files if more than one connection - show for spfs files all windows in reversed order to show the active window on top
Diffstat (limited to 'Source')
-rw-r--r--Source/GeneratePreviewForURL.m17
1 files 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];