]> git.r.bdr.sh - rbdr/captura/blame - Captura/Data/OutputFormatSetting.swift
Add AppleScript support
[rbdr/captura] / Captura / Data / OutputFormatSetting.swift
CommitLineData
a4e80427
RBR
1import Foundation
2
3enum OutputFormatSetting: Int {
4 case gifOnly = 0
5 case mp4Only = 1
6 case all = 2
7
ba17de89
RBR
8 init?(_ string: String) {
9 switch(string) {
10 case "gif":
11 self = .gifOnly
12 case "mp4":
13 self = .mp4Only
14 case "all":
15 self = .all
16 default:
17 return nil
18 }
19 }
20
a4e80427
RBR
21 func shouldSaveGif() -> Bool {
22 return self == .gifOnly || self == .all
23 }
24
25 func shouldSaveMp4() -> Bool {
26 return self == .mp4Only || self == .all
27 }
377442f2
RBR
28
29 func toString() -> String {
30 switch(self) {
31 case .gifOnly:
32 return "gif"
33 case .mp4Only:
34 return "mp4"
35 case .all:
36 return "all"
37 }
38 }
a4e80427 39}