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.
60 lines
2.1 KiB
60 lines
2.1 KiB
import SwiftUI
|
|
|
|
struct SettingsView: View {
|
|
@EnvironmentObject private var settings: AppSettings
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 16) {
|
|
Text("Einstellungen")
|
|
.font(.title2.bold())
|
|
|
|
VStack(alignment: .leading, spacing: 6) {
|
|
Text("Quellordner").font(.headline)
|
|
Text("Der Dateiauswahl-Dialog öffnet sich hier.")
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
folderRow(current: settings.sourceFolder) { settings.setSourceFolder($0) }
|
|
}
|
|
|
|
VStack(alignment: .leading, spacing: 6) {
|
|
Text("Zielordner").font(.headline)
|
|
Text("Hier entsteht pro Projekt ein Unterordner mit Original und 4:5-Fassung.")
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
folderRow(current: settings.targetFolder) { settings.setTargetFolder($0) }
|
|
}
|
|
|
|
Spacer()
|
|
|
|
HStack {
|
|
Spacer()
|
|
Button("Fertig") { dismiss() }
|
|
.keyboardShortcut(.defaultAction)
|
|
}
|
|
}
|
|
.padding(20)
|
|
.frame(minWidth: 440, minHeight: 280)
|
|
}
|
|
|
|
@ViewBuilder
|
|
private func folderRow(current: URL?, onChoose: @escaping (URL) -> Void) -> some View {
|
|
HStack {
|
|
Text(current?.path ?? "Nicht gesetzt")
|
|
.lineLimit(1)
|
|
.truncationMode(.middle)
|
|
.foregroundStyle(current == nil ? .secondary : .primary)
|
|
Spacer()
|
|
Button("Wählen…") {
|
|
let panel = NSOpenPanel()
|
|
panel.canChooseDirectories = true
|
|
panel.canChooseFiles = false
|
|
panel.allowsMultipleSelection = false
|
|
if let current { panel.directoryURL = current }
|
|
guard panel.runModal() == .OK, let url = panel.url else { return }
|
|
onChoose(url)
|
|
}
|
|
}
|
|
}
|
|
}
|