├── .gitignore ├── DDS ├── dds.h ├── dds.m └── decode.m ├── LICENSE.txt ├── QLdds.pkgproj ├── QLdds.xcodeproj └── project.pbxproj ├── README.md ├── Resources └── en.lproj │ └── license.rtf ├── app ├── Info.plist └── QLdds ├── img ├── bump.jpeg ├── cube.jpeg ├── finder.jpeg └── preview.jpeg ├── mdimporter ├── GetMetadataForFile.m ├── Info.plist ├── Resources │ ├── en.lproj │ │ └── schema.strings │ └── schema.xml ├── main.c └── resetmds └── qlgenerator ├── GeneratePreviewForURL.m ├── GenerateThumbnailForURL.m ├── Info.plist ├── main.c └── resetquicklookd /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .DS_Store 3 | *.mode1 4 | *.mode1v3 5 | *.pbxuser 6 | !default.pbxuser 7 | *.xcworkspace 8 | xcuserdata 9 | *.bak 10 | *.pkg 11 | -------------------------------------------------------------------------------- /DDS/dds.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Taken from SOIL/image_DXT.h, Jonathan Dummer, 2007-07-31-10.32 4 | */ 5 | 6 | #ifndef HEADER_DDS 7 | #define HEADER_DDS 8 | 9 | #import 10 | 11 | /** A bunch of DirectDraw Surface structures and flags **/ 12 | typedef struct 13 | { 14 | unsigned int dwMagic; 15 | unsigned int dwSize; 16 | unsigned int dwFlags; 17 | unsigned int dwHeight; 18 | unsigned int dwWidth; 19 | unsigned int dwPitchOrLinearSize; 20 | unsigned int dwDepth; 21 | unsigned int dwMipMapCount; 22 | unsigned int dwReserved1[ 11 ]; 23 | 24 | /* DDPIXELFORMAT */ 25 | struct 26 | { 27 | unsigned int dwSize; 28 | unsigned int dwFlags; 29 | unsigned int dwFourCC; 30 | unsigned int dwRGBBitCount; 31 | unsigned int dwRBitMask; 32 | unsigned int dwGBitMask; 33 | unsigned int dwBBitMask; 34 | unsigned int dwAlphaBitMask; 35 | } 36 | sPixelFormat; 37 | 38 | /* DDCAPS2 */ 39 | struct 40 | { 41 | unsigned int dwCaps1; 42 | unsigned int dwCaps2; 43 | unsigned int dwDDSX; 44 | unsigned int dwReserved; 45 | } 46 | sCaps; 47 | unsigned int dwReserved2; 48 | } 49 | DDS_header ; 50 | 51 | /* the following constants were copied directly off the MSDN website */ 52 | 53 | /* The dwFlags member of the original DDSURFACEDESC2 structure 54 | can be set to one or more of the following values. */ 55 | #define DDSD_CAPS 0x00000001 56 | #define DDSD_HEIGHT 0x00000002 57 | #define DDSD_WIDTH 0x00000004 58 | #define DDSD_PITCH 0x00000008 59 | #define DDSD_PIXELFORMAT 0x00001000 60 | #define DDSD_MIPMAPCOUNT 0x00020000 61 | #define DDSD_LINEARSIZE 0x00080000 62 | #define DDSD_DEPTH 0x00800000 63 | 64 | /* DirectDraw Pixel Format */ 65 | #define DDPF_ALPHAPIXELS 0x00000001 66 | #define DDPF_FOURCC 0x00000004 67 | #define DDPF_RGB 0x00000040 68 | #define DDPF_LUMINANCE 0x00020000 69 | 70 | /* The dwCaps1 member of the DDSCAPS2 structure can be 71 | set to one or more of the following values. */ 72 | #define DDSCAPS_COMPLEX 0x00000008 73 | #define DDSCAPS_TEXTURE 0x00001000 74 | #define DDSCAPS_MIPMAP 0x00400000 75 | 76 | /* The dwCaps2 member of the DDSCAPS2 structure can be 77 | set to one or more of the following values. */ 78 | #define DDSCAPS2_CUBEMAP 0x00000200 79 | #define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 80 | #define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 81 | #define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 82 | #define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 83 | #define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 84 | #define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 85 | #define DDSCAPS2_CUBEMAP_ALLFACES (DDSCAPS2_CUBEMAP|DDSCAPS2_CUBEMAP_POSITIVEX|DDSCAPS2_CUBEMAP_NEGATIVEX|DDSCAPS2_CUBEMAP_POSITIVEY|DDSCAPS2_CUBEMAP_NEGATIVEY|DDSCAPS2_CUBEMAP_POSITIVEZ|DDSCAPS2_CUBEMAP_NEGATIVEZ) 86 | #define DDSCAPS2_VOLUME 0x00200000 87 | 88 | 89 | /* DirectX10 additions */ 90 | 91 | /* Only those formats that we support */ 92 | typedef enum DXGI_FORMAT 93 | { 94 | DXGI_FORMAT_UNKNOWN = 0, 95 | DXGI_FORMAT_BC1_UNORM = 71, // DXT1 96 | DXGI_FORMAT_BC2_UNORM = 74, // DXT2 97 | DXGI_FORMAT_BC3_UNORM = 77, // DXT3 98 | DXGI_FORMAT_BC4_UNORM = 80, // ATI1 99 | DXGI_FORMAT_BC5_UNORM = 83, // ATI2 100 | } DXGI_FORMAT; 101 | 102 | typedef struct { 103 | DDS_header DX9_header; 104 | DXGI_FORMAT dxgiFormat; 105 | unsigned int resourceDimension; 106 | unsigned int miscFlag; 107 | unsigned int arraySize; 108 | unsigned int miscFlags2; 109 | } DDS_header_DXT10; 110 | 111 | 112 | @interface DDS : NSObject 113 | { 114 | NSData *ddsfile; 115 | const unsigned char *ddsdata; // pointer to the (potentially compressed) data 116 | unsigned int fourcc; // FourCC code for recognised types 117 | NSString *_codec; // Human-readable name of codec 118 | int _mainSurfaceWidth, _mainSurfaceHeight, _mainSurfaceDepth; // image dimensions 119 | int _surfaceCount, _mipmapCount, _ddsCaps2, _bpp; 120 | int blocksize; // BCn block size for compressed images 121 | int pixelsize; // size in bytes for uncompressed images 122 | int amask, bmask, gmask, rmask; // channel masks for uncompressed images 123 | CGBitmapInfo bitmapinfo; // type of image we will produce 124 | } 125 | 126 | - (id) initWithURL : (NSURL *) url; 127 | + (id) ddsWithURL : (NSURL *) url; 128 | 129 | // Draw a DDS into an CGImage bitmap. 130 | // If the DDS is a cubemap all surfaces are drawn. 131 | // 132 | - (CGImageRef) CreateImage; 133 | - (CGImageRef) CreateImageWithPreferredWidth:(int)width andPreferredHeight:(int)height; 134 | 135 | // Draw a DDS surface into an BGRA bitmap. Alpha is premultiplied since that's what CGImage needs. 136 | // - surface: Surface number for cubemaps. Must be zero for non-cubemap textures. 137 | // - mipmapLevel: mipmap depth. Must be zero for non-mipmapped textures. 138 | // - dst points to the target bitmap which should be at least width * height * 4 bytes in size. 139 | // - stride specifies the width of the target bitmap [pixels]. 140 | // 141 | - (void) DecodeSurfacePremultiplied:(int)surface atLevel:(int)mipmapLevel To:(UInt32 *)dst withStride:(int)stride; 142 | 143 | // Decode a DDS surface into an BGRA bitmap. Alpha is not premultiplied (unless already in the source i.e. DXT2 and DXT4). 144 | // - surface: Surface number for cubemaps. Must be zero for non-cubemap textures. 145 | // - mipmapLevel: mipmap depth. Must be zero for non-mipmapped textures. 146 | // - dst points to the target bitmap which should be at least width * height * 4 bytes in size. 147 | // - stride specifies the width of the target bitmap [pixels]. 148 | // 149 | - (void) DecodeSurface:(int)surface atLevel:(int)mipmapLevel To:(UInt32 *)dst withStride:(int)stride; 150 | 151 | @property (nonatomic,strong,readonly) NSString *codec; 152 | @property (nonatomic,assign,readonly) int mainSurfaceWidth; 153 | @property (nonatomic,assign,readonly) int mainSurfaceHeight; 154 | @property (nonatomic,assign,readonly) int mainSurfaceDepth; 155 | @property (nonatomic,assign,readonly) int surfaceCount; 156 | @property (nonatomic,assign,readonly) int mipmapCount; 157 | @property (nonatomic,assign,readonly) int ddsCaps2; 158 | @property (nonatomic,assign,readonly) int bpp; 159 | 160 | @end 161 | 162 | 163 | #endif /* HEADER_DDS */ 164 | -------------------------------------------------------------------------------- /DDS/dds.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "dds.h" 5 | 6 | 7 | // FOURCC codes that we know how to deal with 8 | typedef enum { 9 | FOURCC_UNKNOWN = 0, 10 | // Values that can appear in sPixelFormat.dwFlags 11 | FOURCC_DXT1 = 0x31545844, 12 | FOURCC_DXT2 = 0x32545844, 13 | FOURCC_DXT3 = 0x33545844, 14 | FOURCC_DXT4 = 0x34545844, 15 | FOURCC_DXT5 = 0x35545844, 16 | FOURCC_ATI1 = 0x31495441, 17 | FOURCC_ATI2 = 0x32495441, 18 | FOURCC_DX10 = 0x30315844, 19 | // Psuedo identifiers just for internal use 20 | FOURCC_RG = 0x20204752, 21 | FOURCC_RGB = 0x20424752, 22 | FOURCC_RGBA = 0x41424752, 23 | FOURCC_RGBX = 0x58424752, 24 | FOURCC_L = 0x2020204c, 25 | FOURCC_LA = 0x2020414c, 26 | } FourCC; 27 | 28 | static const unsigned int DDS_MAGIC = 0x20534444; // "DDS " 29 | 30 | 31 | // The order of surfaces in a cubemap is +x, -x, +y,-y, +z,-z according to http://msdn.microsoft.com/en-gb/library/windows/desktop/bb205577 32 | static const unsigned int surface_order[6] = { DDSCAPS2_CUBEMAP_POSITIVEX,DDSCAPS2_CUBEMAP_NEGATIVEX, DDSCAPS2_CUBEMAP_POSITIVEY, DDSCAPS2_CUBEMAP_NEGATIVEY, DDSCAPS2_CUBEMAP_POSITIVEZ, DDSCAPS2_CUBEMAP_NEGATIVEZ }; 33 | 34 | 35 | // Hopefully most efficient CGBitmapContext byte ordering: http://lists.apple.com/archives/quartz-dev/2012/Mar/msg00013.html 36 | // Corresponds to kCGBitmapByteOrder32Host | [kCGImageAlphaNoneSkipFirst || kCGImageAlphaPremultipliedFirst] 37 | typedef union 38 | { 39 | UInt32 u; 40 | struct 41 | { 42 | UInt8 b, g, r, a; 43 | }; 44 | } Color32; 45 | 46 | 47 | // 48 | // Helpers. Written as plain C instead of ObjC member functions for speed. 49 | // 50 | 51 | // DXT1 3 or 4 color palette. 52 | inline static void makeColor32Palette(UInt32 c01, Color32 p[4]) 53 | { 54 | assert(p[0].a == 0xff && p[1].a == 0xff && p[2].a == 0xff); // Assumes alphas already set to opaque. 55 | 56 | // rrrrrggggggbbbbb,rrrrrggggggbbbbb 57 | p[0].r = ((c01 & 0x0000f800)) >> 8 | (c01 & 0x0000e000) >> 13; 58 | p[0].g = ((c01 & 0x000007e0)) >> 3 | (c01 & 0x00000600) >> 9; 59 | p[0].b = ((c01 & 0x0000001f)) << 3 | (c01 & 0x0000001b) >> 2; 60 | p[1].r = ((c01 & 0xf8000000)) >> 24 | (c01 & 0xe0000000) >> 29; 61 | p[1].g = ((c01 & 0x07e00000)) >> 19 | (c01 & 0x06000000) >> 25; 62 | p[1].b = ((c01 & 0x001f0000)) >> 13 | (c01 & 0x001b0000) >> 18; 63 | if (p[0].u > p[1].u) 64 | { 65 | p[2].r = (p[0].r + p[0].r + p[1].r + 1) / 3; 66 | p[2].g = (p[0].g + p[0].g + p[1].g + 1) / 3; 67 | p[2].b = (p[0].b + p[0].b + p[1].b + 1) / 3; 68 | p[3].r = (p[0].r + p[1].r + p[1].r + 1) / 3; 69 | p[3].g = (p[0].g + p[1].g + p[1].g + 1) / 3; 70 | p[3].b = (p[0].b + p[1].b + p[1].b + 1) / 3; 71 | p[3].a = 0xff; 72 | } 73 | else 74 | { 75 | p[2].r = (p[0].r + p[1].r) / 2; 76 | p[2].g = (p[0].g + p[1].g) / 2; 77 | p[2].b = (p[0].b + p[1].b) / 2; 78 | p[2].a = 0xff; 79 | p[3].u = 0; // Transparent 80 | } 81 | } 82 | 83 | 84 | // DXT2-5 4 color palette. 85 | inline static void makeColor32Palette4(UInt32 c01, Color32 p[4]) 86 | { 87 | assert(p[0].a == 0xff && p[1].a == 0xff && p[2].a == 0xff && p[3].a == 0xff); // Assumes alphas already set to opaque. 88 | 89 | // rrrrrggggggbbbbb,rrrrrggggggbbbbb 90 | p[0].r = ((c01 & 0x0000f800)) >> 8 | (c01 & 0x0000e000) >> 13; 91 | p[0].g = ((c01 & 0x000007e0)) >> 3 | (c01 & 0x00000600) >> 9; 92 | p[0].b = ((c01 & 0x0000001f)) << 3 | (c01 & 0x0000001b) >> 2; 93 | p[1].r = ((c01 & 0xf8000000)) >> 24 | (c01 & 0xe0000000) >> 29; 94 | p[1].g = ((c01 & 0x07e00000)) >> 19 | (c01 & 0x06000000) >> 25; 95 | p[1].b = ((c01 & 0x001f0000)) >> 13 | (c01 & 0x001b0000) >> 18; 96 | p[2].r = (p[0].r + p[0].r + p[1].r + 1) / 3; 97 | p[2].g = (p[0].g + p[0].g + p[1].g + 1) / 3; 98 | p[2].b = (p[0].b + p[0].b + p[1].b + 1) / 3; 99 | p[3].r = (p[0].r + p[1].r + p[1].r + 1) / 3; 100 | p[3].g = (p[0].g + p[1].g + p[1].g + 1) / 3; 101 | p[3].b = (p[0].b + p[1].b + p[1].b + 1) / 3; 102 | } 103 | 104 | 105 | // DXT4,DXT5,ATI1,ATI2 palette 106 | inline static void makeLuminancePalette(UInt64 a01, UInt8 p[8]) 107 | { 108 | p[0] = a01; 109 | p[1] = a01 >> 8; 110 | if (p[0] > p[1]) 111 | { 112 | p[2] = (6 * p[0] + 1 * p[1] + 3) / 7; 113 | p[3] = (5 * p[0] + 2 * p[1] + 3) / 7; 114 | p[4] = (4 * p[0] + 3 * p[1] + 3) / 7; 115 | p[5] = (3 * p[0] + 4 * p[1] + 3) / 7; 116 | p[6] = (2 * p[0] + 5 * p[1] + 3) / 7; 117 | p[7] = (1 * p[0] + 6 * p[1] + 3) / 7; 118 | } 119 | else 120 | { 121 | p[2] = (4 * p[0] + 1 * p[1] + 2) / 5; 122 | p[3] = (3 * p[0] + 2 * p[1] + 2) / 5; 123 | p[4] = (2 * p[0] + 3 * p[1] + 2) / 5; 124 | p[5] = (1 * p[0] + 4 * p[1] + 2) / 5; 125 | p[6] = 0x00; 126 | p[7] = 0xff; 127 | } 128 | } 129 | 130 | 131 | // Compute normal in Blue channel in-place from Red and Green channels 132 | // Assumes Blender convention: http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Influence/Material/Bump_and_Normal 133 | inline static void computeColor32NormalB(Color32 c) 134 | { 135 | if (c.r == 0x7f && c.g == 0x7f) 136 | { 137 | c.b = 0xff; // Common case - flat 138 | } 139 | else 140 | { 141 | // TODO: Probably could speed this up with a lookup table or sqrt approximation 142 | float x = 2 * (c.r / 255.0f) - 1; // [0, 255] -> [-1.0, 1.0] 143 | float y = 2 * (c.g / 255.0f) - 1; // [0, 255] -> [-1.0, 1.0] 144 | float z2 = 1 - x*x + y*y; 145 | if (z2 > 0.9961f) 146 | c.b = 0xff; // Common case - flat enough that z will round to 1 147 | else if (z2 <= 0) 148 | c.b = 0; // Shouldn't happen: unnormalized vector 149 | else 150 | c.b = roundf(sqrtf(z2) * 255); // [0.0, 1.0] -> [0, 255] 151 | } 152 | } 153 | 154 | 155 | // how much we need to shift right to make an 8-bit quantity 156 | // TODO: expand to 8 bits where mask is less than 8 bits e.g. 16bit 565 data 157 | inline static int maskshift(unsigned int mask) 158 | { 159 | if (! mask) 160 | return 0; 161 | 162 | int shift = 24; 163 | while (! (mask & 0x80000000)) 164 | { 165 | shift -= 1; 166 | mask <<= 1; 167 | } 168 | return shift; 169 | }; 170 | 171 | 172 | 173 | @interface DDS() 174 | - (int) surfaceSize; 175 | - (int) surfaceSize: (int) mipmapLevel; 176 | @end 177 | 178 | @implementation DDS 179 | 180 | // Include different versions of decode.c 181 | #define PREMULTIPLY 182 | #include "decode.m" 183 | #undef PREMULTIPLY 184 | #include "decode.m" 185 | 186 | - (id) initWithURL: (NSURL *) url 187 | { 188 | if (!(self = [super init])) 189 | return nil; 190 | 191 | char const *ddsheader; 192 | NSError *error; 193 | if (!(ddsfile = [NSData dataWithContentsOfURL:url options:NSDataReadingMappedAlways error:&error]) || 194 | ddsfile.length < sizeof(DDS_header) || 195 | !(ddsheader = ddsfile.bytes) || 196 | OSReadLittleInt32(ddsheader, offsetof(DDS_header, dwMagic)) != DDS_MAGIC || 197 | (OSReadLittleInt32(ddsheader, offsetof(DDS_header, dwSize)) + sizeof(DDS_MAGIC) != sizeof(DDS_header) && 198 | OSReadLittleInt32(ddsheader, offsetof(DDS_header, dwSize)) != DDS_MAGIC)) // Some old DX8 files have the magic repeated in the size field 199 | return nil; 200 | 201 | // according to http://msdn.microsoft.com/en-us/library/bb943982 we ignore DDSD_PIXELFORMAT in dwFlags and assume that sPixelFormat is valid 202 | unsigned int pfflags = OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwFlags)); 203 | 204 | if (pfflags & DDPF_FOURCC) 205 | { 206 | /* DirectX10 header extension */ 207 | if (OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwFourCC)) == FOURCC_DX10) 208 | { 209 | if (ddsfile.length < sizeof(DDS_header_DXT10)) 210 | return nil; 211 | 212 | // Map DXGI formats that we know how to deal with to the corresponding FourCC code 213 | switch (OSReadLittleInt32(ddsheader, offsetof(DDS_header_DXT10, dxgiFormat))) 214 | { 215 | case DXGI_FORMAT_BC1_UNORM: 216 | _codec = @"BC1"; 217 | fourcc = FOURCC_DXT1; 218 | break; 219 | case DXGI_FORMAT_BC2_UNORM: 220 | _codec = @"BC2"; 221 | fourcc = FOURCC_DXT3; 222 | break; 223 | case DXGI_FORMAT_BC3_UNORM: 224 | _codec = @"BC3"; 225 | fourcc = FOURCC_DXT5; 226 | break; 227 | case DXGI_FORMAT_BC4_UNORM: 228 | _codec = @"BC4"; 229 | fourcc = FOURCC_ATI1; 230 | break; 231 | case DXGI_FORMAT_BC5_UNORM: 232 | _codec = @"BC5"; 233 | fourcc = FOURCC_ATI2; 234 | break; 235 | default: 236 | _codec = @"DX10"; 237 | fourcc = FOURCC_UNKNOWN; // unsupported encoding 238 | } 239 | ddsdata = ((unsigned char *) ddsfile.bytes) + sizeof(DDS_header_DXT10); 240 | } 241 | else 242 | { 243 | _codec = [[NSString alloc] initWithBytes:(ddsheader + offsetof(DDS_header, sPixelFormat.dwFourCC)) length:4 encoding:NSASCIIStringEncoding]; 244 | fourcc = OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwFourCC)); 245 | ddsdata = ((unsigned char *) ddsfile.bytes) + sizeof(DDS_header); 246 | } 247 | 248 | switch (fourcc) 249 | { 250 | case FOURCC_DXT1: 251 | blocksize = 8; 252 | _bpp = 16; // 565 253 | break; 254 | case FOURCC_DXT2: 255 | case FOURCC_DXT3: 256 | blocksize = 16; 257 | _bpp = 20; // 565 + 4 bit alpha 258 | break; 259 | case FOURCC_DXT4: 260 | case FOURCC_DXT5: 261 | blocksize = 16; 262 | _bpp = 24; // 565 + 8 bit alpha 263 | break; 264 | case FOURCC_ATI1: 265 | blocksize = 8; 266 | _bpp = 8; 267 | break; 268 | case FOURCC_ATI2: 269 | blocksize = 16; 270 | _bpp = 16; 271 | break; 272 | default: 273 | fourcc = FOURCC_UNKNOWN; // unsupported encoding 274 | break; 275 | } 276 | } 277 | else if (pfflags & (DDPF_RGB|DDPF_LUMINANCE)) 278 | { 279 | _bpp = OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwRGBBitCount)); 280 | if ((pfflags & (DDPF_LUMINANCE|DDPF_ALPHAPIXELS)) == (DDPF_LUMINANCE|DDPF_ALPHAPIXELS)) 281 | { 282 | _codec = @"Luminance + Alpha"; 283 | fourcc = FOURCC_LA; 284 | } 285 | else if (pfflags & DDPF_LUMINANCE) 286 | { 287 | _codec = @"Luminance"; 288 | fourcc = FOURCC_L; 289 | } 290 | else if (!OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwBBitMask))) 291 | { 292 | // No Blue channel - asume this is a normal map and compute Blue from Red and Green 293 | _codec = @"Normal map"; 294 | fourcc = FOURCC_RG; 295 | } 296 | else if (pfflags & DDPF_ALPHAPIXELS) 297 | { 298 | _codec = @"RGBA"; 299 | fourcc = FOURCC_RGBA; 300 | } 301 | else if (_bpp == 32) 302 | { 303 | // No alpha channel 304 | _codec = @"RGBX"; 305 | fourcc = FOURCC_RGBX; 306 | } 307 | else 308 | { 309 | _codec = @"RGB"; 310 | fourcc = FOURCC_RGB; 311 | } 312 | 313 | pixelsize = _bpp / 8; 314 | if (pixelsize * 8 != _bpp || pixelsize == 0 || pixelsize > 4) 315 | { 316 | // non-byte aligned data or too large for us 317 | fourcc = FOURCC_UNKNOWN; // unsupported encoding 318 | } 319 | else 320 | { 321 | rmask = OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwRBitMask)); 322 | gmask = OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwGBitMask)); 323 | bmask = OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwBBitMask)); 324 | amask = OSReadLittleInt32(ddsheader, offsetof(DDS_header, sPixelFormat.dwAlphaBitMask)); 325 | } 326 | ddsdata = ((unsigned char *) ddsfile.bytes) + sizeof(DDS_header); 327 | } 328 | else 329 | return NULL; // Either DDPF_FOURCC, DDPF_RGB or DDPF_LUMINANCE should be set 330 | 331 | _ddsCaps2 = OSReadLittleInt32(ddsheader, offsetof(DDS_header, sCaps.dwCaps2)); 332 | _mainSurfaceWidth = OSReadLittleInt32(ddsheader, offsetof(DDS_header, dwWidth)); 333 | _mainSurfaceHeight= OSReadLittleInt32(ddsheader, offsetof(DDS_header, dwHeight)); 334 | 335 | if (!(_ddsCaps2 & DDSCAPS2_CUBEMAP)) 336 | _surfaceCount = 1; 337 | else 338 | { 339 | _surfaceCount = 0; 340 | for (int i=0; i<6; i++) 341 | if (_ddsCaps2 & surface_order[i]) 342 | _surfaceCount++; 343 | if (!_surfaceCount) 344 | _surfaceCount = 1; 345 | } 346 | 347 | // according to http://msdn.microsoft.com/en-us/library/bb943982 we ignore DDSD_MIPMAPCOUNT in dwFlags 348 | _mipmapCount = OSReadLittleInt32(ddsheader, offsetof(DDS_header, dwMipMapCount)); 349 | if (! _mipmapCount) _mipmapCount = 1; // assume that we always have at least one surface 350 | 351 | // also ignore DDSD_DEPTH in dwFlags for similar reasons 352 | _mainSurfaceDepth = _ddsCaps2 & DDSCAPS2_VOLUME ? OSReadLittleInt32(ddsheader, offsetof(DDS_header, dwDepth)) : 0; 353 | if (! _mainSurfaceDepth) _mainSurfaceDepth = 1; 354 | 355 | // Check file not truncated 356 | if (ddsfile.length < _surfaceCount * [self surfaceSize] + (ddsdata - (unsigned char *) ddsfile.bytes)) 357 | return nil; 358 | 359 | return self; 360 | } 361 | 362 | + (id) ddsWithURL: (NSURL *) url 363 | { 364 | DDS* dds = [[DDS alloc] initWithURL:url]; 365 | return dds; 366 | } 367 | 368 | 369 | - (CGImageRef) CreateImage 370 | { 371 | return [self CreateImageWithPreferredWidth:0 andPreferredHeight:0]; 372 | } 373 | 374 | - (CGImageRef) CreateImageWithPreferredWidth:(int)width andPreferredHeight:(int)height 375 | { 376 | if (fourcc == FOURCC_UNKNOWN) 377 | return NULL; 378 | 379 | const int (*surface_layout)[2]; // position of each surface in the image [x, y] 380 | const int surface_layout_one [1][2] = { { 0, 0 } }; 381 | const int surface_layout_full[6][2] = { { 2, 1 }, { 0, 1 }, { 1, 0 }, { 1, 2 }, { 1, 1 }, { 3, 1 } }; 382 | const int surface_layout_half[3][2] = { { 1, 1 }, { 0, 0 }, { 0, 1 } }; 383 | const int surface_layout_seqn[6][2] = { { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 }, { 4, 0 }, { 5, 0 } }; 384 | int surface_width = _mainSurfaceWidth; 385 | int surface_height= _mainSurfaceHeight; 386 | 387 | int img_width, img_height; // dimensions of generated image 388 | 389 | if (_surfaceCount == 1) 390 | { 391 | surface_layout = surface_layout_one; 392 | img_width = surface_width; 393 | img_height = surface_height; 394 | } 395 | else 396 | { 397 | // cubemap 398 | 399 | if ((_ddsCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) == DDSCAPS2_CUBEMAP_ALLFACES) 400 | { 401 | // +y 402 | // We present them as: -x +z +x -z 403 | // -y 404 | surface_layout = surface_layout_full; 405 | img_width = surface_width * 4; 406 | img_height = surface_height * 3; 407 | } 408 | else if ((_ddsCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) == (DDSCAPS2_CUBEMAP|DDSCAPS2_CUBEMAP_POSITIVEX|DDSCAPS2_CUBEMAP_POSITIVEY|DDSCAPS2_CUBEMAP_POSITIVEZ)) 409 | { 410 | // +y 411 | // Only the positive surfaces: +z +x 412 | surface_layout = surface_layout_half; 413 | img_width = surface_width * 2; 414 | img_height = surface_height * 2; 415 | } 416 | else 417 | { 418 | // Some random selection of surfaces. Present them as they come. 419 | surface_layout = surface_layout_seqn; 420 | img_width = surface_width * _surfaceCount; 421 | img_height = surface_height; 422 | } 423 | } 424 | 425 | // Find smallest mipmap that is the same size or larger than the desired size - QuickLook will scale it down to desired size 426 | // This doesn't handle volume textures (which look like http://msdn.microsoft.com/en-us/library/windows/desktop/bb205579 ) 427 | int mipmap = 0; 428 | if ((width || height) && _mainSurfaceDepth==1) 429 | while (mipmap < _mipmapCount - 1 && img_width / 2 >= width && img_height / 2 >= height) 430 | { 431 | if (! (surface_width /= 2)) surface_width = 1; 432 | if (! (surface_height/= 2)) surface_height= 1; 433 | if (! (img_width /= 2)) img_width = 1; 434 | if (! (img_height/= 2)) img_height= 1; 435 | mipmap ++; 436 | } 437 | 438 | // Draw 439 | UInt32 *img_data; 440 | if (!(img_data = (_surfaceCount > 1) ? 441 | calloc(img_width * img_height, 4) : // Allocate zeroed data so bits we don't write to are transparent 442 | malloc(img_width * img_height * 4))) 443 | return NULL; 444 | 445 | for (int surface_num = 0; surface_num < _surfaceCount; surface_num++) 446 | { 447 | UInt32 *dst = img_data + surface_width * (*surface_layout)[0] + img_width * surface_height * (*surface_layout)[1]; 448 | [self DecodeSurfacePremultiplied:surface_num atLevel:(int)mipmap To:dst withStride:img_width]; 449 | surface_layout ++; 450 | } 451 | 452 | // Wangle into a CGImage via a CGBitmapContext 453 | // OSX wants premultiplied alpha. See "Supported Pixel Formats" at 454 | // https://developer.apple.com/Library/mac/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html 455 | 456 | CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); 457 | CGContextRef context = CGBitmapContextCreate(img_data, img_width, img_height, 8, img_width * 4, rgb, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); 458 | CGColorSpaceRelease(rgb); 459 | if (!context) 460 | { 461 | free(img_data); 462 | return NULL; 463 | } 464 | CGImageRef image = CGBitmapContextCreateImage(context); // copy or copy-on-write img_data 465 | CGContextRelease(context); 466 | free(img_data); 467 | 468 | return image; 469 | } 470 | 471 | 472 | // Size in bytes of one surface (including any mipmaps) 473 | - (int) surfaceSize 474 | { 475 | int mipmap = 0; 476 | int w = _mainSurfaceWidth; 477 | int h = _mainSurfaceHeight; 478 | int d = _mainSurfaceDepth; 479 | 480 | int surface_bytes = 0; 481 | while (mipmap++ < _mipmapCount) 482 | { 483 | surface_bytes += (blocksize ? 484 | blocksize * ((w + 3) / 4) * ((h + 3) / 4) * d : // block aligned 485 | pixelsize * w * h * d); // byte aligned 486 | if (! (w /= 2)) w = 1; 487 | if (! (h /= 2)) h = 1; 488 | if (! (d /= 2)) d = 1; 489 | } 490 | return surface_bytes; 491 | } 492 | 493 | 494 | // Size in bytes of one surface at specified mipmap level (0-based). 495 | - (int) surfaceSize: (int) mipmapLevel 496 | { 497 | int mipmap = 0; 498 | int w = _mainSurfaceWidth; 499 | int h = _mainSurfaceHeight; 500 | int d = _mainSurfaceDepth; 501 | 502 | while (mipmap++ < mipmapLevel) 503 | { 504 | if (! (w /= 2)) w = 1; 505 | if (! (h /= 2)) h = 1; 506 | if (! (d /= 2)) d = 1; 507 | } 508 | return (blocksize ? 509 | blocksize * ((w + 3) / 4) * ((h + 3) / 4) * d : // block aligned 510 | pixelsize * w * h * d); // byte aligned 511 | } 512 | 513 | 514 | @synthesize codec = _codec; 515 | @synthesize mainSurfaceWidth = _mainSurfaceWidth; 516 | @synthesize mainSurfaceHeight = _mainSurfaceHeight; 517 | @synthesize mainSurfaceDepth = _mainSurfaceDepth; 518 | @synthesize mipmapCount= _mipmapCount; 519 | @synthesize ddsCaps2 = _ddsCaps2; 520 | @synthesize bpp = _bpp; 521 | 522 | @end 523 | -------------------------------------------------------------------------------- /DDS/decode.m: -------------------------------------------------------------------------------- 1 | // 2 | // decode.m 3 | // QLdds 4 | // 5 | // Created by Jonathan Harris on 10/04/2016. 6 | // 7 | // This file is included into dds.m twice to provide premultiplied 8 | // and non-premultiplied decode functions. 9 | // 10 | 11 | #ifndef HEADER_DDS 12 | # error This file is intended to be included into dds.m rather than compiled directly 13 | #endif 14 | 15 | 16 | #ifdef PREMULTIPLY 17 | 18 | #define DIVIDE_BY_255(v) (((((unsigned)(v)) << 8) + ((unsigned)(v)) + 255) >> 16) 19 | 20 | // Premultiply alpha in-place 21 | inline static Color32 alpha_premultiply(Color32 c, UInt8 a) 22 | { 23 | if (a == 0) 24 | c.u = 0; // Transparent 25 | else if (a == 0xff) 26 | c.a = 0xff; 27 | else 28 | { 29 | c.r = DIVIDE_BY_255(c.r * a); 30 | c.g = DIVIDE_BY_255(c.g * a); 31 | c.b = DIVIDE_BY_255(c.b * a); 32 | c.a = a; 33 | } 34 | return c; 35 | } 36 | # define PREFN(c,a) alpha_premultiply((c),(a)) 37 | 38 | #else 39 | 40 | inline static Color32 alpha_nonmultiply(Color32 c, UInt8 a) 41 | { 42 | c.a = a; 43 | return c; 44 | } 45 | # define PREFN(c,a) alpha_nonmultiply((c),(a)) 46 | 47 | #endif 48 | 49 | 50 | #ifdef PREMULTIPLY 51 | - (void) DecodeSurfacePremultiplied:(int)surface atLevel:(int)mipmapLevel To:(UInt32 *)dst withStride:(int)stride 52 | #else 53 | - (void) DecodeSurface:(int)surface atLevel:(int)mipmapLevel To:(UInt32 *)dst withStride:(int)stride 54 | #endif 55 | { 56 | if (surface < 0 || surface >= _surfaceCount || mipmapLevel < 0 || mipmapLevel >= _mipmapCount) 57 | return; 58 | 59 | const unsigned char *src = ddsdata; 60 | 61 | // See https://msdn.microsoft.com/en-us/library/windows/desktop/bb205577 for cubemap layout 62 | if (surface) 63 | src += surface * [self surfaceSize]; 64 | 65 | int mipmap = 0; 66 | int width = _mainSurfaceWidth; 67 | int height= _mainSurfaceHeight; 68 | while (mipmap < mipmapLevel) 69 | { 70 | if (! (width /= 2)) width = 1; 71 | if (! (height/= 2)) height= 1; 72 | src += [self surfaceSize:mipmap++]; 73 | } 74 | 75 | if (blocksize) 76 | { 77 | // See http://msdn.microsoft.com/en-us/library/bb694531 for descriptions of compression scheme 78 | 79 | Color32 c = { -1 }; // output pixel color 80 | Color32 p[4] = { -1, -1, -1, -1 }; // Color palette for DXT1-DXT5 81 | 82 | for (int y=0; y < height*stride; y += 4*stride) 83 | { 84 | if (fourcc == FOURCC_DXT1) // 1bit alpha 85 | for (int x=0; x < width; x += 4) 86 | { 87 | makeColor32Palette(OSReadLittleInt32(src, 0), p); 88 | UInt32 c_idx = OSReadLittleInt32(src, 4); 89 | 90 | for (int yy = y; yy < MIN(y+4*stride, height*stride); yy += stride) 91 | for (int xx = x; xx < MIN(x+4, width); xx++) 92 | { 93 | dst[yy + xx] = p[c_idx & 3].u; 94 | c_idx >>= 2; 95 | } 96 | src += blocksize; 97 | } 98 | 99 | else if (fourcc == FOURCC_DXT2) // premultiplied alpha 100 | for (int x=0; x < width; x += 4) 101 | { 102 | UInt64 alpha = OSReadLittleInt64(src, 0); 103 | makeColor32Palette(OSReadLittleInt32(src, 8), p); 104 | UInt32 c_idx = OSReadLittleInt32(src, 12); 105 | 106 | for (int yy = y; yy < MIN(y+4*stride, height*stride); yy += stride) 107 | for (int xx = x; xx < MIN(x+4, width); xx++) 108 | { 109 | c.u = p[c_idx & 3].u; 110 | c.a = (alpha & 0xf) | ((alpha & 0xf) << 4); // extend 111 | dst[yy + xx] = c.u; 112 | c_idx >>= 2; 113 | alpha >>= 4; 114 | } 115 | src += blocksize; 116 | } 117 | 118 | else if (fourcc == FOURCC_DXT3) 119 | for (int x=0; x < width; x += 4) 120 | { 121 | UInt64 alpha = OSReadLittleInt64(src, 0); 122 | makeColor32Palette4(OSReadLittleInt32(src, 8), p); 123 | UInt32 c_idx = OSReadLittleInt32(src, 12); 124 | 125 | for (int yy = y; yy < MIN(y+4*stride, height*stride); yy += stride) 126 | for (int xx = x; xx < MIN(x+4, width); xx++) 127 | { 128 | c.u = p[c_idx & 3].u; 129 | dst[yy + xx] = PREFN(c, (alpha & 0xf) | ((alpha & 0xf) << 4)).u; // extend alpha 130 | c_idx >>= 2; 131 | alpha >>= 4; 132 | } 133 | src += blocksize; 134 | } 135 | 136 | else if (fourcc == FOURCC_DXT4) // premultiplied alpha 137 | for (int x=0; x < width; x += 4) 138 | { 139 | UInt8 lum[8]; 140 | UInt64 alpha = OSReadLittleInt64(src, 0); 141 | makeLuminancePalette(alpha, lum); 142 | alpha >>= 16; 143 | makeColor32Palette(OSReadLittleInt32(src, 8), p); 144 | UInt32 c_idx = OSReadLittleInt32(src, 12); 145 | 146 | for (int yy = y; yy < MIN(y+4*stride, height*stride); yy += stride) 147 | for (int xx = x; xx < MIN(x+4, width); xx++) 148 | { 149 | c.u = p[c_idx & 3].u; 150 | c.a = lum[alpha & 0x7]; 151 | dst[yy + xx] = c.u; 152 | c_idx >>= 2; 153 | alpha >>= 3; 154 | } 155 | src += blocksize; 156 | } 157 | 158 | else if (fourcc == FOURCC_DXT5) 159 | for (int x=0; x < width; x += 4) 160 | { 161 | UInt8 lum[8]; 162 | UInt64 a_idx = OSReadLittleInt64(src, 0); 163 | makeLuminancePalette(a_idx, lum); 164 | a_idx >>= 16; 165 | makeColor32Palette4(OSReadLittleInt32(src, 8), p); 166 | UInt32 c_idx = OSReadLittleInt32(src, 12); 167 | 168 | for (int yy = y; yy < MIN(y+4*stride, height*stride); yy += stride) 169 | for (int xx = x; xx < MIN(x+4, width); xx++) 170 | { 171 | c.u = p[c_idx & 3].u; 172 | dst[yy + xx] = PREFN(c, lum[a_idx & 0x7]).u; 173 | c_idx >>= 2; 174 | a_idx >>= 3; 175 | } 176 | src += blocksize; 177 | } 178 | 179 | else if (fourcc == FOURCC_ATI1) 180 | for (int x=0; x < width; x += 4) 181 | { 182 | UInt8 lum[8]; 183 | UInt64 l_idx = OSReadLittleInt64(src, 0); 184 | makeLuminancePalette(l_idx, lum); 185 | l_idx >>= 16; 186 | 187 | for (int yy = y; yy < MIN(y+4*stride, height*stride); yy += stride) 188 | for (int xx = x; xx < MIN(x+4, width); xx++) 189 | { 190 | c.r = c.g = c.b = lum[l_idx & 0x7]; 191 | dst[yy + xx] = c.u; 192 | l_idx >>= 3; 193 | } 194 | src += blocksize; 195 | } 196 | 197 | else if (fourcc == FOURCC_ATI2) 198 | for (int x=0; x < width; x += 4) 199 | { 200 | UInt8 red[8], grn[8]; 201 | UInt64 r_idx = OSReadLittleInt64(src, 0); 202 | makeLuminancePalette(r_idx, red); 203 | r_idx >>= 16; 204 | UInt64 g_idx = OSReadLittleInt64(src, 8); 205 | makeLuminancePalette(g_idx, grn); 206 | g_idx >>= 16; 207 | 208 | for (int yy = y; yy < MIN(y+4*stride, height*stride); yy += stride) 209 | for (int xx = x; xx < MIN(x+4, width); xx++) 210 | { 211 | c.r = red[r_idx & 0x7]; 212 | c.g = grn[g_idx & 0x7]; 213 | computeColor32NormalB(c); 214 | dst[yy + xx] = c.u; 215 | r_idx >>= 3; 216 | g_idx >>= 3; 217 | } 218 | src += blocksize; 219 | } 220 | } 221 | } 222 | else 223 | { 224 | // Linear data 225 | 226 | UInt32 w; 227 | Color32 c = { -1 }; // output pixel color 228 | int rshift = maskshift(rmask); 229 | int gshift = maskshift(gmask); 230 | int bshift = maskshift(bmask); 231 | int ashift = maskshift(amask); 232 | 233 | for (int y = 0; y < height; y++) 234 | { 235 | if (fourcc == FOURCC_RGBA) // common case 236 | for (int x = 0; x < width; x++) 237 | { 238 | w = OSReadLittleInt32(src, 0); 239 | src += pixelsize; 240 | c.r = (w & rmask) >> rshift; 241 | c.g = (w & gmask) >> gshift; 242 | c.b = (w & bmask) >> bshift; 243 | *(dst++) = PREFN(c, (w & amask) >> ashift).u; 244 | } 245 | else if (fourcc == FOURCC_RG) // normal map 246 | for (int x = 0; x < width; x++) 247 | { 248 | w = OSReadLittleInt32(src, 0); 249 | src += pixelsize; 250 | c.r = (w & rmask) >> rshift; 251 | c.g = (w & gmask) >> gshift; 252 | computeColor32NormalB(c); 253 | *(dst++) = c.u; 254 | } 255 | else if (fourcc == FOURCC_LA) 256 | for (int x = 0; x < width; x++) 257 | { 258 | w = OSReadLittleInt32(src, 0); 259 | src += pixelsize; 260 | c.r = c.g = c.b = (w & rmask) >> rshift; // by convention uses the red channel 261 | *(dst++) = PREFN(c, (w & amask) >> ashift).u; 262 | } 263 | else if (fourcc == FOURCC_L) // no alpha 264 | for (int x = 0; x < width; x++) 265 | { 266 | w = OSReadLittleInt32(src, 0); 267 | src += pixelsize; 268 | c.r = c.g = c.b = (w & rmask) >> rshift; // by convention uses the red channel 269 | *(dst++) = c.u; 270 | } 271 | else // RGBX or RGBN - no alpha 272 | for (int x = 0; x < width; x++) 273 | { 274 | w = OSReadLittleInt32(src, 0); 275 | src += pixelsize; 276 | c.r = (w & rmask) >> rshift; 277 | c.g = (w & gmask) >> gshift; 278 | c.b = (w & bmask) >> bshift; 279 | *(dst++) = c.u; 280 | } 281 | 282 | dst += (stride - width); // next line 283 | } 284 | 285 | } 286 | 287 | } 288 | 289 | #undef DIVIDE_BY_255 290 | #undef PREFN 291 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /QLdds.pkgproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PACKAGES 6 | 7 | 8 | PACKAGE_FILES 9 | 10 | DEFAULT_INSTALL_LOCATION 11 | / 12 | HIERARCHY 13 | 14 | CHILDREN 15 | 16 | 17 | CHILDREN 18 | 19 | 20 | CHILDREN 21 | 22 | GID 23 | 80 24 | PATH 25 | Utilities 26 | PATH_TYPE 27 | 0 28 | PERMISSIONS 29 | 493 30 | TYPE 31 | 1 32 | UID 33 | 0 34 | 35 | 36 | GID 37 | 80 38 | PATH 39 | Applications 40 | PATH_TYPE 41 | 0 42 | PERMISSIONS 43 | 509 44 | TYPE 45 | 1 46 | UID 47 | 0 48 | 49 | 50 | CHILDREN 51 | 52 | 53 | CHILDREN 54 | 55 | 56 | CHILDREN 57 | 58 | 59 | BUNDLE_CAN_DOWNGRADE 60 | 61 | BUNDLE_POSTINSTALL_PATH 62 | 63 | PATH_TYPE 64 | 0 65 | 66 | BUNDLE_PREINSTALL_PATH 67 | 68 | PATH_TYPE 69 | 0 70 | 71 | CHILDREN 72 | 73 | GID 74 | 0 75 | PATH 76 | Build/Products/Release/QLdds.app 77 | PATH_TYPE 78 | 1 79 | PERMISSIONS 80 | 493 81 | TYPE 82 | 3 83 | UID 84 | 0 85 | 86 | 87 | GID 88 | 0 89 | PATH 90 | QLdds 91 | PATH_TYPE 92 | 0 93 | PERMISSIONS 94 | 493 95 | TYPE 96 | 2 97 | UID 98 | 0 99 | 100 | 101 | GID 102 | 80 103 | PATH 104 | Application Support 105 | PATH_TYPE 106 | 0 107 | PERMISSIONS 108 | 493 109 | TYPE 110 | 1 111 | UID 112 | 0 113 | 114 | 115 | CHILDREN 116 | 117 | GID 118 | 0 119 | PATH 120 | Automator 121 | PATH_TYPE 122 | 0 123 | PERMISSIONS 124 | 493 125 | TYPE 126 | 1 127 | UID 128 | 0 129 | 130 | 131 | CHILDREN 132 | 133 | GID 134 | 0 135 | PATH 136 | Documentation 137 | PATH_TYPE 138 | 0 139 | PERMISSIONS 140 | 493 141 | TYPE 142 | 1 143 | UID 144 | 0 145 | 146 | 147 | CHILDREN 148 | 149 | GID 150 | 0 151 | PATH 152 | Filesystems 153 | PATH_TYPE 154 | 0 155 | PERMISSIONS 156 | 493 157 | TYPE 158 | 1 159 | UID 160 | 0 161 | 162 | 163 | CHILDREN 164 | 165 | GID 166 | 0 167 | PATH 168 | Frameworks 169 | PATH_TYPE 170 | 0 171 | PERMISSIONS 172 | 493 173 | TYPE 174 | 1 175 | UID 176 | 0 177 | 178 | 179 | CHILDREN 180 | 181 | GID 182 | 0 183 | PATH 184 | Input Methods 185 | PATH_TYPE 186 | 0 187 | PERMISSIONS 188 | 493 189 | TYPE 190 | 1 191 | UID 192 | 0 193 | 194 | 195 | CHILDREN 196 | 197 | GID 198 | 0 199 | PATH 200 | Internet Plug-Ins 201 | PATH_TYPE 202 | 0 203 | PERMISSIONS 204 | 493 205 | TYPE 206 | 1 207 | UID 208 | 0 209 | 210 | 211 | CHILDREN 212 | 213 | GID 214 | 0 215 | PATH 216 | LaunchAgents 217 | PATH_TYPE 218 | 0 219 | PERMISSIONS 220 | 493 221 | TYPE 222 | 1 223 | UID 224 | 0 225 | 226 | 227 | CHILDREN 228 | 229 | GID 230 | 0 231 | PATH 232 | LaunchDaemons 233 | PATH_TYPE 234 | 0 235 | PERMISSIONS 236 | 493 237 | TYPE 238 | 1 239 | UID 240 | 0 241 | 242 | 243 | CHILDREN 244 | 245 | GID 246 | 0 247 | PATH 248 | PreferencePanes 249 | PATH_TYPE 250 | 0 251 | PERMISSIONS 252 | 493 253 | TYPE 254 | 1 255 | UID 256 | 0 257 | 258 | 259 | CHILDREN 260 | 261 | GID 262 | 0 263 | PATH 264 | Preferences 265 | PATH_TYPE 266 | 0 267 | PERMISSIONS 268 | 493 269 | TYPE 270 | 1 271 | UID 272 | 0 273 | 274 | 275 | CHILDREN 276 | 277 | GID 278 | 80 279 | PATH 280 | Printers 281 | PATH_TYPE 282 | 0 283 | PERMISSIONS 284 | 493 285 | TYPE 286 | 1 287 | UID 288 | 0 289 | 290 | 291 | CHILDREN 292 | 293 | GID 294 | 0 295 | PATH 296 | PrivilegedHelperTools 297 | PATH_TYPE 298 | 0 299 | PERMISSIONS 300 | 493 301 | TYPE 302 | 1 303 | UID 304 | 0 305 | 306 | 307 | CHILDREN 308 | 309 | 310 | BUNDLE_CAN_DOWNGRADE 311 | 312 | BUNDLE_POSTINSTALL_PATH 313 | 314 | PATH 315 | qlgenerator/resetquicklookd 316 | PATH_TYPE 317 | 1 318 | 319 | BUNDLE_PREINSTALL_PATH 320 | 321 | PATH_TYPE 322 | 0 323 | 324 | CHILDREN 325 | 326 | GID 327 | 0 328 | PATH 329 | Build/Products/Release/QLdds.qlgenerator 330 | PATH_TYPE 331 | 1 332 | PERMISSIONS 333 | 493 334 | TYPE 335 | 3 336 | UID 337 | 0 338 | 339 | 340 | GID 341 | 0 342 | PATH 343 | QuickLook 344 | PATH_TYPE 345 | 0 346 | PERMISSIONS 347 | 493 348 | TYPE 349 | 1 350 | UID 351 | 0 352 | 353 | 354 | CHILDREN 355 | 356 | GID 357 | 0 358 | PATH 359 | QuickTime 360 | PATH_TYPE 361 | 0 362 | PERMISSIONS 363 | 493 364 | TYPE 365 | 1 366 | UID 367 | 0 368 | 369 | 370 | CHILDREN 371 | 372 | GID 373 | 0 374 | PATH 375 | Screen Savers 376 | PATH_TYPE 377 | 0 378 | PERMISSIONS 379 | 493 380 | TYPE 381 | 1 382 | UID 383 | 0 384 | 385 | 386 | CHILDREN 387 | 388 | GID 389 | 0 390 | PATH 391 | Scripts 392 | PATH_TYPE 393 | 0 394 | PERMISSIONS 395 | 493 396 | TYPE 397 | 1 398 | UID 399 | 0 400 | 401 | 402 | CHILDREN 403 | 404 | GID 405 | 0 406 | PATH 407 | Services 408 | PATH_TYPE 409 | 0 410 | PERMISSIONS 411 | 493 412 | TYPE 413 | 1 414 | UID 415 | 0 416 | 417 | 418 | CHILDREN 419 | 420 | 421 | BUNDLE_CAN_DOWNGRADE 422 | 423 | BUNDLE_POSTINSTALL_PATH 424 | 425 | PATH 426 | mdimporter/resetmds 427 | PATH_TYPE 428 | 1 429 | 430 | BUNDLE_PREINSTALL_PATH 431 | 432 | PATH_TYPE 433 | 0 434 | 435 | CHILDREN 436 | 437 | GID 438 | 0 439 | PATH 440 | Build/Products/Release/DDS.mdimporter 441 | PATH_TYPE 442 | 1 443 | PERMISSIONS 444 | 493 445 | TYPE 446 | 3 447 | UID 448 | 0 449 | 450 | 451 | GID 452 | 0 453 | PATH 454 | Spotlight 455 | PATH_TYPE 456 | 0 457 | PERMISSIONS 458 | 493 459 | TYPE 460 | 2 461 | UID 462 | 0 463 | 464 | 465 | CHILDREN 466 | 467 | GID 468 | 0 469 | PATH 470 | Widgets 471 | PATH_TYPE 472 | 0 473 | PERMISSIONS 474 | 493 475 | TYPE 476 | 1 477 | UID 478 | 0 479 | 480 | 481 | GID 482 | 0 483 | PATH 484 | Library 485 | PATH_TYPE 486 | 0 487 | PERMISSIONS 488 | 493 489 | TYPE 490 | 1 491 | UID 492 | 0 493 | 494 | 495 | CHILDREN 496 | 497 | 498 | CHILDREN 499 | 500 | 501 | CHILDREN 502 | 503 | GID 504 | 0 505 | PATH 506 | Extensions 507 | PATH_TYPE 508 | 0 509 | PERMISSIONS 510 | 493 511 | TYPE 512 | 1 513 | UID 514 | 0 515 | 516 | 517 | GID 518 | 0 519 | PATH 520 | Library 521 | PATH_TYPE 522 | 0 523 | PERMISSIONS 524 | 493 525 | TYPE 526 | 1 527 | UID 528 | 0 529 | 530 | 531 | GID 532 | 0 533 | PATH 534 | System 535 | PATH_TYPE 536 | 0 537 | PERMISSIONS 538 | 493 539 | TYPE 540 | 1 541 | UID 542 | 0 543 | 544 | 545 | CHILDREN 546 | 547 | 548 | CHILDREN 549 | 550 | GID 551 | 0 552 | PATH 553 | Shared 554 | PATH_TYPE 555 | 0 556 | PERMISSIONS 557 | 1023 558 | TYPE 559 | 1 560 | UID 561 | 0 562 | 563 | 564 | GID 565 | 80 566 | PATH 567 | Users 568 | PATH_TYPE 569 | 0 570 | PERMISSIONS 571 | 493 572 | TYPE 573 | 1 574 | UID 575 | 0 576 | 577 | 578 | GID 579 | 0 580 | PATH 581 | / 582 | PATH_TYPE 583 | 0 584 | PERMISSIONS 585 | 493 586 | TYPE 587 | 1 588 | UID 589 | 0 590 | 591 | PAYLOAD_TYPE 592 | 0 593 | SHOW_INVISIBLE 594 | 595 | SPLIT_FORKS 596 | 597 | TREAT_MISSING_FILES_AS_WARNING 598 | 599 | VERSION 600 | 3 601 | 602 | PACKAGE_SCRIPTS 603 | 604 | POSTINSTALL_PATH 605 | 606 | PATH_TYPE 607 | 0 608 | 609 | PREINSTALL_PATH 610 | 611 | PATH_TYPE 612 | 0 613 | 614 | RESOURCES 615 | 616 | 617 | PACKAGE_SETTINGS 618 | 619 | AUTHENTICATION 620 | 1 621 | CONCLUSION_ACTION 622 | 0 623 | FOLLOW_SYMBOLIC_LINKS 624 | 625 | IDENTIFIER 626 | uk.org.marginal.qldds 627 | LOCATION 628 | 0 629 | NAME 630 | QLdds 631 | OVERWRITE_PERMISSIONS 632 | 633 | PAYLOAD_SIZE 634 | -1 635 | RELOCATABLE 636 | 637 | USE_HFS+_COMPRESSION 638 | 639 | VERSION 640 | 1.3.3 641 | 642 | TYPE 643 | 0 644 | UUID 645 | 1F03E77B-F4D3-4322-B38B-5BD1A75CC323 646 | 647 | 648 | PROJECT 649 | 650 | PROJECT_COMMENTS 651 | 652 | NOTES 653 | 654 | PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBIVE1M 655 | IDQuMDEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvVFIvaHRtbDQv 656 | c3RyaWN0LmR0ZCI+CjxodG1sPgo8aGVhZD4KPG1ldGEgaHR0cC1l 657 | cXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7 658 | IGNoYXJzZXQ9VVRGLTgiPgo8bWV0YSBodHRwLWVxdWl2PSJDb250 659 | ZW50LVN0eWxlLVR5cGUiIGNvbnRlbnQ9InRleHQvY3NzIj4KPHRp 660 | dGxlPjwvdGl0bGU+CjxtZXRhIG5hbWU9IkdlbmVyYXRvciIgY29u 661 | dGVudD0iQ29jb2EgSFRNTCBXcml0ZXIiPgo8bWV0YSBuYW1lPSJD 662 | b2NvYVZlcnNpb24iIGNvbnRlbnQ9IjEyNjUuMjEiPgo8c3R5bGUg 663 | dHlwZT0idGV4dC9jc3MiPgo8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5 664 | Pgo8L2JvZHk+CjwvaHRtbD4K 665 | 666 | 667 | PROJECT_PRESENTATION 668 | 669 | BACKGROUND 670 | 671 | INSTALLATION TYPE 672 | 673 | HIERARCHIES 674 | 675 | INSTALLER 676 | 677 | LIST 678 | 679 | 680 | DESCRIPTION 681 | 682 | OPTIONS 683 | 684 | HIDDEN 685 | 686 | STATE 687 | 1 688 | 689 | PACKAGE_UUID 690 | 1F03E77B-F4D3-4322-B38B-5BD1A75CC323 691 | TITLE 692 | 693 | TOOLTIP 694 | 695 | TYPE 696 | 0 697 | UUID 698 | 1CF34A10-6686-4427-A14B-AAD2FAB458CA 699 | 700 | 701 | REMOVED 702 | 703 | 704 | 705 | MODE 706 | 1 707 | 708 | INSTALLATION_STEPS 709 | 710 | 711 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 712 | ICPresentationViewIntroductionController 713 | INSTALLER_PLUGIN 714 | Introduction 715 | LIST_TITLE_KEY 716 | InstallerSectionTitle 717 | 718 | 719 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 720 | ICPresentationViewReadMeController 721 | INSTALLER_PLUGIN 722 | ReadMe 723 | LIST_TITLE_KEY 724 | InstallerSectionTitle 725 | 726 | 727 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 728 | ICPresentationViewLicenseController 729 | INSTALLER_PLUGIN 730 | License 731 | LIST_TITLE_KEY 732 | InstallerSectionTitle 733 | 734 | 735 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 736 | ICPresentationViewDestinationSelectController 737 | INSTALLER_PLUGIN 738 | TargetSelect 739 | LIST_TITLE_KEY 740 | InstallerSectionTitle 741 | 742 | 743 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 744 | ICPresentationViewInstallationTypeController 745 | INSTALLER_PLUGIN 746 | PackageSelection 747 | LIST_TITLE_KEY 748 | InstallerSectionTitle 749 | 750 | 751 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 752 | ICPresentationViewInstallationController 753 | INSTALLER_PLUGIN 754 | Install 755 | LIST_TITLE_KEY 756 | InstallerSectionTitle 757 | 758 | 759 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 760 | ICPresentationViewSummaryController 761 | INSTALLER_PLUGIN 762 | Summary 763 | LIST_TITLE_KEY 764 | InstallerSectionTitle 765 | 766 | 767 | INTRODUCTION 768 | 769 | LOCALIZATIONS 770 | 771 | 772 | LICENSE 773 | 774 | LOCALIZATIONS 775 | 776 | 777 | LANGUAGE 778 | English 779 | VALUE 780 | 781 | PATH 782 | Resources/en.lproj/license.rtf 783 | PATH_TYPE 784 | 1 785 | 786 | 787 | 788 | MODE 789 | 0 790 | 791 | README 792 | 793 | LOCALIZATIONS 794 | 795 | 796 | SUMMARY 797 | 798 | LOCALIZATIONS 799 | 800 | 801 | TITLE 802 | 803 | LOCALIZATIONS 804 | 805 | 806 | 807 | PROJECT_REQUIREMENTS 808 | 809 | LIST 810 | 811 | 812 | BEHAVIOR 813 | 3 814 | DICTIONARY 815 | 816 | IC_REQUIREMENT_OS_DISK_TYPE 817 | 0 818 | IC_REQUIREMENT_OS_DISTRIBUTION_TYPE 819 | 0 820 | IC_REQUIREMENT_OS_MINIMUM_VERSION 821 | 100600 822 | 823 | IC_REQUIREMENT_CHECK_TYPE 824 | 1 825 | IDENTIFIER 826 | fr.whitebox.Packages.requirement.os 827 | MESSAGE 828 | 829 | NAME 830 | Operating System 831 | STATE 832 | 833 | 834 | 835 | RESOURCES 836 | 837 | ROOT_VOLUME_ONLY 838 | 839 | 840 | PROJECT_SETTINGS 841 | 842 | ADVANCED_OPTIONS 843 | 844 | installer-script.options:hostArchitectures 845 | 846 | 847 | 848 | 849 | BUILD_FORMAT 850 | 0 851 | BUILD_PATH 852 | 853 | PATH 854 | . 855 | PATH_TYPE 856 | 1 857 | 858 | EXCLUDED_FILES 859 | 860 | 861 | PATTERNS_ARRAY 862 | 863 | 864 | REGULAR_EXPRESSION 865 | 866 | STRING 867 | .DS_Store 868 | TYPE 869 | 0 870 | 871 | 872 | PROTECTED 873 | 874 | PROXY_NAME 875 | Remove .DS_Store files 876 | PROXY_TOOLTIP 877 | Remove ".DS_Store" files created by the Finder. 878 | STATE 879 | 880 | 881 | 882 | PATTERNS_ARRAY 883 | 884 | 885 | REGULAR_EXPRESSION 886 | 887 | STRING 888 | .pbdevelopment 889 | TYPE 890 | 0 891 | 892 | 893 | PROTECTED 894 | 895 | PROXY_NAME 896 | Remove .pbdevelopment files 897 | PROXY_TOOLTIP 898 | Remove ".pbdevelopment" files created by ProjectBuilder or Xcode. 899 | STATE 900 | 901 | 902 | 903 | PATTERNS_ARRAY 904 | 905 | 906 | REGULAR_EXPRESSION 907 | 908 | STRING 909 | CVS 910 | TYPE 911 | 1 912 | 913 | 914 | REGULAR_EXPRESSION 915 | 916 | STRING 917 | .cvsignore 918 | TYPE 919 | 0 920 | 921 | 922 | REGULAR_EXPRESSION 923 | 924 | STRING 925 | .cvspass 926 | TYPE 927 | 0 928 | 929 | 930 | REGULAR_EXPRESSION 931 | 932 | STRING 933 | .svn 934 | TYPE 935 | 1 936 | 937 | 938 | REGULAR_EXPRESSION 939 | 940 | STRING 941 | .git 942 | TYPE 943 | 1 944 | 945 | 946 | REGULAR_EXPRESSION 947 | 948 | STRING 949 | .gitignore 950 | TYPE 951 | 0 952 | 953 | 954 | PROTECTED 955 | 956 | PROXY_NAME 957 | Remove SCM metadata 958 | PROXY_TOOLTIP 959 | Remove helper files and folders used by the CVS, SVN or Git Source Code Management systems. 960 | STATE 961 | 962 | 963 | 964 | PATTERNS_ARRAY 965 | 966 | 967 | REGULAR_EXPRESSION 968 | 969 | STRING 970 | classes.nib 971 | TYPE 972 | 0 973 | 974 | 975 | REGULAR_EXPRESSION 976 | 977 | STRING 978 | designable.db 979 | TYPE 980 | 0 981 | 982 | 983 | REGULAR_EXPRESSION 984 | 985 | STRING 986 | info.nib 987 | TYPE 988 | 0 989 | 990 | 991 | PROTECTED 992 | 993 | PROXY_NAME 994 | Optimize nib files 995 | PROXY_TOOLTIP 996 | Remove "classes.nib", "info.nib" and "designable.nib" files within .nib bundles. 997 | STATE 998 | 999 | 1000 | 1001 | PATTERNS_ARRAY 1002 | 1003 | 1004 | REGULAR_EXPRESSION 1005 | 1006 | STRING 1007 | Resources Disabled 1008 | TYPE 1009 | 1 1010 | 1011 | 1012 | PROTECTED 1013 | 1014 | PROXY_NAME 1015 | Remove Resources Disabled folders 1016 | PROXY_TOOLTIP 1017 | Remove "Resources Disabled" folders. 1018 | STATE 1019 | 1020 | 1021 | 1022 | SEPARATOR 1023 | 1024 | 1025 | 1026 | NAME 1027 | QuickLook DDS 1028 | PAYLOAD_ONLY 1029 | 1030 | TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING 1031 | 1032 | 1033 | 1034 | TYPE 1035 | 0 1036 | VERSION 1037 | 2 1038 | 1039 | 1040 | -------------------------------------------------------------------------------- /QLdds.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | AB2612271A27F0BA0050B3AA /* dds.m in Sources */ = {isa = PBXBuildFile; fileRef = ABF5B48C1A2531E40017F8E9 /* dds.m */; }; 11 | AB36E9991A2E91BE00862ADF /* schema.xml in Resources */ = {isa = PBXBuildFile; fileRef = AB36E9971A2E91A100862ADF /* schema.xml */; }; 12 | AB36E99C1A2EBF2500862ADF /* schema.strings in Resources */ = {isa = PBXBuildFile; fileRef = AB36E99A1A2EBF2500862ADF /* schema.strings */; }; 13 | AB8A4A251A22DF1D002E5A59 /* GetMetadataForFile.m in Sources */ = {isa = PBXBuildFile; fileRef = AB8A4A221A22DF1D002E5A59 /* GetMetadataForFile.m */; }; 14 | AB8A4A271A22DF1D002E5A59 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = AB8A4A241A22DF1D002E5A59 /* main.c */; }; 15 | ABAB4A381A238A7B00B1BD18 /* GenerateThumbnailForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = AB8A4A2E1A22DFB6002E5A59 /* GenerateThumbnailForURL.m */; }; 16 | ABAB4A391A238A8000B1BD18 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = AB8A4A301A22DFB6002E5A59 /* main.c */; }; 17 | ABAB4A3A1A238A8400B1BD18 /* GeneratePreviewForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = AB8A4A2D1A22DFB6002E5A59 /* GeneratePreviewForURL.m */; }; 18 | ABD434BF1A2D6AF900ED8B26 /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8A4AA41A22FBB0002E5A59 /* QuickLook.framework */; }; 19 | ABD434C91A2D6CF700ED8B26 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8A4AD81A22FD09002E5A59 /* ApplicationServices.framework */; }; 20 | ABD434CA1A2D6CFF00ED8B26 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB60480E1A2691E900D39FDE /* Foundation.framework */; }; 21 | ABD434CB1A2D6D1600ED8B26 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8A4A961A22FAED002E5A59 /* CoreFoundation.framework */; }; 22 | ABD434CF1A2D6DA600ED8B26 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8A4AD81A22FD09002E5A59 /* ApplicationServices.framework */; }; 23 | ABD434D01A2D6DE800ED8B26 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB60480E1A2691E900D39FDE /* Foundation.framework */; }; 24 | ABD434D21A2D6DF400ED8B26 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8A4A961A22FAED002E5A59 /* CoreFoundation.framework */; }; 25 | ABD434D41A2D726A00ED8B26 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABD434D31A2D726A00ED8B26 /* CoreServices.framework */; }; 26 | ABD435011A2E44B600ED8B26 /* QLdds in CopyFiles */ = {isa = PBXBuildFile; fileRef = ABD434D71A2E3FED00ED8B26 /* QLdds */; }; 27 | ABF5B48E1A2531E40017F8E9 /* dds.m in Sources */ = {isa = PBXBuildFile; fileRef = ABF5B48C1A2531E40017F8E9 /* dds.m */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | ABD434FC1A2E448A00ED8B26 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = AB8A49DC1A22DBE7002E5A59 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = AB8A4A091A22DD6B002E5A59; 36 | remoteInfo = mdimporter; 37 | }; 38 | ABD434FE1A2E448A00ED8B26 /* PBXContainerItemProxy */ = { 39 | isa = PBXContainerItemProxy; 40 | containerPortal = AB8A49DC1A22DBE7002E5A59 /* Project object */; 41 | proxyType = 1; 42 | remoteGlobalIDString = ABAB4A301A23898A00B1BD18; 43 | remoteInfo = qlgenerator; 44 | }; 45 | /* End PBXContainerItemProxy section */ 46 | 47 | /* Begin PBXCopyFilesBuildPhase section */ 48 | ABD435001A2E44AC00ED8B26 /* CopyFiles */ = { 49 | isa = PBXCopyFilesBuildPhase; 50 | buildActionMask = 2147483647; 51 | dstPath = ""; 52 | dstSubfolderSpec = 6; 53 | files = ( 54 | ABD435011A2E44B600ED8B26 /* QLdds in CopyFiles */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXCopyFilesBuildPhase section */ 59 | 60 | /* Begin PBXFileReference section */ 61 | AB36E9971A2E91A100862ADF /* schema.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = schema.xml; sourceTree = ""; }; 62 | AB36E99B1A2EBF2500862ADF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/schema.strings; sourceTree = ""; }; 63 | AB60480E1A2691E900D39FDE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 64 | AB8A4A0A1A22DD6B002E5A59 /* DDS.mdimporter */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DDS.mdimporter; sourceTree = BUILT_PRODUCTS_DIR; }; 65 | AB8A4A221A22DF1D002E5A59 /* GetMetadataForFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetMetadataForFile.m; sourceTree = ""; }; 66 | AB8A4A231A22DF1D002E5A59 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 67 | AB8A4A241A22DF1D002E5A59 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; 68 | AB8A4A2D1A22DFB6002E5A59 /* GeneratePreviewForURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratePreviewForURL.m; sourceTree = ""; }; 69 | AB8A4A2E1A22DFB6002E5A59 /* GenerateThumbnailForURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GenerateThumbnailForURL.m; sourceTree = ""; }; 70 | AB8A4A2F1A22DFB6002E5A59 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 71 | AB8A4A301A22DFB6002E5A59 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; 72 | AB8A4A961A22FAED002E5A59 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 73 | AB8A4AA41A22FBB0002E5A59 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; }; 74 | AB8A4AD81A22FD09002E5A59 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; }; 75 | AB9D8A6D1CBA91750004A0D3 /* decode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = decode.m; sourceTree = ""; }; 76 | ABAB4A311A23898A00B1BD18 /* QLdds.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QLdds.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; }; 77 | ABD434D31A2D726A00ED8B26 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; 78 | ABD434D61A2E3FED00ED8B26 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 79 | ABD434D71A2E3FED00ED8B26 /* QLdds */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = QLdds; sourceTree = ""; }; 80 | ABD434DC1A2E406E00ED8B26 /* QLdds.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QLdds.app; sourceTree = BUILT_PRODUCTS_DIR; }; 81 | ABF5B48C1A2531E40017F8E9 /* dds.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = dds.m; sourceTree = ""; }; 82 | ABF5B48D1A2531E40017F8E9 /* dds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dds.h; sourceTree = ""; }; 83 | /* End PBXFileReference section */ 84 | 85 | /* Begin PBXFrameworksBuildPhase section */ 86 | AB8A4A081A22DD6B002E5A59 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ABD434D21A2D6DF400ED8B26 /* CoreFoundation.framework in Frameworks */, 91 | ABD434CF1A2D6DA600ED8B26 /* ApplicationServices.framework in Frameworks */, 92 | ABD434D01A2D6DE800ED8B26 /* Foundation.framework in Frameworks */, 93 | ABD434D41A2D726A00ED8B26 /* CoreServices.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | ABAB4A2F1A23898A00B1BD18 /* Frameworks */ = { 98 | isa = PBXFrameworksBuildPhase; 99 | buildActionMask = 2147483647; 100 | files = ( 101 | ABD434CB1A2D6D1600ED8B26 /* CoreFoundation.framework in Frameworks */, 102 | ABD434BF1A2D6AF900ED8B26 /* QuickLook.framework in Frameworks */, 103 | ABD434C91A2D6CF700ED8B26 /* ApplicationServices.framework in Frameworks */, 104 | ABD434CA1A2D6CFF00ED8B26 /* Foundation.framework in Frameworks */, 105 | ); 106 | runOnlyForDeploymentPostprocessing = 0; 107 | }; 108 | /* End PBXFrameworksBuildPhase section */ 109 | 110 | /* Begin PBXGroup section */ 111 | AB899C8A1A2F4E1000EAB3EA /* Resources */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | AB36E9971A2E91A100862ADF /* schema.xml */, 115 | AB36E99A1A2EBF2500862ADF /* schema.strings */, 116 | ); 117 | path = Resources; 118 | sourceTree = ""; 119 | }; 120 | AB8A49DA1A22DBE7002E5A59 = { 121 | isa = PBXGroup; 122 | children = ( 123 | ABD434D51A2E3F7000ED8B26 /* app */, 124 | AB8A4A211A22DEDD002E5A59 /* mdimporter */, 125 | AB8A4A281A22DF8F002E5A59 /* qlgenerator */, 126 | ABF5B48B1A2531AC0017F8E9 /* DDS */, 127 | ABAB4CFF1A238C6000B1BD18 /* External Frameworks and Libraries */, 128 | AB8A4A0B1A22DD6B002E5A59 /* Products */, 129 | ); 130 | sourceTree = ""; 131 | }; 132 | AB8A4A0B1A22DD6B002E5A59 /* Products */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | AB8A4A0A1A22DD6B002E5A59 /* DDS.mdimporter */, 136 | ABAB4A311A23898A00B1BD18 /* QLdds.qlgenerator */, 137 | ABD434DC1A2E406E00ED8B26 /* QLdds.app */, 138 | ); 139 | name = Products; 140 | sourceTree = ""; 141 | }; 142 | AB8A4A211A22DEDD002E5A59 /* mdimporter */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | AB8A4A221A22DF1D002E5A59 /* GetMetadataForFile.m */, 146 | AB8A4A241A22DF1D002E5A59 /* main.c */, 147 | AB8A4A231A22DF1D002E5A59 /* Info.plist */, 148 | AB899C8A1A2F4E1000EAB3EA /* Resources */, 149 | ); 150 | path = mdimporter; 151 | sourceTree = ""; 152 | }; 153 | AB8A4A281A22DF8F002E5A59 /* qlgenerator */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | AB8A4A2D1A22DFB6002E5A59 /* GeneratePreviewForURL.m */, 157 | AB8A4A2E1A22DFB6002E5A59 /* GenerateThumbnailForURL.m */, 158 | AB8A4A301A22DFB6002E5A59 /* main.c */, 159 | AB8A4A2F1A22DFB6002E5A59 /* Info.plist */, 160 | ); 161 | path = qlgenerator; 162 | sourceTree = ""; 163 | }; 164 | ABAB4CFF1A238C6000B1BD18 /* External Frameworks and Libraries */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | AB8A4AD81A22FD09002E5A59 /* ApplicationServices.framework */, 168 | AB60480E1A2691E900D39FDE /* Foundation.framework */, 169 | AB8A4A961A22FAED002E5A59 /* CoreFoundation.framework */, 170 | ABD434D31A2D726A00ED8B26 /* CoreServices.framework */, 171 | AB8A4AA41A22FBB0002E5A59 /* QuickLook.framework */, 172 | ); 173 | name = "External Frameworks and Libraries"; 174 | sourceTree = SDKROOT; 175 | }; 176 | ABD434D51A2E3F7000ED8B26 /* app */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | ABD434D71A2E3FED00ED8B26 /* QLdds */, 180 | ABD434D61A2E3FED00ED8B26 /* Info.plist */, 181 | ); 182 | path = app; 183 | sourceTree = ""; 184 | }; 185 | ABF5B48B1A2531AC0017F8E9 /* DDS */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | ABF5B48D1A2531E40017F8E9 /* dds.h */, 189 | ABF5B48C1A2531E40017F8E9 /* dds.m */, 190 | AB9D8A6D1CBA91750004A0D3 /* decode.m */, 191 | ); 192 | path = DDS; 193 | sourceTree = ""; 194 | }; 195 | /* End PBXGroup section */ 196 | 197 | /* Begin PBXNativeTarget section */ 198 | AB8A4A091A22DD6B002E5A59 /* mdimporter */ = { 199 | isa = PBXNativeTarget; 200 | buildConfigurationList = AB8A4A0F1A22DD6C002E5A59 /* Build configuration list for PBXNativeTarget "mdimporter" */; 201 | buildPhases = ( 202 | AB8A4A061A22DD6B002E5A59 /* Resources */, 203 | AB8A4A071A22DD6B002E5A59 /* Sources */, 204 | AB8A4A081A22DD6B002E5A59 /* Frameworks */, 205 | ); 206 | buildRules = ( 207 | ); 208 | dependencies = ( 209 | ); 210 | name = mdimporter; 211 | productName = mdimporter; 212 | productReference = AB8A4A0A1A22DD6B002E5A59 /* DDS.mdimporter */; 213 | productType = "com.apple.product-type.bundle"; 214 | }; 215 | ABAB4A301A23898A00B1BD18 /* qlgenerator */ = { 216 | isa = PBXNativeTarget; 217 | buildConfigurationList = ABAB4A361A23898B00B1BD18 /* Build configuration list for PBXNativeTarget "qlgenerator" */; 218 | buildPhases = ( 219 | ABAB4A2D1A23898A00B1BD18 /* Resources */, 220 | ABAB4A2E1A23898A00B1BD18 /* Sources */, 221 | ABAB4A2F1A23898A00B1BD18 /* Frameworks */, 222 | ); 223 | buildRules = ( 224 | ); 225 | dependencies = ( 226 | ); 227 | name = qlgenerator; 228 | productName = QLdds; 229 | productReference = ABAB4A311A23898A00B1BD18 /* QLdds.qlgenerator */; 230 | productType = "com.apple.product-type.bundle"; 231 | }; 232 | ABD434DB1A2E406E00ED8B26 /* QLdds */ = { 233 | isa = PBXNativeTarget; 234 | buildConfigurationList = ABD434F61A2E406F00ED8B26 /* Build configuration list for PBXNativeTarget "QLdds" */; 235 | buildPhases = ( 236 | ABD435001A2E44AC00ED8B26 /* CopyFiles */, 237 | ); 238 | buildRules = ( 239 | ); 240 | dependencies = ( 241 | ABD434FD1A2E448A00ED8B26 /* PBXTargetDependency */, 242 | ABD434FF1A2E448A00ED8B26 /* PBXTargetDependency */, 243 | ); 244 | name = QLdds; 245 | productName = QLdds; 246 | productReference = ABD434DC1A2E406E00ED8B26 /* QLdds.app */; 247 | productType = "com.apple.product-type.application"; 248 | }; 249 | /* End PBXNativeTarget section */ 250 | 251 | /* Begin PBXProject section */ 252 | AB8A49DC1A22DBE7002E5A59 /* Project object */ = { 253 | isa = PBXProject; 254 | attributes = { 255 | LastUpgradeCheck = 0900; 256 | TargetAttributes = { 257 | ABD434DB1A2E406E00ED8B26 = { 258 | CreatedOnToolsVersion = 6.1; 259 | DevelopmentTeam = R8954VZGV2; 260 | }; 261 | }; 262 | }; 263 | buildConfigurationList = AB8A49DF1A22DBE7002E5A59 /* Build configuration list for PBXProject "QLdds" */; 264 | compatibilityVersion = "Xcode 3.2"; 265 | developmentRegion = English; 266 | hasScannedForEncodings = 0; 267 | knownRegions = ( 268 | en, 269 | ); 270 | mainGroup = AB8A49DA1A22DBE7002E5A59; 271 | productRefGroup = AB8A4A0B1A22DD6B002E5A59 /* Products */; 272 | projectDirPath = ""; 273 | projectRoot = ""; 274 | targets = ( 275 | ABD434DB1A2E406E00ED8B26 /* QLdds */, 276 | AB8A4A091A22DD6B002E5A59 /* mdimporter */, 277 | ABAB4A301A23898A00B1BD18 /* qlgenerator */, 278 | ); 279 | }; 280 | /* End PBXProject section */ 281 | 282 | /* Begin PBXResourcesBuildPhase section */ 283 | AB8A4A061A22DD6B002E5A59 /* Resources */ = { 284 | isa = PBXResourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | AB36E9991A2E91BE00862ADF /* schema.xml in Resources */, 288 | AB36E99C1A2EBF2500862ADF /* schema.strings in Resources */, 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | ABAB4A2D1A23898A00B1BD18 /* Resources */ = { 293 | isa = PBXResourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | /* End PBXResourcesBuildPhase section */ 300 | 301 | /* Begin PBXSourcesBuildPhase section */ 302 | AB8A4A071A22DD6B002E5A59 /* Sources */ = { 303 | isa = PBXSourcesBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | ABF5B48E1A2531E40017F8E9 /* dds.m in Sources */, 307 | AB8A4A251A22DF1D002E5A59 /* GetMetadataForFile.m in Sources */, 308 | AB8A4A271A22DF1D002E5A59 /* main.c in Sources */, 309 | ); 310 | runOnlyForDeploymentPostprocessing = 0; 311 | }; 312 | ABAB4A2E1A23898A00B1BD18 /* Sources */ = { 313 | isa = PBXSourcesBuildPhase; 314 | buildActionMask = 2147483647; 315 | files = ( 316 | AB2612271A27F0BA0050B3AA /* dds.m in Sources */, 317 | ABAB4A381A238A7B00B1BD18 /* GenerateThumbnailForURL.m in Sources */, 318 | ABAB4A3A1A238A8400B1BD18 /* GeneratePreviewForURL.m in Sources */, 319 | ABAB4A391A238A8000B1BD18 /* main.c in Sources */, 320 | ); 321 | runOnlyForDeploymentPostprocessing = 0; 322 | }; 323 | /* End PBXSourcesBuildPhase section */ 324 | 325 | /* Begin PBXTargetDependency section */ 326 | ABD434FD1A2E448A00ED8B26 /* PBXTargetDependency */ = { 327 | isa = PBXTargetDependency; 328 | target = AB8A4A091A22DD6B002E5A59 /* mdimporter */; 329 | targetProxy = ABD434FC1A2E448A00ED8B26 /* PBXContainerItemProxy */; 330 | }; 331 | ABD434FF1A2E448A00ED8B26 /* PBXTargetDependency */ = { 332 | isa = PBXTargetDependency; 333 | target = ABAB4A301A23898A00B1BD18 /* qlgenerator */; 334 | targetProxy = ABD434FE1A2E448A00ED8B26 /* PBXContainerItemProxy */; 335 | }; 336 | /* End PBXTargetDependency section */ 337 | 338 | /* Begin PBXVariantGroup section */ 339 | AB36E99A1A2EBF2500862ADF /* schema.strings */ = { 340 | isa = PBXVariantGroup; 341 | children = ( 342 | AB36E99B1A2EBF2500862ADF /* en */, 343 | ); 344 | name = schema.strings; 345 | sourceTree = ""; 346 | }; 347 | /* End PBXVariantGroup section */ 348 | 349 | /* Begin XCBuildConfiguration section */ 350 | AB8A49DD1A22DBE7002E5A59 /* Debug */ = { 351 | isa = XCBuildConfiguration; 352 | buildSettings = { 353 | CLANG_ENABLE_OBJC_ARC = YES; 354 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 355 | CLANG_WARN_BOOL_CONVERSION = YES; 356 | CLANG_WARN_COMMA = YES; 357 | CLANG_WARN_CONSTANT_CONVERSION = YES; 358 | CLANG_WARN_EMPTY_BODY = YES; 359 | CLANG_WARN_ENUM_CONVERSION = YES; 360 | CLANG_WARN_INFINITE_RECURSION = YES; 361 | CLANG_WARN_INT_CONVERSION = YES; 362 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 363 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 364 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 365 | CLANG_WARN_STRICT_PROTOTYPES = YES; 366 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 367 | CLANG_WARN_UNREACHABLE_CODE = YES; 368 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 369 | ENABLE_STRICT_OBJC_MSGSEND = YES; 370 | ENABLE_TESTABILITY = YES; 371 | GCC_C_LANGUAGE_STANDARD = gnu99; 372 | GCC_ENABLE_PASCAL_STRINGS = NO; 373 | GCC_FAST_MATH = YES; 374 | GCC_NO_COMMON_BLOCKS = YES; 375 | GCC_OPTIMIZATION_LEVEL = 0; 376 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG; 377 | GCC_SYMBOLS_PRIVATE_EXTERN = YES; 378 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 379 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 380 | GCC_WARN_UNDECLARED_SELECTOR = YES; 381 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 382 | GCC_WARN_UNUSED_FUNCTION = YES; 383 | GCC_WARN_UNUSED_VARIABLE = YES; 384 | HEADER_SEARCH_PATHS = "$(PROJECT_DIR)"; 385 | MACOSX_DEPLOYMENT_TARGET = 10.6; 386 | ONLY_ACTIVE_ARCH = YES; 387 | WARNING_CFLAGS = "-Winline"; 388 | }; 389 | name = Debug; 390 | }; 391 | AB8A49DE1A22DBE7002E5A59 /* Release */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | CLANG_ENABLE_OBJC_ARC = YES; 395 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 396 | CLANG_WARN_BOOL_CONVERSION = YES; 397 | CLANG_WARN_COMMA = YES; 398 | CLANG_WARN_CONSTANT_CONVERSION = YES; 399 | CLANG_WARN_EMPTY_BODY = YES; 400 | CLANG_WARN_ENUM_CONVERSION = YES; 401 | CLANG_WARN_INFINITE_RECURSION = YES; 402 | CLANG_WARN_INT_CONVERSION = YES; 403 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 404 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 405 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 406 | CLANG_WARN_STRICT_PROTOTYPES = YES; 407 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 408 | CLANG_WARN_UNREACHABLE_CODE = YES; 409 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 410 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 411 | ENABLE_STRICT_OBJC_MSGSEND = YES; 412 | GCC_C_LANGUAGE_STANDARD = gnu99; 413 | GCC_ENABLE_PASCAL_STRINGS = NO; 414 | GCC_FAST_MATH = YES; 415 | GCC_NO_COMMON_BLOCKS = YES; 416 | GCC_PREPROCESSOR_DEFINITIONS = NDEBUG; 417 | GCC_SYMBOLS_PRIVATE_EXTERN = YES; 418 | GCC_UNROLL_LOOPS = YES; 419 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 420 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 421 | GCC_WARN_UNDECLARED_SELECTOR = YES; 422 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 423 | GCC_WARN_UNUSED_FUNCTION = YES; 424 | GCC_WARN_UNUSED_VARIABLE = YES; 425 | HEADER_SEARCH_PATHS = "$(PROJECT_DIR)"; 426 | MACOSX_DEPLOYMENT_TARGET = 10.6; 427 | WARNING_CFLAGS = "-Winline"; 428 | }; 429 | name = Release; 430 | }; 431 | AB8A4A0D1A22DD6C002E5A59 /* Debug */ = { 432 | isa = XCBuildConfiguration; 433 | buildSettings = { 434 | COMBINE_HIDPI_IMAGES = YES; 435 | GCC_DYNAMIC_NO_PIC = NO; 436 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 437 | GCC_OPTIMIZATION_LEVEL = 0; 438 | INFOPLIST_FILE = mdimporter/Info.plist; 439 | INSTALL_PATH = /Library/Spotlight; 440 | PREBINDING = NO; 441 | PRODUCT_BUNDLE_IDENTIFIER = uk.org.marginal.qldds.mdimporter; 442 | PRODUCT_NAME = DDS; 443 | WRAPPER_EXTENSION = mdimporter; 444 | }; 445 | name = Debug; 446 | }; 447 | AB8A4A0E1A22DD6C002E5A59 /* Release */ = { 448 | isa = XCBuildConfiguration; 449 | buildSettings = { 450 | COMBINE_HIDPI_IMAGES = YES; 451 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 452 | INFOPLIST_FILE = mdimporter/Info.plist; 453 | INSTALL_PATH = /Library/Spotlight; 454 | PREBINDING = NO; 455 | PRODUCT_BUNDLE_IDENTIFIER = uk.org.marginal.qldds.mdimporter; 456 | PRODUCT_NAME = DDS; 457 | WRAPPER_EXTENSION = mdimporter; 458 | ZERO_LINK = NO; 459 | }; 460 | name = Release; 461 | }; 462 | ABAB4A341A23898B00B1BD18 /* Debug */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | COMBINE_HIDPI_IMAGES = YES; 466 | GCC_DYNAMIC_NO_PIC = NO; 467 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 468 | GCC_OPTIMIZATION_LEVEL = 0; 469 | INFOPLIST_FILE = qlgenerator/Info.plist; 470 | INSTALL_PATH = /Library/QuickLook; 471 | PREBINDING = NO; 472 | PRODUCT_BUNDLE_IDENTIFIER = uk.org.marginal.qldds.qlgenerator; 473 | PRODUCT_NAME = QLdds; 474 | WRAPPER_EXTENSION = qlgenerator; 475 | }; 476 | name = Debug; 477 | }; 478 | ABAB4A351A23898B00B1BD18 /* Release */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | COMBINE_HIDPI_IMAGES = YES; 482 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 483 | INFOPLIST_FILE = qlgenerator/Info.plist; 484 | INSTALL_PATH = /Library/QuickLook; 485 | PREBINDING = NO; 486 | PRODUCT_BUNDLE_IDENTIFIER = uk.org.marginal.qldds.qlgenerator; 487 | PRODUCT_NAME = QLdds; 488 | WRAPPER_EXTENSION = qlgenerator; 489 | ZERO_LINK = NO; 490 | }; 491 | name = Release; 492 | }; 493 | ABD434F71A2E406F00ED8B26 /* Debug */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | COMBINE_HIDPI_IMAGES = YES; 497 | INFOPLIST_FILE = app/Info.plist; 498 | PRODUCT_BUNDLE_IDENTIFIER = uk.org.marginal.qldds; 499 | PRODUCT_NAME = "$(TARGET_NAME)"; 500 | }; 501 | name = Debug; 502 | }; 503 | ABD434F81A2E406F00ED8B26 /* Release */ = { 504 | isa = XCBuildConfiguration; 505 | buildSettings = { 506 | COMBINE_HIDPI_IMAGES = YES; 507 | INFOPLIST_FILE = app/Info.plist; 508 | PRODUCT_BUNDLE_IDENTIFIER = uk.org.marginal.qldds; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | }; 511 | name = Release; 512 | }; 513 | /* End XCBuildConfiguration section */ 514 | 515 | /* Begin XCConfigurationList section */ 516 | AB8A49DF1A22DBE7002E5A59 /* Build configuration list for PBXProject "QLdds" */ = { 517 | isa = XCConfigurationList; 518 | buildConfigurations = ( 519 | AB8A49DD1A22DBE7002E5A59 /* Debug */, 520 | AB8A49DE1A22DBE7002E5A59 /* Release */, 521 | ); 522 | defaultConfigurationIsVisible = 0; 523 | defaultConfigurationName = Release; 524 | }; 525 | AB8A4A0F1A22DD6C002E5A59 /* Build configuration list for PBXNativeTarget "mdimporter" */ = { 526 | isa = XCConfigurationList; 527 | buildConfigurations = ( 528 | AB8A4A0D1A22DD6C002E5A59 /* Debug */, 529 | AB8A4A0E1A22DD6C002E5A59 /* Release */, 530 | ); 531 | defaultConfigurationIsVisible = 0; 532 | defaultConfigurationName = Release; 533 | }; 534 | ABAB4A361A23898B00B1BD18 /* Build configuration list for PBXNativeTarget "qlgenerator" */ = { 535 | isa = XCConfigurationList; 536 | buildConfigurations = ( 537 | ABAB4A341A23898B00B1BD18 /* Debug */, 538 | ABAB4A351A23898B00B1BD18 /* Release */, 539 | ); 540 | defaultConfigurationIsVisible = 0; 541 | defaultConfigurationName = Release; 542 | }; 543 | ABD434F61A2E406F00ED8B26 /* Build configuration list for PBXNativeTarget "QLdds" */ = { 544 | isa = XCConfigurationList; 545 | buildConfigurations = ( 546 | ABD434F71A2E406F00ED8B26 /* Debug */, 547 | ABD434F81A2E406F00ED8B26 /* Release */, 548 | ); 549 | defaultConfigurationIsVisible = 0; 550 | defaultConfigurationName = Release; 551 | }; 552 | /* End XCConfigurationList section */ 553 | }; 554 | rootObject = AB8A49DC1A22DBE7002E5A59 /* Project object */; 555 | } 556 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | QuickLook DDS 2 | ============= 3 | 4 | This package allows OSX Finder to display thumbnails, previews and metadata for "DirectDraw Surface" (DDS) texture files. 5 | 6 | Installation 7 | ------------ 8 | * Download the `.pkg` file of the [latest release](https://github.com/Marginal/QLdds/releases/latest). 9 | * Double-click on it. 10 | * The Installer app will walk you through the installation process. 11 | * To see thumbnails you may need to relaunch Finder (ctrl-⌥-click on the Finder icon in the Dock and choose Relaunch) or log out and back in again. 12 | * You may experience high CPU and disk usage for a few minutes after installation while Spotlight re-indexes all of your DDS files. 13 | 14 | Screenshots 15 | ----------- 16 | ![Finder screenshot](img/finder.jpeg) ![Preview](img/preview.jpeg) 17 | 18 | ![Get Info 1](img/bump.jpeg) ![Get Info 2](img/cube.jpeg) 19 | 20 | Supported file formats 21 | ---------------------- 22 | * DirectX 8/9 DDS 23 | * DirectX 10 DDS extensions 24 | * Cubemaps 25 | 26 | Supported encodings 27 | ------------------- 28 | * DXT1 / BC1 29 | * DXT2 30 | * DXT3 / BC2 31 | * DXT4 32 | * DXT5 / BC3 33 | * ATI1 / BC4 / LATC luminance 34 | * ATI2 / BC5 / RGTC normal map 35 | * Uncompressed RGB, RGBA, RGBX, Luminance & Luminance + Alpha 36 | * Uncompressed RG normal map 37 | 38 | Uninstall 39 | --------- 40 | * Run the Terminal app (found in Applications → Utilities). 41 | * Copy the following and paste into the Terminal app: 42 | 43 | `sudo rm -rf "/Library/Application Support/QLdds" "/Library/QuickLook/QLdds.qlgenerator" "/Library/Spotlight/DDS.mdimporter"` 44 | 45 | * Press Enter. 46 | * Type your password and press Enter. 47 | 48 | Limitations 49 | ----------- 50 | * There's some disagreement on how normal maps are stored. This plugin assumes the DirectX10 BC5 and OpenGL [COMPRESSED_RG_RGTC2](https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt) convention that R=X,G=Y. Note: this is called "ATI2N (Alternate XY Swizzle)" in some tools. 51 | * There's some disagreement on how the Blue/Z channel in a normal map is reconstructed. This plugin assumes the [Blender convention](http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Influence/Material/Bump_and_Normal) that Blue:[0, 255] maps to Z:[0.0, 1.0]. Note: this is different from the Doom3 convention. 52 | * Palettized and floating point encodings are not supported. 53 | * DirectX 10/11 DXGI encodings other than those listed above are not supported - specifically BC6 / BC7 [BPTC](https://www.opengl.org/registry/specs/ARB/texture_compression_bptc.txt) encodings. 54 | * Requires OSX 10.6 or later. 55 | 56 | Acknowledgements 57 | ---------------- 58 | * Packaged using [Packages](http://s.sudre.free.fr/Software/Packages/about.html). 59 | * Nyx0uf for the [idea](http://www.cocoaintheshell.com/2012/02/quicklook-images-dimensions/) of adding image dimensions to the preview title. 60 | 61 | License 62 | ------- 63 | Copyright © 2012-2016 Jonathan Harris. 64 | 65 | Licensed under the [GNU Public License (GPL)](http://www.gnu.org/licenses/gpl-2.0.html) version 2 or later. 66 | -------------------------------------------------------------------------------- /Resources/en.lproj/license.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210 2 | {\fonttbl\f0\fnil\fcharset0 HelveticaNeue;\f1\fnil\fcharset0 Consolas;} 3 | {\colortbl;\red255\green255\blue255;\red0\green0\blue238;} 4 | {\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{lower-alpha\})}{\leveltext\leveltemplateid1\'02\'00);}{\levelnumbers\'01;}\fi-360\li720\lin720 }{\listname ;}\listid1} 5 | {\list\listtemplateid2\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{lower-alpha\})}{\leveltext\leveltemplateid101\'02\'00);}{\levelnumbers\'01;}\fi-360\li720\lin720 }{\listname ;}\listid2}} 6 | {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} 7 | \paperw11900\paperh16840\margl1440\margr1440\vieww7840\viewh6300\viewkind0 8 | \deftab720 9 | \pard\pardeftab720\sa280 10 | {\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/gpl-2.0.html"}}{\fldrslt 11 | \f0\b\fs40 \cf2 \ul \ulc2 GNU GENERAL PUBLIC LICENSE\ 12 | }}\pard\pardeftab720\sa240 13 | 14 | \f0\fs28 \cf0 Version 2, June 1991\ 15 | \pard\pardeftab720 16 | 17 | \f1\fs22 \cf0 Copyright (C) 1989, 1991 Free Software Foundation, Inc.\ 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\ 19 | \ 20 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\ 21 | \ 22 | \pard\pardeftab720\sa280 23 | 24 | \f0\b\fs32 \cf0 Preamble\ 25 | \pard\pardeftab720\sa240 26 | 27 | \b0\fs28 \cf0 The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.\ 28 | When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.\ 29 | To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.\ 30 | For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\ 31 | We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.\ 32 | Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.\ 33 | Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.\ 34 | The precise terms and conditions for copying, distribution and modification follow.\ 35 | \pard\pardeftab720\sa280 36 | 37 | \b\fs32 \cf0 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\ 38 | \pard\pardeftab720\sa240 39 | 40 | \fs28 \cf0 0. 41 | \b0 This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".\ 42 | Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.\ 43 | 44 | \b 1. 45 | \b0 You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.\ 46 | You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.\ 47 | 48 | \b 2. 49 | \b0 You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:\ 50 | \pard\tx220\tx720\pardeftab720\li720\fi-720 51 | \ls1\ilvl0\cf0 {\listtext 52 | \b a) } 53 | \b0 You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.\ 54 | {\listtext 55 | \b b) } 56 | \b0 You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.\ 57 | \pard\tx220\tx720\pardeftab720\li720\fi-720\sa240 58 | \ls1\ilvl0\cf0 {\listtext 59 | \b c) } 60 | \b0 If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)\ 61 | \pard\pardeftab720\sa240 62 | \cf0 These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.\ 63 | Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.\ 64 | In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.\ 65 | \pard\pardeftab720\sa240 66 | 67 | \b \cf0 3. 68 | \b0 You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:\ 69 | \pard\tx220\tx720\pardeftab720\li720\fi-720 70 | \ls2\ilvl0 71 | \b \cf0 {\listtext a) } 72 | \b0 Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,\ 73 | {\listtext 74 | \b b) 75 | \b0 }Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,\ 76 | \pard\tx220\tx720\pardeftab720\li720\fi-720\sa240 77 | \ls2\ilvl0\cf0 {\listtext 78 | \b c) } 79 | \b0 Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)\ 80 | \pard\pardeftab720\sa240 81 | \cf0 The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.\ 82 | If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.\ 83 | \pard\pardeftab720\sa240 84 | 85 | \b \cf0 4. 86 | \b0 You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.\ 87 | 88 | \b 5. 89 | \b0 You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.\ 90 | 91 | \b 6. 92 | \b0 Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.\ 93 | 94 | \b 7. 95 | \b0 If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.\ 96 | If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.\ 97 | It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.\ 98 | This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.\ 99 | 100 | \b 8. 101 | \b0 If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.\ 102 | 103 | \b 9. 104 | \b0 The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\ 105 | Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.\ 106 | 107 | \b 10. 108 | \b0 If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.\ 109 | \pard\pardeftab720\sa240 110 | 111 | \b\fs32 \cf0 NO WARRANTY\ 112 | \pard\pardeftab720\sa240 113 | 114 | \fs28 \cf0 11. 115 | \b0 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\ 116 | 117 | \b 12. 118 | \b0 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\ 119 | \pard\pardeftab720\sa280 120 | 121 | \b\fs32 \cf0 END OF TERMS AND CONDITIONS\ 122 | \pard\pardeftab720\sa280 123 | 124 | \fs28 \cf0 How to Apply These Terms to Your New Programs\ 125 | \pard\pardeftab720\sa240 126 | 127 | \b0 \cf0 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.\ 128 | To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.\ 129 | \pard\pardeftab720 130 | 131 | \f1\fs22 \cf0 one line to give the program's name and an idea of what it does.\ 132 | Copyright (C) yyyy name of author\ 133 | \ 134 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\ 135 | \ 136 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\ 137 | \ 138 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\ 139 | \ 140 | \pard\pardeftab720\sa240 141 | 142 | \f0\fs28 \cf0 Also add information on how to contact you by electronic and paper mail.\ 143 | If the program is interactive, make it output a short notice like this when it starts in an interactive mode:\ 144 | \pard\pardeftab720 145 | 146 | \f1\fs22 \cf0 Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.\ 147 | \ 148 | \pard\pardeftab720\sa240 149 | 150 | \f0\fs28 \cf0 The hypothetical commands 151 | \f1 `show w' 152 | \f0 and 153 | \f1 `show c' 154 | \f0 should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than 155 | \f1 `show w' 156 | \f0 and 157 | \f1 `show c' 158 | \f0 ; they could even be mouse-clicks or menu items--whatever suits your program.\ 159 | You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:\ 160 | \pard\pardeftab720 161 | 162 | \f1\fs22 \cf0 Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.\ 163 | \ 164 | signature of Ty Coon, 1 April 1989\ 165 | Ty Coon, President of Vice\ 166 | \ 167 | \pard\pardeftab720\sa240 168 | 169 | \f0\fs28 \cf0 This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the {\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/lgpl.html"}}{\fldrslt \cf2 \ul \ulc2 GNU Lesser General Public License}} instead of this License.\ 170 | } -------------------------------------------------------------------------------- /app/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.3.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.3.3 23 | LSMinimumSystemVersion 24 | ${MACOSX_DEPLOYMENT_TARGET} 25 | NSHumanReadableCopyright 26 | © 2013-2018 Jonathan Harris. Licensed under GPLv2 or later. 27 | NSPrincipalClass 28 | NSApplication 29 | UTImportedTypeDeclarations 30 | 31 | 32 | UTTypeConformsTo 33 | 34 | public.image 35 | 36 | UTTypeDescription 37 | DDS image 38 | UTTypeIdentifier 39 | com.microsoft.dds 40 | UTTypeReferenceURL 41 | http://msdn.microsoft.com/en-us/library/bb943990.aspx 42 | UTTypeTagSpecification 43 | 44 | public.filename-extension 45 | 46 | dds 47 | DDS 48 | 49 | public.mime-type 50 | 51 | image/x-dds 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/QLdds: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # some padding to make OSX happy 3 | exit 0 4 | -------------------------------------------------------------------------------- /img/bump.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Marginal/QLdds/6e8f3c2b4fef745528459f1d4b3c02c3d800504f/img/bump.jpeg -------------------------------------------------------------------------------- /img/cube.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Marginal/QLdds/6e8f3c2b4fef745528459f1d4b3c02c3d800504f/img/cube.jpeg -------------------------------------------------------------------------------- /img/finder.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Marginal/QLdds/6e8f3c2b4fef745528459f1d4b3c02c3d800504f/img/finder.jpeg -------------------------------------------------------------------------------- /img/preview.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Marginal/QLdds/6e8f3c2b4fef745528459f1d4b3c02c3d800504f/img/preview.jpeg -------------------------------------------------------------------------------- /mdimporter/GetMetadataForFile.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #import "DDS/dds.h" 8 | 9 | // https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/MDImporters/Concepts/WritingAnImp.html 10 | // http://msdn.microsoft.com/en-us/library/bb943991 11 | 12 | 13 | Boolean GetMetadataForURL(void* thisInterface, 14 | CFMutableDictionaryRef attributes, 15 | CFStringRef contentTypeUTI, 16 | CFURLRef url) 17 | { 18 | @autoreleasepool 19 | { 20 | 21 | DDS *dds = [DDS ddsWithURL: (__bridge NSURL*) url]; 22 | if (!dds) 23 | return FALSE; /* Not a DDS file! */ 24 | 25 | NSMutableDictionary *attrs = (__bridge NSMutableDictionary *)attributes; // Prefer to use Objective-C 26 | 27 | [attrs setValue:[NSArray arrayWithObject:dds.codec] forKey:(NSString *)kMDItemCodecs]; 28 | 29 | int nlayers = 0; 30 | NSObject *layers[2]; 31 | int ddsCaps2 = dds.ddsCaps2; 32 | if (ddsCaps2 & DDSCAPS2_VOLUME) 33 | layers[nlayers++] = @"volume"; 34 | else if ((ddsCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) == DDSCAPS2_CUBEMAP_ALLFACES) 35 | layers[nlayers++] = @"cubemap"; 36 | else if (ddsCaps2 & DDSCAPS2_CUBEMAP) 37 | layers[nlayers++] = @"partial cubemap"; 38 | if (dds.mipmapCount > 1) 39 | layers[nlayers++] = @"mipmaps"; 40 | if (nlayers) 41 | [attrs setValue:[NSArray arrayWithObjects:layers count:nlayers] forKey:(NSString *)kMDItemLayerNames]; 42 | 43 | [attrs setValue:[NSNumber numberWithInt:dds.mainSurfaceWidth] forKey:(NSString *)kMDItemPixelWidth]; 44 | [attrs setValue:[NSNumber numberWithInt:dds.mainSurfaceHeight] forKey:(NSString *)kMDItemPixelHeight]; 45 | if (dds.bpp) 46 | [attrs setValue:[NSNumber numberWithInt:dds.bpp] forKey:(NSString *)kMDItemBitsPerSample]; 47 | 48 | } 49 | return TRUE; 50 | } 51 | -------------------------------------------------------------------------------- /mdimporter/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeRole 11 | MDImporter 12 | LSItemContentTypes 13 | 14 | com.microsoft.dds 15 | 16 | 17 | 18 | CFBundleExecutable 19 | ${EXECUTABLE_NAME} 20 | CFBundleIconFile 21 | 22 | CFBundleIdentifier 23 | $(PRODUCT_BUNDLE_IDENTIFIER) 24 | CFBundleInfoDictionaryVersion 25 | 6.0 26 | CFBundleName 27 | ${PRODUCT_NAME} 28 | CFBundleShortVersionString 29 | 1.3.3 30 | CFBundleVersion 31 | 1.3.3 32 | CFPlugInDynamicRegisterFunction 33 | 34 | CFPlugInDynamicRegistration 35 | 36 | CFPlugInFactories 37 | 38 | E57C54B1-5783-4A33-9E68-B27C8A408DBF 39 | MetadataImporterPluginFactory 40 | 41 | CFPlugInTypes 42 | 43 | 8B08C4BF-415B-11D8-B3F9-0003936726FC 44 | 45 | E57C54B1-5783-4A33-9E68-B27C8A408DBF 46 | 47 | 48 | CFPlugInUnloadFunction 49 | 50 | LSMinimumSystemVersion 51 | ${MACOSX_DEPLOYMENT_TARGET} 52 | NSHumanReadableCopyright 53 | © 2013-2018 Jonathan Harris. Licensed under GPLv2 or later. 54 | 55 | 56 | -------------------------------------------------------------------------------- /mdimporter/Resources/en.lproj/schema.strings: -------------------------------------------------------------------------------- 1 | /* Unused attribute */ 2 | "uk_org_marginal_qldds_dds" = "DirectDraw Surface"; 3 | -------------------------------------------------------------------------------- /mdimporter/Resources/schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | kMDItemPixelHeight 14 | kMDItemPixelWidth 15 | kMDItemCodecs 16 | kMDItemBitsPerSample 17 | kMDItemLayerNames 18 | uk_org_marginal_qldds_dds 19 | 20 | 21 | kMDItemPixelHeight 22 | kMDItemPixelWidth 23 | kMDItemCodecs 24 | kMDItemBitsPerSample 25 | kMDItemLayerNames 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /mdimporter/main.c: -------------------------------------------------------------------------------- 1 | //============================================================================== 2 | // 3 | // DO NOT MODIFY THE CONTENT OF THIS FILE 4 | // 5 | // This file contains the generic CFPlug-in code necessary for your importer 6 | // To complete your importer implement the function in GetMetadataForFile.c 7 | // 8 | //============================================================================== 9 | 10 | 11 | 12 | 13 | 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | // ----------------------------------------------------------------------------- 20 | // constants 21 | // ----------------------------------------------------------------------------- 22 | 23 | 24 | #define PLUGIN_ID "E57C54B1-5783-4A33-9E68-B27C8A408DBF" 25 | 26 | // 27 | // Below is the generic glue code for all plug-ins. 28 | // 29 | // You should not have to modify this code aside from changing 30 | // names if you decide to change the names defined in the Info.plist 31 | // 32 | 33 | 34 | // ----------------------------------------------------------------------------- 35 | // typedefs 36 | // ----------------------------------------------------------------------------- 37 | 38 | // The import function to be implemented in GetMetadataForFile.c 39 | Boolean GetMetadataForURL(void *thisInterface, 40 | CFMutableDictionaryRef attributes, 41 | CFStringRef contentTypeUTI, 42 | CFURLRef urlForFile); 43 | 44 | // The layout for an instance of MetaDataImporterPlugIn 45 | typedef struct __MetadataImporterPluginType 46 | { 47 | void *conduitInterface; 48 | CFUUIDRef factoryID; 49 | UInt32 refCount; 50 | } MetadataImporterPluginType; 51 | 52 | // ----------------------------------------------------------------------------- 53 | // prototypes 54 | // ----------------------------------------------------------------------------- 55 | // Forward declaration for the IUnknown implementation. 56 | // 57 | 58 | MetadataImporterPluginType *AllocMetadataImporterPluginType(CFUUIDRef inFactoryID); 59 | void DeallocMetadataImporterPluginType(MetadataImporterPluginType *thisInstance); 60 | HRESULT MetadataImporterQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv); 61 | void *MetadataImporterPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID); 62 | ULONG MetadataImporterPluginAddRef(void *thisInstance); 63 | ULONG MetadataImporterPluginRelease(void *thisInstance); 64 | // ----------------------------------------------------------------------------- 65 | // testInterfaceFtbl definition 66 | // ----------------------------------------------------------------------------- 67 | // The TestInterface function table. 68 | // 69 | 70 | static MDImporterInterfaceStruct testInterfaceFtbl = { 71 | NULL, 72 | MetadataImporterQueryInterface, 73 | MetadataImporterPluginAddRef, 74 | MetadataImporterPluginRelease, 75 | NULL 76 | }; 77 | 78 | 79 | // ----------------------------------------------------------------------------- 80 | // AllocMetadataImporterPluginType 81 | // ----------------------------------------------------------------------------- 82 | // Utility function that allocates a new instance. 83 | // You can do some initial setup for the importer here if you wish 84 | // like allocating globals etc... 85 | // 86 | MetadataImporterPluginType *AllocMetadataImporterPluginType(CFUUIDRef inFactoryID) 87 | { 88 | MetadataImporterPluginType *theNewInstance; 89 | 90 | theNewInstance = (MetadataImporterPluginType *)malloc(sizeof(MetadataImporterPluginType)); 91 | memset(theNewInstance,0,sizeof(MetadataImporterPluginType)); 92 | 93 | /* Point to the function table Malloc enough to store the stuff and copy the filler from testInterfaceFtbl over */ 94 | theNewInstance->conduitInterface = malloc(sizeof(MDImporterInterfaceStruct)); 95 | memcpy(theNewInstance->conduitInterface,&testInterfaceFtbl,sizeof(MDImporterInterfaceStruct)); 96 | 97 | /* Retain and keep an open instance refcount for each factory. */ 98 | theNewInstance->factoryID = CFRetain(inFactoryID); 99 | CFPlugInAddInstanceForFactory(inFactoryID); 100 | 101 | /* This function returns the IUnknown interface so set the refCount to one. */ 102 | theNewInstance->refCount = 1; 103 | return theNewInstance; 104 | } 105 | 106 | // ----------------------------------------------------------------------------- 107 | // DeallocDDSMDImporterPluginType 108 | // ----------------------------------------------------------------------------- 109 | // Utility function that deallocates the instance when 110 | // the refCount goes to zero. 111 | // In the current implementation importer interfaces are never deallocated 112 | // but implement this as this might change in the future 113 | // 114 | void DeallocMetadataImporterPluginType(MetadataImporterPluginType *thisInstance) 115 | { 116 | CFUUIDRef theFactoryID; 117 | 118 | theFactoryID = thisInstance->factoryID; 119 | /* Free the conduitInterface table up */ 120 | free(thisInstance->conduitInterface); 121 | 122 | /* Free the instance structure */ 123 | free(thisInstance); 124 | if (theFactoryID){ 125 | CFPlugInRemoveInstanceForFactory(theFactoryID); 126 | CFRelease(theFactoryID); 127 | } 128 | } 129 | 130 | static Boolean LegacyGetMetadataForFile(void* thisInterface,CFMutableDictionaryRef attributes,CFStringRef contentTypeUTI,CFStringRef pathToFile) 131 | { 132 | Boolean result = FALSE; 133 | CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,pathToFile, kCFURLPOSIXPathStyle, TRUE); 134 | if (url) { 135 | result = GetMetadataForURL(thisInterface, attributes, contentTypeUTI, url); 136 | CFRelease(url); 137 | } 138 | 139 | return result; 140 | } 141 | 142 | // ----------------------------------------------------------------------------- 143 | // MetadataImporterQueryInterface 144 | // ----------------------------------------------------------------------------- 145 | // Implementation of the IUnknown QueryInterface function. 146 | // 147 | HRESULT MetadataImporterQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv) 148 | { 149 | CFUUIDRef interfaceID; 150 | 151 | interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid); 152 | 153 | if (CFEqual(interfaceID,kMDImporterInterfaceID)) { 154 | /* If the Right interface was requested, bump the ref count, 155 | * set the ppv parameter equal to the instance, and 156 | * return good status. 157 | */ 158 | ((MDImporterInterfaceStruct *)((MetadataImporterPluginType *)thisInstance)->conduitInterface)->ImporterImportData = LegacyGetMetadataForFile; 159 | ((MDImporterInterfaceStruct *)((MetadataImporterPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance); 160 | *ppv = thisInstance; 161 | CFRelease(interfaceID); 162 | return S_OK; 163 | } 164 | else if (CFEqual(interfaceID,kMDImporterURLInterfaceID)) { 165 | 166 | ((MDImporterURLInterfaceStruct *)((MetadataImporterPluginType *)thisInstance)->conduitInterface)->ImporterImportURLData = GetMetadataForURL; 167 | ((MDImporterURLInterfaceStruct *)((MetadataImporterPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance); 168 | *ppv = thisInstance; 169 | CFRelease(interfaceID); 170 | return S_OK; 171 | } 172 | else if (CFEqual(interfaceID,IUnknownUUID)) { 173 | /* If the IUnknown interface was requested, same as above. */ 174 | ((MDImporterInterfaceStruct *)((MetadataImporterPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance); 175 | *ppv = thisInstance; 176 | CFRelease(interfaceID); 177 | return S_OK; 178 | } 179 | else { 180 | /* Requested interface unknown, bail with error. */ 181 | *ppv = NULL; 182 | CFRelease(interfaceID); 183 | return E_NOINTERFACE; 184 | } 185 | } 186 | 187 | // ----------------------------------------------------------------------------- 188 | // MetadataImporterPluginAddRef 189 | // ----------------------------------------------------------------------------- 190 | // Implementation of reference counting for this type. Whenever an interface 191 | // is requested, bump the refCount for the instance. NOTE: returning the 192 | // refcount is a convention but is not required so don't rely on it. 193 | // 194 | ULONG MetadataImporterPluginAddRef(void *thisInstance) 195 | { 196 | ((MetadataImporterPluginType *)thisInstance )->refCount += 1; 197 | return ((MetadataImporterPluginType*) thisInstance)->refCount; 198 | } 199 | 200 | // ----------------------------------------------------------------------------- 201 | // SampleCMPluginRelease 202 | // ----------------------------------------------------------------------------- 203 | // When an interface is released, decrement the refCount. 204 | // If the refCount goes to zero, deallocate the instance. 205 | // 206 | ULONG MetadataImporterPluginRelease(void *thisInstance) 207 | { 208 | ((MetadataImporterPluginType*)thisInstance)->refCount -= 1; 209 | if (((MetadataImporterPluginType*)thisInstance)->refCount == 0){ 210 | DeallocMetadataImporterPluginType((MetadataImporterPluginType*)thisInstance ); 211 | return 0; 212 | }else{ 213 | return ((MetadataImporterPluginType*) thisInstance )->refCount; 214 | } 215 | } 216 | 217 | // ----------------------------------------------------------------------------- 218 | // DDSMDImporterPluginFactory 219 | // ----------------------------------------------------------------------------- 220 | // Implementation of the factory function for this type. 221 | // 222 | __attribute__((visibility("default"))) void *MetadataImporterPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID) 223 | { 224 | MetadataImporterPluginType *result; 225 | CFUUIDRef uuid; 226 | 227 | /* If correct type is being requested, allocate an 228 | * instance of TestType and return the IUnknown interface. 229 | */ 230 | if (CFEqual(typeID,kMDImporterTypeID)){ 231 | uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID)); 232 | result = AllocMetadataImporterPluginType(uuid); 233 | CFRelease(uuid); 234 | return result; 235 | } 236 | /* If the requested type is incorrect, return NULL. */ 237 | return NULL; 238 | } 239 | 240 | -------------------------------------------------------------------------------- /mdimporter/resetmds: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | touch -c "$2" 4 | 5 | if [ -z "$USER" ]; then exit 0; fi 6 | 7 | # If upgrading then force re-indexing for the current user immediately 8 | if sudo -u $USER /usr/bin/mdimport -L 2>&1 | grep -q "$2"; then 9 | sudo -u $USER /usr/bin/mdimport -r "$2" 10 | exit 0; 11 | fi 12 | 13 | # Otherwise schedule re-indexing for the next time the current user logs on 14 | JOB=uk.org.marginal.qldds.mdimporter 15 | AGENT="$HOME/Library/LaunchAgents/$JOB.plist" 16 | SCRIPT="$HOME/Library/Application Support/uk.org.marginal.qldds/mdimporter" 17 | 18 | sudo -u $USER mkdir -p "`dirname "$SCRIPT"`" 19 | sudo -u $USER /usr/bin/tee "$SCRIPT" >/dev/null <&1 | grep -q "$2"; then 29 | break; 30 | else 31 | sleep 10; 32 | fi; 33 | done 34 | 35 | # Force re-indexing 36 | /usr/bin/mdimport -r "$2" 37 | 38 | # Clean up 39 | rm -f "$AGENT" 40 | rm -f "$SCRIPT" 41 | /bin/launchctl remove $JOB 42 | EOF 43 | chmod +x "$SCRIPT" 44 | 45 | sudo -u $USER mkdir -p "`dirname "$AGENT"`" 46 | sudo -u $USER /usr/bin/tee "$AGENT" >/dev/null < 48 | 49 | 50 | 51 | Label 52 | $JOB 53 | ProgramArguments 54 | 55 | /bin/bash 56 | $SCRIPT 57 | 58 | RunAtLoad 59 | 60 | 61 | 62 | EOF 63 | 64 | # Launch immediately in case the user doesn't intend to log off any time soon 65 | sudo -u $USER /bin/launchctl load "$AGENT" 66 | 67 | true 68 | -------------------------------------------------------------------------------- /qlgenerator/GeneratePreviewForURL.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "DDS/dds.h" 6 | 7 | /* ----------------------------------------------------------------------------- 8 | Generate a preview for file 9 | 10 | This function's job is to create preview for designated file 11 | 12 | https://developer.apple.com/library/prerelease/mac/documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Articles/QLImplementationOverview.html 13 | 14 | ----------------------------------------------------------------------------- */ 15 | 16 | OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options) 17 | { 18 | @autoreleasepool 19 | { 20 | #ifdef DEBUG 21 | NSLog(@"Preview %@ with options %@", [(__bridge NSURL*)url path], options); 22 | #endif 23 | 24 | DDS *dds = [DDS ddsWithURL: (__bridge NSURL*) url]; 25 | if (!dds || QLPreviewRequestIsCancelled(preview)) 26 | { 27 | return kQLReturnNoError; 28 | } 29 | 30 | NSNumber *previewMode = (NSNumber*)[(__bridge NSDictionary*)options objectForKey:@"QLPreviewMode"]; 31 | CGImageRef image; 32 | if (previewMode && [previewMode intValue] <= 4) // 1:"Get Info", 4:Spotlight 33 | image = [dds CreateImageWithPreferredWidth:1024 andPreferredHeight:1024]; // use a lower-level mipmap for speed 34 | else // 5:User pressed space or some other context 35 | image = [dds CreateImage]; // Give full resolution 36 | if (!image || QLPreviewRequestIsCancelled(preview)) 37 | { 38 | if (image) 39 | CGImageRelease(image); 40 | return kQLReturnNoError; 41 | } 42 | 43 | // Replace title string 44 | NSString *title = [NSString stringWithFormat:@"%@ (%d×%d %@)", [(__bridge NSURL *)url lastPathComponent], 45 | dds.mainSurfaceWidth, dds.mainSurfaceHeight, dds.codec]; 46 | NSDictionary *properties = [NSDictionary dictionaryWithObject:title forKey:(NSString *) kQLPreviewPropertyDisplayNameKey]; 47 | 48 | CGContextRef context = QLPreviewRequestCreateContext(preview, CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image)), 49 | true, (__bridge CFDictionaryRef) properties); 50 | CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image); 51 | QLPreviewRequestFlushContext(preview, context); 52 | CGContextRelease(context); 53 | 54 | CGImageRelease(image); 55 | 56 | return kQLReturnNoError; 57 | } 58 | } 59 | 60 | void CancelPreviewGeneration(void* thisInterface, QLPreviewRequestRef preview) 61 | { 62 | // implement only if supported 63 | } 64 | -------------------------------------------------------------------------------- /qlgenerator/GenerateThumbnailForURL.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "DDS/dds.h" 6 | 7 | // Undocumented options 8 | const CFStringRef kQLThumbnailOptionScaleFactor = CFSTR("QLThumbnailOptionScaleFactor"); 9 | 10 | 11 | /* ----------------------------------------------------------------------------- 12 | Generate a thumbnail for file 13 | 14 | This function's job is to create thumbnail for designated file as fast as possible 15 | ----------------------------------------------------------------------------- */ 16 | 17 | OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize) 18 | { 19 | @autoreleasepool 20 | { 21 | DDS *dds = [DDS ddsWithURL: (__bridge NSURL*) url]; 22 | if (!dds || QLThumbnailRequestIsCancelled(thumbnail)) 23 | { 24 | return kQLReturnNoError; 25 | } 26 | 27 | NSNumber *scaleFactor = [((__bridge NSDictionary *)options) valueForKey:(__bridge NSString *)kQLThumbnailOptionScaleFactor]; // can be >1 on Retina displays 28 | CGSize desired = scaleFactor.boolValue ? CGSizeMake(maxSize.width * scaleFactor.floatValue, maxSize.height * scaleFactor.floatValue) :CGSizeMake(maxSize.width, maxSize.height); 29 | 30 | CGImageRef image = [dds CreateImageWithPreferredWidth:desired.width andPreferredHeight:desired.height]; // use a lower-level mipmap 31 | if (!image || QLThumbnailRequestIsCancelled(thumbnail)) 32 | { 33 | if (image) 34 | CGImageRelease(image); 35 | return kQLReturnNoError; 36 | } 37 | 38 | /* Add a "DDS" stamp if the thumbnail is not too small */ 39 | NSDictionary *properties = (maxSize.height > 16 ? 40 | [NSDictionary dictionaryWithObject:@"DDS" forKey:(NSString *) kQLThumbnailPropertyExtensionKey] : 41 | NULL); 42 | QLThumbnailRequestSetImage(thumbnail, image, (__bridge CFDictionaryRef) properties); 43 | 44 | CGImageRelease(image); 45 | 46 | return kQLReturnNoError; 47 | } 48 | } 49 | 50 | void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail) 51 | { 52 | // implement only if supported 53 | } 54 | -------------------------------------------------------------------------------- /qlgenerator/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeRole 11 | QLGenerator 12 | LSItemContentTypes 13 | 14 | com.microsoft.dds 15 | 16 | 17 | 18 | CFBundleExecutable 19 | ${EXECUTABLE_NAME} 20 | CFBundleIconFile 21 | 22 | CFBundleIdentifier 23 | $(PRODUCT_BUNDLE_IDENTIFIER) 24 | CFBundleInfoDictionaryVersion 25 | 6.0 26 | CFBundleName 27 | ${PRODUCT_NAME} 28 | CFBundleShortVersionString 29 | 1.3.3 30 | CFBundleVersion 31 | 1.3.3 32 | CFPlugInDynamicRegisterFunction 33 | 34 | CFPlugInDynamicRegistration 35 | 36 | CFPlugInFactories 37 | 38 | 6F5AB5FD-CC32-4FF4-A3E6-4BA350D8CB7E 39 | QuickLookGeneratorPluginFactory 40 | 41 | CFPlugInTypes 42 | 43 | 5E2D9680-5022-40FA-B806-43349622E5B9 44 | 45 | 6F5AB5FD-CC32-4FF4-A3E6-4BA350D8CB7E 46 | 47 | 48 | CFPlugInUnloadFunction 49 | 50 | LSMinimumSystemVersion 51 | ${MACOSX_DEPLOYMENT_TARGET} 52 | NSHumanReadableCopyright 53 | © 2013-2018 Jonathan Harris. Licensed under GPLv2 or later. 54 | QLNeedsToBeRunInMainThread 55 | 56 | QLSupportsConcurrentRequests 57 | 58 | QLPreviewHeight 59 | 256 60 | QLPreviewWidth 61 | 256 62 | QLThumbnailMinimumSize 63 | 0 64 | 65 | 66 | -------------------------------------------------------------------------------- /qlgenerator/main.c: -------------------------------------------------------------------------------- 1 | //============================================================================== 2 | // 3 | // DO NO MODIFY THE CONTENT OF THIS FILE 4 | // 5 | // This file contains the generic CFPlug-in code necessary for your generator 6 | // To complete your generator implement the function in GenerateThumbnailForURL/GeneratePreviewForURL.c 7 | // 8 | //============================================================================== 9 | 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | // ----------------------------------------------------------------------------- 17 | // constants 18 | // ----------------------------------------------------------------------------- 19 | 20 | // Don't modify this line 21 | #define PLUGIN_ID "6F5AB5FD-CC32-4FF4-A3E6-4BA350D8CB7E" 22 | 23 | 24 | // 25 | // Below is the generic glue code for all plug-ins. 26 | // 27 | // You should not have to modify this code aside from changing 28 | // names if you decide to change the names defined in the Info.plist 29 | // 30 | 31 | 32 | // ----------------------------------------------------------------------------- 33 | // typedefs 34 | // ----------------------------------------------------------------------------- 35 | 36 | // The thumbnail generation function to be implemented in GenerateThumbnailForURL.c 37 | OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize); 38 | void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail); 39 | 40 | // The preview generation function to be implemented in GeneratePreviewForURL.c 41 | OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options); 42 | void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview); 43 | 44 | // The layout for an instance of QuickLookGeneratorPlugIn 45 | typedef struct __QuickLookGeneratorPluginType 46 | { 47 | void *conduitInterface; 48 | CFUUIDRef factoryID; 49 | UInt32 refCount; 50 | } QuickLookGeneratorPluginType; 51 | 52 | // ----------------------------------------------------------------------------- 53 | // prototypes 54 | // ----------------------------------------------------------------------------- 55 | // Forward declaration for the IUnknown implementation. 56 | // 57 | 58 | QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID); 59 | void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance); 60 | HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv); 61 | void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID); 62 | ULONG QuickLookGeneratorPluginAddRef(void *thisInstance); 63 | ULONG QuickLookGeneratorPluginRelease(void *thisInstance); 64 | 65 | // ----------------------------------------------------------------------------- 66 | // myInterfaceFtbl definition 67 | // ----------------------------------------------------------------------------- 68 | // The QLGeneratorInterfaceStruct function table. 69 | // 70 | static QLGeneratorInterfaceStruct myInterfaceFtbl = { 71 | NULL, 72 | QuickLookGeneratorQueryInterface, 73 | QuickLookGeneratorPluginAddRef, 74 | QuickLookGeneratorPluginRelease, 75 | NULL, 76 | NULL, 77 | NULL, 78 | NULL 79 | }; 80 | 81 | 82 | // ----------------------------------------------------------------------------- 83 | // AllocQuickLookGeneratorPluginType 84 | // ----------------------------------------------------------------------------- 85 | // Utility function that allocates a new instance. 86 | // You can do some initial setup for the generator here if you wish 87 | // like allocating globals etc... 88 | // 89 | QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID) 90 | { 91 | QuickLookGeneratorPluginType *theNewInstance; 92 | 93 | theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType)); 94 | memset(theNewInstance,0,sizeof(QuickLookGeneratorPluginType)); 95 | 96 | /* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */ 97 | theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct)); 98 | memcpy(theNewInstance->conduitInterface,&myInterfaceFtbl,sizeof(QLGeneratorInterfaceStruct)); 99 | 100 | /* Retain and keep an open instance refcount for each factory. */ 101 | theNewInstance->factoryID = CFRetain(inFactoryID); 102 | CFPlugInAddInstanceForFactory(inFactoryID); 103 | 104 | /* This function returns the IUnknown interface so set the refCount to one. */ 105 | theNewInstance->refCount = 1; 106 | return theNewInstance; 107 | } 108 | 109 | // ----------------------------------------------------------------------------- 110 | // DeallocQuickLookGeneratorPluginType 111 | // ----------------------------------------------------------------------------- 112 | // Utility function that deallocates the instance when 113 | // the refCount goes to zero. 114 | // In the current implementation generator interfaces are never deallocated 115 | // but implement this as this might change in the future 116 | // 117 | void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance) 118 | { 119 | CFUUIDRef theFactoryID; 120 | 121 | theFactoryID = thisInstance->factoryID; 122 | /* Free the conduitInterface table up */ 123 | free(thisInstance->conduitInterface); 124 | 125 | /* Free the instance structure */ 126 | free(thisInstance); 127 | if (theFactoryID){ 128 | CFPlugInRemoveInstanceForFactory(theFactoryID); 129 | CFRelease(theFactoryID); 130 | } 131 | } 132 | 133 | // ----------------------------------------------------------------------------- 134 | // QuickLookGeneratorQueryInterface 135 | // ----------------------------------------------------------------------------- 136 | // Implementation of the IUnknown QueryInterface function. 137 | // 138 | HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv) 139 | { 140 | CFUUIDRef interfaceID; 141 | 142 | interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid); 143 | 144 | if (CFEqual(interfaceID,kQLGeneratorCallbacksInterfaceID)){ 145 | /* If the Right interface was requested, bump the ref count, 146 | * set the ppv parameter equal to the instance, and 147 | * return good status. 148 | */ 149 | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GenerateThumbnailForURL = GenerateThumbnailForURL; 150 | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelThumbnailGeneration = CancelThumbnailGeneration; 151 | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GeneratePreviewForURL = GeneratePreviewForURL; 152 | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelPreviewGeneration = CancelPreviewGeneration; 153 | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance); 154 | *ppv = thisInstance; 155 | CFRelease(interfaceID); 156 | return S_OK; 157 | }else{ 158 | /* Requested interface unknown, bail with error. */ 159 | *ppv = NULL; 160 | CFRelease(interfaceID); 161 | return E_NOINTERFACE; 162 | } 163 | } 164 | 165 | // ----------------------------------------------------------------------------- 166 | // QuickLookGeneratorPluginAddRef 167 | // ----------------------------------------------------------------------------- 168 | // Implementation of reference counting for this type. Whenever an interface 169 | // is requested, bump the refCount for the instance. NOTE: returning the 170 | // refcount is a convention but is not required so don't rely on it. 171 | // 172 | ULONG QuickLookGeneratorPluginAddRef(void *thisInstance) 173 | { 174 | ((QuickLookGeneratorPluginType *)thisInstance )->refCount += 1; 175 | return ((QuickLookGeneratorPluginType*) thisInstance)->refCount; 176 | } 177 | 178 | // ----------------------------------------------------------------------------- 179 | // QuickLookGeneratorPluginRelease 180 | // ----------------------------------------------------------------------------- 181 | // When an interface is released, decrement the refCount. 182 | // If the refCount goes to zero, deallocate the instance. 183 | // 184 | ULONG QuickLookGeneratorPluginRelease(void *thisInstance) 185 | { 186 | ((QuickLookGeneratorPluginType*)thisInstance)->refCount -= 1; 187 | if (((QuickLookGeneratorPluginType*)thisInstance)->refCount == 0){ 188 | DeallocQuickLookGeneratorPluginType((QuickLookGeneratorPluginType*)thisInstance ); 189 | return 0; 190 | }else{ 191 | return ((QuickLookGeneratorPluginType*) thisInstance )->refCount; 192 | } 193 | } 194 | 195 | // ----------------------------------------------------------------------------- 196 | // QuickLookGeneratorPluginFactory 197 | // ----------------------------------------------------------------------------- 198 | __attribute__((visibility("default"))) void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID) 199 | { 200 | QuickLookGeneratorPluginType *result; 201 | CFUUIDRef uuid; 202 | 203 | /* If correct type is being requested, allocate an 204 | * instance of kQLGeneratorTypeID and return the IUnknown interface. 205 | */ 206 | if (CFEqual(typeID,kQLGeneratorTypeID)){ 207 | uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID)); 208 | result = AllocQuickLookGeneratorPluginType(uuid); 209 | CFRelease(uuid); 210 | return result; 211 | } 212 | /* If the requested type is incorrect, return NULL. */ 213 | return NULL; 214 | } 215 | 216 | -------------------------------------------------------------------------------- /qlgenerator/resetquicklookd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | touch -c "$2" 3 | /usr/bin/qlmanage -r 4 | /usr/bin/qlmanage -r cache 5 | true 6 | --------------------------------------------------------------------------------