aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-09 14:04:17 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-09 14:04:17 +0000
commit2d945df60f198d98f5e7000202b54f26a8ca1278 (patch)
tree26a94ff19619974c4964a198f54a401e1395a5a3 /Source
parent435863ae95a73a0dec7d5f6c8638525ce9ea31ed (diff)
downloadsequelpro-2d945df60f198d98f5e7000202b54f26a8ca1278.tar.gz
sequelpro-2d945df60f198d98f5e7000202b54f26a8ca1278.tar.bz2
sequelpro-2d945df60f198d98f5e7000202b54f26a8ca1278.zip
• Quicklook generator
- improved icon display by choosing an adequate image of of the icns file - set background to white for all different spf files to be consistent
Diffstat (limited to 'Source')
-rw-r--r--Source/GeneratePreviewForURL.m31
1 files changed, 29 insertions, 2 deletions
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m
index aaf8a903..9f44bdf9 100644
--- a/Source/GeneratePreviewForURL.m
+++ b/Source/GeneratePreviewForURL.m
@@ -63,8 +63,12 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
if (QLPreviewRequestIsCancelled(preview))
return noErr;
- // Get current set file icon
- NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:[myURL path]];
+ // Get current Sequel Pro's set of file icons
+ NSArray *iconImages = [[[NSWorkspace sharedWorkspace] iconForFile:[myURL path]] representations];
+
+ // just in case
+ if(!iconImages || [iconImages count] < 1)
+ iconImages = [NSArray arrayWithObject:[NSImage imageNamed:NSImageNameStopProgressTemplate]];
NSMutableString *html;
NSString *template = nil;
@@ -77,6 +81,12 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
// Dispatch different fiel extensions
if([urlExtension isEqualToString:@"spf"]) {
+ NSImage *iconImage;
+ if([iconImages count] > 0)
+ iconImage = [iconImages objectAtIndex:1];
+ else
+ iconImage = [iconImages objectAtIndex:0];
+
NSError *readError = nil;
NSString *convError = nil;
NSPropertyListFormat format;
@@ -151,6 +161,13 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
}
else if([[spf objectForKey:@"format"] isEqualToString:@"content filters"]) {
+
+ NSImage *iconImage;
+ if([iconImages count] > 0)
+ iconImage = [iconImages objectAtIndex:1];
+ else
+ iconImage = [iconImages objectAtIndex:0];
+
template = [NSString stringWithContentsOfFile:[[NSBundle bundleWithIdentifier:@"com.google.code.sequel-pro.qlgenerator"] pathForResource:@"SPQLPluginContentFiltersTemplate" ofType:@"html"]
encoding:NSUTF8StringEncoding error:&templateReadError];
@@ -166,6 +183,13 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
}
else if([[spf objectForKey:@"format"] isEqualToString:@"query favorites"]) {
+
+ NSImage *iconImage;
+ if([iconImages count] > 0)
+ iconImage = [iconImages objectAtIndex:1];
+ else
+ iconImage = [iconImages objectAtIndex:0];
+
template = [NSString stringWithContentsOfFile:[[NSBundle bundleWithIdentifier:@"com.google.code.sequel-pro.qlgenerator"] pathForResource:@"SPQLPluginQueryFavoritesTemplate" ofType:@"html"]
encoding:NSUTF8StringEncoding error:&templateReadError];
@@ -185,6 +209,9 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
}
else if([urlExtension isEqualToString:@"sql"]) {
+
+ NSImage *iconImage = [iconImages objectAtIndex:0];
+
template = [NSString stringWithContentsOfFile:[[NSBundle bundleWithIdentifier:@"com.google.code.sequel-pro.qlgenerator"] pathForResource:@"SPQLPluginSQLTemplate" ofType:@"html"]
encoding:NSUTF8StringEncoding error:&templateReadError];