]> git.r.bdr.sh - rbdr/captura/blob - Captura/Presentation/Settings/OutputSettings.swift
Attempt more AppleScript support
[rbdr/captura] / Captura / Presentation / Settings / OutputSettings.swift
1 import SwiftUI
2 import CloudStorage
3
4 struct OutputSettings: View {
5
6 @CloudStorage("outputFormats") var outputFormats: OutputFormatSetting = .all
7 @CloudStorage("frameRate") var frameRate = 10.0
8
9 private var anyState: String { "\(outputFormats), \(frameRate)" }
10
11 var body: some View {
12 Form {
13 VStack (alignment: .center) {
14 LabeledContent("GIF Framerate") {
15 Slider(value: $frameRate, in: 4...10, step: 1) {
16 Text("\(Int(frameRate))").font(.body).frame(width: 24)
17 } minimumValueLabel: {
18 Text("4")
19 } maximumValueLabel: {
20 Text("10")
21 }
22 }.font(.headline)
23 Picker(selection: $outputFormats, label: Text("Output Formats").font(.headline)) {
24 Text("GIF & MP4")
25 .tag(OutputFormatSetting.all)
26 .padding(.horizontal, 4.0)
27 .padding(.vertical, 2.0)
28 Text("Only GIF")
29 .tag(OutputFormatSetting.gifOnly)
30 .padding(.horizontal, 4.0)
31 .padding(.vertical, 2.0)
32
33 Text("Only MP4")
34 .tag(OutputFormatSetting.mp4Only)
35 .padding(.horizontal, 4.0)
36 .padding(.vertical, 2.0)
37 }.pickerStyle(.radioGroup)
38 }
39 Spacer()
40 }
41 .onChange(of: anyState) { _ in
42 NotificationCenter.default.post(name: .reloadConfiguration, object: nil, userInfo: nil)
43 }
44 }
45 }
46
47 #Preview {
48 OutputSettings()
49 }