]> git.r.bdr.sh - rbdr/captura/blame_incremental - Captura/Presentation/Settings/OutputSettings.swift
Add license and contributing
[rbdr/captura] / Captura / Presentation / Settings / OutputSettings.swift
... / ...
CommitLineData
1/*
2 Copyright (C) 2024 Rubén Beltrán del Río
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see https://captura.tranquil.systems.
16 */
17import SwiftUI
18
19struct OutputSettings: View {
20
21 @AppStorage("outputFormats") var outputFormats: OutputFormatSetting = .all
22 @AppStorage("frameRate") var frameRate = 10.0
23
24 private var anyState: String { "\(outputFormats), \(frameRate)" }
25
26 var body: some View {
27 Form {
28 VStack (alignment: .center) {
29 LabeledContent("GIF Framerate") {
30 Slider(value: $frameRate, in: 4...10, step: 1) {
31 Text("\(Int(frameRate))").font(.body).frame(width: 24)
32 } minimumValueLabel: {
33 Text("4")
34 } maximumValueLabel: {
35 Text("10")
36 }
37 }.font(.headline)
38 Picker(selection: $outputFormats, label: Text("Output Formats").font(.headline)) {
39 Text("GIF & MP4")
40 .tag(OutputFormatSetting.all)
41 .padding(.horizontal, 4.0)
42 .padding(.vertical, 2.0)
43 Text("Only GIF")
44 .tag(OutputFormatSetting.gifOnly)
45 .padding(.horizontal, 4.0)
46 .padding(.vertical, 2.0)
47
48 Text("Only MP4")
49 .tag(OutputFormatSetting.mp4Only)
50 .padding(.horizontal, 4.0)
51 .padding(.vertical, 2.0)
52 }.pickerStyle(.radioGroup)
53 }
54 Spacer()
55 }
56 .onChange(of: anyState) { _ in
57 NotificationCenter.default.post(name: .reloadConfiguration, object: nil, userInfo: nil)
58 }
59 }
60}
61
62#Preview {
63 OutputSettings()
64}