]> git.r.bdr.sh - rbdr/captura/blob - Captura/Presentation/Settings/AdvancedSettings.swift
e5b77ce430651896ebc7a2610e5fc43273e72912
[rbdr/captura] / Captura / Presentation / Settings / AdvancedSettings.swift
1 import SwiftUI
2
3 struct AdvancedSettings: View {
4
5 @AppStorage("backendUrl") var backendUrl: String = ""
6 @AppStorage("backendFormat") var outputFormats: OutputFormatSetting = .gifOnly
7 @AppStorage("keepFiles") var keepFiles = true
8
9 var parsedBackendUrl: URL? {
10 URL(string: backendUrl)
11 }
12
13 var body: some View {
14 Form {
15 VStack (alignment: .center) {
16 LabeledContent("Backend URL") {
17 TextField("", text: $backendUrl).font(.body)
18 }.font(.headline)
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)
35 HStack {
36 Text("These settings can break things! Please make sure you understand how to use them before enabling.")
37 .lineLimit(3...10)
38 Button {
39 print("Not yet!")
40 } label: {
41 Image(systemName: "info.circle")
42 }.buttonStyle(.borderless)
43 }
44 Spacer()
45 }
46 }
47 }
48 }
49
50 #Preview {
51 OutputSettings()
52 }