]>
Commit | Line | Data |
---|---|---|
a4e80427 RBR |
1 | import SwiftUI |
2 | ||
3 | struct AdvancedSettings: View { | |
4 | ||
5 | @AppStorage("backendUrl") var backendUrl: String = "" | |
c9b9e1d6 | 6 | @AppStorage("backendFormat") var outputFormats: OutputFormatSetting = .gifOnly |
a4e80427 RBR |
7 | @AppStorage("keepFiles") var keepFiles = true |
8 | ||
c9b9e1d6 RBR |
9 | var parsedBackendUrl: URL? { |
10 | URL(string: backendUrl) | |
11 | } | |
12 | ||
a4e80427 RBR |
13 | var body: some View { |
14 | Form { | |
c9b9e1d6 | 15 | VStack (alignment: .center) { |
a4e80427 | 16 | LabeledContent("Backend URL") { |
c9b9e1d6 | 17 | TextField("", text: $backendUrl).font(.body) |
a4e80427 | 18 | }.font(.headline) |
c9b9e1d6 RBR |
19 | Picker(selection: $outputFormats, label: Text("Backend Format").font(.headline)) { |
20 | Text("GIF") | |
21 | .tag(OutputFormatSetting.gifOnly) | |
22 | .padding(.horizontal, 4.0) | |
23 | .padding(.vertical, 2.0) | |
24 | Text("MP4") | |
25 | .tag(OutputFormatSetting.mp4Only) | |
26 | .padding(.horizontal, 4.0) | |
27 | .padding(.vertical, 2.0) | |
28 | } | |
29 | .pickerStyle(.radioGroup) | |
30 | .disabled(parsedBackendUrl == nil) | |
31 | Toggle("Keep Local Files", isOn: $keepFiles) | |
32 | .font(.headline) | |
33 | .disabled(parsedBackendUrl == nil) | |
34 | .padding(.vertical, 8.0) | |
a4e80427 | 35 | HStack { |
c9b9e1d6 RBR |
36 | Text("These settings can break things! Please make sure you understand how to use them before enabling.") |
37 | .lineLimit(3...10) | |
a4e80427 RBR |
38 | Button { |
39 | print("Not yet!") | |
40 | } label: { | |
41 | Image(systemName: "info.circle") | |
42 | }.buttonStyle(.borderless) | |
43 | } | |
c9b9e1d6 | 44 | Spacer() |
a4e80427 RBR |
45 | } |
46 | } | |
47 | } | |
48 | } | |
49 | ||
50 | #Preview { | |
51 | OutputSettings() | |
52 | } |