feat: add hardware print quality option supporting Canon 5-notch Custom slider and Epson modes (#5) #6

Merged
gronod merged 1 commits from fix/ppd-media-type-and-tray-options into development 2026-09-07 23:42:40 +01:00
Owner

Summary

This PR implements Issue #5: adding a dedicated Print Quality option (hardware droplet addressability / pass count) alongside input raster resolution. It fully supports Canon's 5-notch Custom slider (including Super Fine mode) and Epson's multi-level quality modes.

Key Changes

  1. PPD Quality Discovery (CUPSManager.swift):

    • Extended PPDOptions and PrinterQueue with qualityChoices: [PPDChoice] and qualityKeyword: String?.
    • Added automated candidate keyword discovery (CNIJPrintQuality, EPIJ_Qual, cupsPrintQuality, PrintQuality, CNIJPrintMode2, Quality, StpQuality) and *OpenUI fallback.
    • Preserves human-readable quality labels (e.g. Super Fine, Fine, Best Quality) while binding them to driver choice codes.
  2. Canon Coordinated Multi-Key Driver Injection (PrintEngine.swift):

    • Handled Canon's 5-notch Custom quality slider architecture:
      • Notch 5 (0): Super Fine -> injects CNIJPrintQuality=0, CNIJPrintMode2=5, CNIJPQualitySlider=5.
      • Notch 4 (5): Fine -> injects CNIJPrintQuality=5, CNIJPrintMode2=1, CNIJPQualitySlider=4.
      • Notch 3 (10): Normal(Fine) -> injects CNIJPrintQuality=10, CNIJPrintMode2=2, CNIJPQualitySlider=3.
      • Notch 2 (15): Normal(Fast) -> injects CNIJPrintQuality=15, CNIJPrintMode2=5, CNIJPQualitySlider=2.
      • Notch 1 (20): Fast -> injects CNIJPrintQuality=20, CNIJPrintMode2=3, CNIJPQualitySlider=1.
    • For Epson (EPIJ_Qual) and generic drivers, seamlessly injects the selected quality code.
  3. Inspector UI (InspectorView.swift):

    • Added Print quality dropdown (qualityPop) placed directly above Resolution.
    • Dynamic enable/disable based on printer capabilities and locked job policy.
    • Refined refillChoices to cleanly preserve selections across queue changes without injecting phantom items.
  4. Job Serialization & Controller (TargetJob.swift, PreviewWindowController.swift):

    • Added optional printQuality: String? to PrintSettings.
    • Updated JSON parser and serializer with backward compatibility.
    • Bound loaded job settings to engine.printQuality.
  5. Automated Testing (Tests/PPDOptionsTests.swift, Tests/TestRunnerMain.swift):

    • Added tests verifying PPD discovery for Canon 5-notch and Epson quality modes.
    • Verified Canon Super Fine coordinated multi-key injection.
    • Verified TargetJob serialization and round-trip parsing.

Closes #5

### Summary This PR implements Issue #5: adding a dedicated **Print Quality** option (hardware droplet addressability / pass count) alongside input raster resolution. It fully supports Canon's 5-notch Custom slider (including Super Fine mode) and Epson's multi-level quality modes. ### Key Changes 1. **PPD Quality Discovery (`CUPSManager.swift`)**: - Extended `PPDOptions` and `PrinterQueue` with `qualityChoices: [PPDChoice]` and `qualityKeyword: String?`. - Added automated candidate keyword discovery (`CNIJPrintQuality`, `EPIJ_Qual`, `cupsPrintQuality`, `PrintQuality`, `CNIJPrintMode2`, `Quality`, `StpQuality`) and `*OpenUI` fallback. - Preserves human-readable quality labels (e.g. `Super Fine`, `Fine`, `Best Quality`) while binding them to driver choice codes. 2. **Canon Coordinated Multi-Key Driver Injection (`PrintEngine.swift`)**: - Handled Canon's 5-notch Custom quality slider architecture: - Notch 5 (`0`): **Super Fine** -> injects `CNIJPrintQuality=0`, `CNIJPrintMode2=5`, `CNIJPQualitySlider=5`. - Notch 4 (`5`): **Fine** -> injects `CNIJPrintQuality=5`, `CNIJPrintMode2=1`, `CNIJPQualitySlider=4`. - Notch 3 (`10`): **Normal(Fine)** -> injects `CNIJPrintQuality=10`, `CNIJPrintMode2=2`, `CNIJPQualitySlider=3`. - Notch 2 (`15`): **Normal(Fast)** -> injects `CNIJPrintQuality=15`, `CNIJPrintMode2=5`, `CNIJPQualitySlider=2`. - Notch 1 (`20`): **Fast** -> injects `CNIJPrintQuality=20`, `CNIJPrintMode2=3`, `CNIJPQualitySlider=1`. - For Epson (`EPIJ_Qual`) and generic drivers, seamlessly injects the selected quality code. 3. **Inspector UI (`InspectorView.swift`)**: - Added `Print quality` dropdown (`qualityPop`) placed directly above `Resolution`. - Dynamic enable/disable based on printer capabilities and locked job policy. - Refined `refillChoices` to cleanly preserve selections across queue changes without injecting phantom items. 4. **Job Serialization & Controller (`TargetJob.swift`, `PreviewWindowController.swift`)**: - Added optional `printQuality: String?` to `PrintSettings`. - Updated JSON parser and serializer with backward compatibility. - Bound loaded job settings to `engine.printQuality`. 5. **Automated Testing (`Tests/PPDOptionsTests.swift`, `Tests/TestRunnerMain.swift`)**: - Added tests verifying PPD discovery for Canon 5-notch and Epson quality modes. - Verified Canon Super Fine coordinated multi-key injection. - Verified `TargetJob` serialization and round-trip parsing. Closes #5
gronod added 1 commit 2026-09-07 23:37:16 +01:00
feat: add hardware print quality option supporting Canon 5-notch Custom slider and Epson modes (Closes #5)
Build macOS Packages / Build macOS (Intel) (pull_request) Successful in 32s
Build macOS Packages / Build macOS (Apple Silicon) (pull_request) Successful in 37s
Build macOS Packages / Build macOS (Universal) (pull_request) Failing after 10s
474888541b
gronod merged commit 842caaec04 into development 2026-09-07 23:42:40 +01:00
Sign in to join this conversation.