]> git.r.bdr.sh - rbdr/captura/blob - Captura/Presentation/Settings/AdvancedSettings.swift
872d0c0fa4c698899a3b5b64d9692d47ac5c540c
[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 .help("The Backend URL to use. If this is empty, no backend will be used and the options below won't have an effect.")
20 Picker(selection: $outputFormats, label: Text("Backend Format").font(.headline)) {
21 Text("GIF")
22 .tag(OutputFormatSetting.gifOnly)
23 .padding(.horizontal, 4.0)
24 .padding(.vertical, 2.0)
25 Text("MP4")
26 .tag(OutputFormatSetting.mp4Only)
27 .padding(.horizontal, 4.0)
28 .padding(.vertical, 2.0)
29 }
30 .pickerStyle(.radioGroup)
31 .disabled(parsedBackendUrl == nil)
32 .help("The format picked here will be generated regardless of what option you pick in the output settings. It doesn't prevent files from being rendered.")
33 Toggle("Keep Local Files", isOn: $keepFiles)
34 .font(.headline)
35 .disabled(parsedBackendUrl == nil)
36 .padding(.vertical, 8.0)
37 .help("If this is off, locally generated recordings will be deleted immediately after a successful upload.")
38 HStack {
39 Text("These settings can break things! Please make sure you understand how to use them before enabling.")
40 .lineLimit(3...10)
41 Link(destination: URL(string: "https://captura.tranquil.systems")!) {
42 Image(systemName: "info.circle")
43 }.buttonStyle(.borderless)
44 }
45 Spacer()
46 }
47 }
48 }
49 }
50
51 #Preview {
52 OutputSettings()
53 }