]> git.r.bdr.sh - rbdr/captura/blame - Captura/Presentation/Settings/AdvancedSettings.swift
Complete initial release
[rbdr/captura] / Captura / Presentation / Settings / AdvancedSettings.swift
CommitLineData
a4e80427
RBR
1import SwiftUI
2
3struct 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)
533cd932 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.")
c9b9e1d6
RBR
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)
533cd932 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.")
c9b9e1d6
RBR
33 Toggle("Keep Local Files", isOn: $keepFiles)
34 .font(.headline)
35 .disabled(parsedBackendUrl == nil)
36 .padding(.vertical, 8.0)
533cd932 37 .help("If this is off, locally generated recordings will be deleted immediately after a successful upload.")
a4e80427 38 HStack {
c9b9e1d6
RBR
39 Text("These settings can break things! Please make sure you understand how to use them before enabling.")
40 .lineLimit(3...10)
533cd932 41 Link(destination: URL(string: "https://captura.tranquil.systems")!) {
a4e80427
RBR
42 Image(systemName: "info.circle")
43 }.buttonStyle(.borderless)
44 }
c9b9e1d6 45 Spacer()
a4e80427
RBR
46 }
47 }
48 }
49}
50
51#Preview {
52 OutputSettings()
53}