Skip to content

Commit f15906a

Browse files
committed
Changes for version 1.0.0
* Add maxFileSize pref for max size of previews * bumped version to 1.0.0
1 parent 5df4bfc commit f15906a

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

Common.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
@"9", @"fontSizePoints",
6969
@"Monaco", @"font",
7070
@"ide-xcode", @"hlTheme",
71-
@"", @"extraHLFlags", nil]];
71+
@"", @"extraHLFlags",
72+
@"", @"maxFileSize", nil]];
7273
[env addEntriesFromDictionary:[defaults persistentDomainForName:myDomain]];
7374

7475
NSString *cmd = [NSString stringWithFormat:

QLColorCode.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@
419419
2CA326230896AD4900168862 /* Debug */ = {
420420
isa = XCBuildConfiguration;
421421
buildSettings = {
422-
CURRENT_PROJECT_VERSION = 0.4.1;
422+
CURRENT_PROJECT_VERSION = 1.0.0;
423423
GCC_WARN_ABOUT_RETURN_TYPE = YES;
424424
GCC_WARN_UNUSED_VARIABLE = YES;
425425
PREBINDING = NO;
@@ -434,7 +434,7 @@
434434
ppc,
435435
i386,
436436
);
437-
CURRENT_PROJECT_VERSION = 0.4.1;
437+
CURRENT_PROJECT_VERSION = 1.0.0;
438438
GCC_WARN_ABOUT_RETURN_TYPE = YES;
439439
GCC_WARN_UNUSED_VARIABLE = YES;
440440
PREBINDING = NO;

ReadMe.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ using the Highlight library: <http://www.andre-simon.de/index.html>
88
To install the plugin, just drag it to /Library/QuickLook or ~/Library/QuickLook.
99
You may need to create that folder if it doesn't already exist.
1010

11-
If you want to change the style of the syntax highlighting, there are several
12-
"defaults" commands that could be useful:
11+
If you want to configure QLColorCode, there are several "defaults" commands
12+
that could be useful:
1313

1414
Setting the font:
1515
defaults write org.n8gray.QLColorCode font Monaco
@@ -19,6 +19,8 @@ the color style (see below):
1919
defaults write org.n8gray.QLColorCode hlStyle ide-xcode
2020
any extra command-line flags for Highlight (see below):
2121
defaults write org.n8gray.QLColorCode extraHLFlags '-l -W'
22+
the maximum size (in bytes) for previewed files:
23+
defaults write org.n8gray.QLColorCode maxFileSize 1000000
2224

2325
The following color styles are included with QLColorCode:
2426
acid, bipolar, blacknblue, bright, contrast, darkblue,

colorize.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ cmdOpts=(-I --font $font --quiet --add-data-dir $rsrcDir/override \
3232
#for o in $cmdOpts; do echo $o\<br/\>; done
3333

3434
reader=(cat $target)
35-
if [ $thumb = "1" ]; then
36-
filter=(head -n 100)
37-
else
38-
filter=cat
39-
fi
4035

4136
case $target in
4237
*.graffle )
@@ -69,8 +64,18 @@ case $target in
6964
;;
7065
esac
7166

67+
go4it () {
68+
if [ $thumb = "1" ]; then
69+
$reader | head -n 100 | head -c 20000 | $cmd --syntax $lang $cmdOpts && exit 0
70+
elif [ -n "$maxFileSize" ]; then
71+
$reader | head -c $maxFileSize | $cmd --syntax $lang $cmdOpts && exit 0
72+
else
73+
$reader | $cmd --syntax $lang $cmdOpts && exit 0
74+
fi
75+
}
76+
7277
setopt no_err_exit
73-
$reader | $filter | $cmd --syntax $lang $cmdOpts && exit 0
78+
go4it
7479
# Uh-oh, it didn't work. Fall back to rendering the file as plain
7580
lang=txt
76-
$reader | $filter | $cmd --syntax $lang $cmdOpts && exit 0
81+
go4it

0 commit comments

Comments
 (0)