From 2d945df60f198d98f5e7000202b54f26a8ca1278 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 9 Aug 2010 14:04:17 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Quicklook=20generator=20-=20improved=20icon?= =?UTF-8?q?=20display=20by=20choosing=20an=20adequate=20=20image=20of=20of?= =?UTF-8?q?=20the=20icns=20file=20-=20set=20background=20to=20white=20for?= =?UTF-8?q?=20all=20different=20spf=20files=20to=20be=20consistent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SPQLPluginConnectionTemplate.html | 2 -- .../SPQLPluginContentFiltersTemplate.html | 6 ----- .../SPQLPluginQueryFavoritesTemplate.html | 6 ----- Resources/English.lproj/SPQLPluginSQLTemplate.html | 2 +- .../German.lproj/SPQLPluginConnectionTemplate.html | 2 -- .../SPQLPluginContentFiltersTemplate.html | 6 ----- .../SPQLPluginQueryFavoritesTemplate.html | 6 ----- Resources/German.lproj/SPQLPluginSQLTemplate.html | 2 +- Source/GeneratePreviewForURL.m | 31 ++++++++++++++++++++-- 9 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Resources/English.lproj/SPQLPluginConnectionTemplate.html b/Resources/English.lproj/SPQLPluginConnectionTemplate.html index cfce367f..48345fcb 100644 --- a/Resources/English.lproj/SPQLPluginConnectionTemplate.html +++ b/Resources/English.lproj/SPQLPluginConnectionTemplate.html @@ -6,8 +6,6 @@ body { font-family:'Lucida Grande'; font-size:10pt; - background-color:#222222; - color:white; } diff --git a/Resources/English.lproj/SPQLPluginContentFiltersTemplate.html b/Resources/English.lproj/SPQLPluginContentFiltersTemplate.html index c9ad6aa7..b6765826 100644 --- a/Resources/English.lproj/SPQLPluginContentFiltersTemplate.html +++ b/Resources/English.lproj/SPQLPluginContentFiltersTemplate.html @@ -6,12 +6,6 @@ body { font-family:'Lucida Grande'; font-size:10pt; - background-color:#222222; - color:white; -} -textarea { - background-color:#222222; - color:white; } diff --git a/Resources/English.lproj/SPQLPluginQueryFavoritesTemplate.html b/Resources/English.lproj/SPQLPluginQueryFavoritesTemplate.html index 73f9f816..5a04861d 100644 --- a/Resources/English.lproj/SPQLPluginQueryFavoritesTemplate.html +++ b/Resources/English.lproj/SPQLPluginQueryFavoritesTemplate.html @@ -6,12 +6,6 @@ body { font-family:'Lucida Grande'; font-size:10pt; - background-color:#222222; - color:white; -} -textarea { - background-color:#222222; - color:white; } diff --git a/Resources/English.lproj/SPQLPluginSQLTemplate.html b/Resources/English.lproj/SPQLPluginSQLTemplate.html index 52588352..d9f55c09 100644 --- a/Resources/English.lproj/SPQLPluginSQLTemplate.html +++ b/Resources/English.lproj/SPQLPluginSQLTemplate.html @@ -14,7 +14,7 @@ body {
- +
diff --git a/Resources/German.lproj/SPQLPluginConnectionTemplate.html b/Resources/German.lproj/SPQLPluginConnectionTemplate.html index 28d5bbb3..c1e3dc45 100644 --- a/Resources/German.lproj/SPQLPluginConnectionTemplate.html +++ b/Resources/German.lproj/SPQLPluginConnectionTemplate.html @@ -6,8 +6,6 @@ body { font-family:'Lucida Grande'; font-size:10pt; - background-color:#222222; - color:white; } diff --git a/Resources/German.lproj/SPQLPluginContentFiltersTemplate.html b/Resources/German.lproj/SPQLPluginContentFiltersTemplate.html index 34ab2c38..cc3d2828 100644 --- a/Resources/German.lproj/SPQLPluginContentFiltersTemplate.html +++ b/Resources/German.lproj/SPQLPluginContentFiltersTemplate.html @@ -6,12 +6,6 @@ body { font-family:'Lucida Grande'; font-size:10pt; - background-color:#222222; - color:white; -} -textarea { - background-color:#222222; - color:white; } diff --git a/Resources/German.lproj/SPQLPluginQueryFavoritesTemplate.html b/Resources/German.lproj/SPQLPluginQueryFavoritesTemplate.html index 412d8ecb..64494a9d 100644 --- a/Resources/German.lproj/SPQLPluginQueryFavoritesTemplate.html +++ b/Resources/German.lproj/SPQLPluginQueryFavoritesTemplate.html @@ -6,12 +6,6 @@ body { font-family:'Lucida Grande'; font-size:10pt; - background-color:#222222; - color:white; -} -textarea { - background-color:#222222; - color:white; } diff --git a/Resources/German.lproj/SPQLPluginSQLTemplate.html b/Resources/German.lproj/SPQLPluginSQLTemplate.html index 9ced9acd..41bff669 100644 --- a/Resources/German.lproj/SPQLPluginSQLTemplate.html +++ b/Resources/German.lproj/SPQLPluginSQLTemplate.html @@ -14,7 +14,7 @@ body {
- +
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]; -- cgit v1.2.3