You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
import DropTwoCore
|
|
import Foundation
|
|
|
|
/// Ein Element in der Dateiliste der Oberfläche, mit seinem aktuellen
|
|
/// Verarbeitungsstatus. Rein UI-seitig — die eigentliche Logik steckt in
|
|
/// `ConversionPipeline`/`JobQueue` in DropTwoCore.
|
|
struct DropItem: Identifiable {
|
|
let id: UUID
|
|
let sourceURL: URL
|
|
var status: Status
|
|
|
|
enum Status {
|
|
case waiting
|
|
case running(progress: Double)
|
|
case skipped(SkipReason)
|
|
case rejected(RejectionReason)
|
|
case succeeded(croppedDestination: URL)
|
|
case failed(message: String)
|
|
|
|
/// Fehlerliste statt stiller Abbrüche: alles außer "läuft"/"fertig"
|
|
/// braucht sichtbare Aufmerksamkeit.
|
|
var needsAttention: Bool {
|
|
switch self {
|
|
case .skipped, .rejected, .failed:
|
|
return true
|
|
case .waiting, .running, .succeeded:
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
|
|
init(sourceURL: URL) {
|
|
self.id = UUID()
|
|
self.sourceURL = sourceURL
|
|
self.status = .waiting
|
|
}
|
|
|
|
var fileName: String { sourceURL.lastPathComponent }
|
|
}
|