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.
49 lines
1.7 KiB
49 lines
1.7 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) {
|
|
Form {
|
|
folderRow(
|
|
title: "Zielordner",
|
|
caption: "Hier entsteht pro Projekt ein Unterordner mit Original und 4:5-Fassung.",
|
|
current: settings.targetFolder
|
|
) { settings.setTargetFolder($0) }
|
|
|
|
folderRow(
|
|
title: "Quellordner",
|
|
caption: "„Dateien wählen …“ öffnet sich hier. Optional.",
|
|
current: settings.sourceFolder
|
|
) { settings.setSourceFolder($0) }
|
|
}
|
|
.formStyle(.grouped)
|
|
|
|
HStack {
|
|
Spacer()
|
|
Button("Fertig") { dismiss() }
|
|
.buttonStyle(ProminentButtonStyle())
|
|
.keyboardShortcut(.defaultAction)
|
|
}
|
|
.padding([.horizontal, .bottom], 20)
|
|
}
|
|
.frame(width: 520, height: 300)
|
|
}
|
|
|
|
private func folderRow(title: LocalizedStringKey, caption: LocalizedStringKey, current: URL?, onChoose: @escaping (URL) -> Void) -> some View {
|
|
LabeledContent {
|
|
Button("Wählen …") {
|
|
if let url = FolderPicker.choose(startingAt: current) { onChoose(url) }
|
|
}
|
|
} label: {
|
|
Text(title)
|
|
Text(current?.path ?? String(localized: "Nicht gesetzt"))
|
|
.lineLimit(1)
|
|
.truncationMode(.middle)
|
|
Text(caption)
|
|
}
|
|
}
|
|
}
|