Stage 1 targen: typed TargenConfig + argv builder (-v -d 2/4, -f, -e, -B, optional advanced flags, CMYK-only -l, never -u), ArgyllRunner over ProcessManager, Stage1View with disk-gated Generate. Issue 8: Open Existing resume — .ti1 → Stage 2, .ti2 → Stage 3 shell with persistent "Resumed from .ti2" banner, sibling-.ti1 gate. Stage 2 printtarg: PrinttargConfig/args (-v -u, -i, -p, -R 1 default, -r raster, -t/-T DPI), Stage2View with instrument/page/DPI/label controls, CM warning, stubbed print panel. Issue 10: pretty-manifest JSON parsing, host-side TIFF→PNG gallery previews, per-page stubbed print, failure stays on stage. Issue 11: typed ProfilingPreset schema with legacy CustomPreset migration, four built-ins, save/manage/import/export UI, DPI binding. Tests: 124 Core tests (Swift Testing) + 11 Milestone2UITests (XCTest) with committed fixture sidecars — all green on arm64+x86_64 universal build. No hardware, no downloads. Also: ProcessError LocalizedError conformance; accessibilityElement .contain on container identifiers so child AX ids survive. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
53 lines
1.9 KiB
Swift
53 lines
1.9 KiB
Swift
import AppKit
|
||
import ICCeryCore
|
||
import SwiftUI
|
||
|
||
@main
|
||
struct ICCeryApp: App {
|
||
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
|
||
@State private var workflow: TargetWorkflowViewModel
|
||
|
||
init() {
|
||
let environment = AppEnvironment.live()
|
||
_workflow = State(initialValue: TargetWorkflowViewModel(environment: environment))
|
||
try? AppPaths.ensureDirectories()
|
||
// Log level is runtime state — apply persisted settings at
|
||
// startup (#158); the Settings sheet re-applies on save.
|
||
LogSink.shared.applySettings(environment.settingsStore.load())
|
||
}
|
||
|
||
var body: some Scene {
|
||
// Single fixed window (docs/21 §Shell: 1280×800, min 1100×700).
|
||
Window("ICCery", id: "main") {
|
||
RootView(workflow: workflow)
|
||
.frame(minWidth: 1100, minHeight: 700)
|
||
.preferredColorScheme(.dark)
|
||
}
|
||
.defaultSize(width: 1280, height: 800)
|
||
.windowResizability(.contentMinSize)
|
||
.defaultPosition(.center)
|
||
}
|
||
}
|
||
|
||
/// AppDelegate: quit when the single window closes, and `killAll` Argyll
|
||
/// children before teardown (#147/#149). Termination is deferred until
|
||
/// `killAll` has signaled every child so `chartread` can park an XY head
|
||
/// when the UI already sent `q\n`.
|
||
final class AppDelegate: NSObject, NSApplicationDelegate {
|
||
private var terminationRequested = false
|
||
|
||
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||
true
|
||
}
|
||
|
||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
|
||
guard !terminationRequested else { return .terminateNow }
|
||
terminationRequested = true
|
||
Task {
|
||
await ProcessManager.shared.killAll()
|
||
NSApplication.shared.reply(toApplicationShouldTerminate: true)
|
||
}
|
||
return .terminateLater
|
||
}
|
||
}
|