# AmigaQuickLook — system-wide Quick Look extension

This folder holds the source for the Amiga Imager Quick Look preview extension.
The decoding logic is finished and tested (it shares `AmigaDiskKit`'s preview
core with the in-app Disk Browser pane). What remains is creating the **Xcode
target**, which is safest to do in the GUI rather than by hand-editing
`project.pbxproj`.

## What it previews
- IFF **ILBM images** and Workbench **`.info` icons** → rendered (nearest-neighbour
  upscaled so small icons stay crisp)
- **text / scripts / AmigaGuide** → plain text
- **`.adf` / `.hdf` / `.lha`** containers → a bounded volume + file-tree listing

## One-time Xcode setup (~3 min)

1. **Add the target.** File ▸ New ▸ Target… ▸ macOS ▸ **Quick Look Preview
   Extension**. Name it `AmigaQuickLook`. Let Xcode create it (it generates a
   stub `PreviewProvider.swift`, an `Info.plist`, and an `.entitlements`).
2. **Use this folder's source.** Replace the generated `PreviewProvider.swift`
   contents with `AmigaQuickLook/PreviewProvider.swift`, and replace the
   generated `Info.plist` with `AmigaQuickLook/Info.plist` (or point the target's
   `INFOPLIST_FILE` build setting at it and set `GENERATE_INFOPLIST_FILE = NO`).
3. **Link AmigaDiskKit.** Select the `AmigaQuickLook` target ▸ General ▸
   *Frameworks and Libraries* ▸ **+** ▸ add `AmigaDiskKit`. (The package product
   is `.static`, so it links straight in — keep it static.)
4. **Confirm embedding.** The app target ▸ Build Phases should now contain an
   *Embed Foundation Extensions* phase with `AmigaQuickLook` in it (Xcode adds
   this automatically).
5. **Deployment target** ≥ macOS 12 (the app is already 14).
6. **Keep the sandbox.** The generated entitlements enable App Sandbox + the
   user-selected/read-only file access Quick Look needs. Leave them as-is — the
   extension only reads the file macOS hands it.

## Making the Settings toggle actually gate previews (optional)

The "Preview Amiga files in Finder" toggle (Settings ▸ General) is read by the
extension from a shared app-group suite. Until that's wired, the extension
**always previews** (the toggle is advisory). To make it functional:

1. Add capability **App Groups** ▸ `group.com.amigaimager` to **both** the app
   and the `AmigaQuickLook` targets.
2. In `SettingsView.swift`, change the toggle's storage to that suite:
   `@AppStorage("emu68.quickLookEnabled", store: UserDefaults(suiteName: "group.com.amigaimager"))`.

`SharedPrefs` in `PreviewProvider.swift` already reads that suite/key and
defaults to enabled when absent.

## Test it

1. Build & run the app once so Launch Services registers the extension.
2. Enable it: System Settings ▸ General ▸ Login Items & Extensions ▸ **Quick
   Look** ▸ turn on *Amiga Imager*.
3. In Finder, press **Space** on an `.iff`/`.info` (renders) and an
   `.adf`/`.hdf`/`.lha` (shows the listing). From Terminal:
   `qlmanage -p /path/to/picture.iff`.

## Notes
- We deliberately do **not** claim `.img` (it collides with the system
  disk-image type) — `.img` hard-disk images still preview inside the app.
- If `com.amigaimager.info` ever collides with another app's `.info` handler,
  drop it from `UTExportedTypeDeclarations` and `QLSupportedContentTypes`.
