From 377442f2f1f0f08bc525393c9bd1c84f159c5159 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Wed, 2 Aug 2023 10:30:51 +0200 Subject: Add AppleScript support --- Captura/Data/OutputFormatSetting.swift | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Captura/Data/OutputFormatSetting.swift (limited to 'Captura/Data/OutputFormatSetting.swift') diff --git a/Captura/Data/OutputFormatSetting.swift b/Captura/Data/OutputFormatSetting.swift new file mode 100644 index 0000000..211a08e --- /dev/null +++ b/Captura/Data/OutputFormatSetting.swift @@ -0,0 +1,39 @@ +import Foundation + +enum OutputFormatSetting: Int { + case gifOnly = 0 + case mp4Only = 1 + case all = 2 + + init?(_ string: String) { + switch(string) { + case "gif": + self = .gifOnly + case "mp4": + self = .mp4Only + case "all": + self = .all + default: + return nil + } + } + + func shouldSaveGif() -> Bool { + return self == .gifOnly || self == .all + } + + func shouldSaveMp4() -> Bool { + return self == .mp4Only || self == .all + } + + func toString() -> String { + switch(self) { + case .gifOnly: + return "gif" + case .mp4Only: + return "mp4" + case .all: + return "all" + } + } +} -- cgit