* Check candidate files with file(1) to decide whether they are text or binary, and to determine their encoding.
* Upgrade to ARC (note this drops support for 10.6 32-bit and below)
* Use QLPreviewSetURLRepresentation() instead of reading the entire file (!) with -[stringWithContentsOfURL].
* Add extra compiler warning flags
Note that the inclusion of BSD licensed RegexKitLite will require a credit.
According to the (awful) documentation in the QuickLook header files, for this to work the QLNeedsToBeRunInMainThread Info.plist key has to be set to true.
Thumbnails are badged according to the following heuristic:
- If the file has an extension of < 10 characters, use that.
- If the file has a well-known MIME type (determined by file(1)), look up its corresponding badge string and use that.
- If the file has no extension, but a well-known filename (e.g. "Makefile"), look up its corresponding badge string and use that.
- Is the file executable? If so, assume it's a script, and badge it with "SCRIPT".
- Otherwise, badge it with "TEXT".
This heuristic could probably be improved. Currently the mappings of well-known filenames and MIME-types to badge strings are hard-coded in GenerateThumbnailForURL.m. Perhaps these should be moved into an external plist.