feat:mac os
This commit is contained in:
1 parent
136bf7cfa3
commit
3400e2b465
18 files changed
+1129
No files matched your search
@@ -0,0 +1,61 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsView: View {
|
||||
@ObservedObject var model: AppModel
|
||||
@ObservedObject private var settings: AppSettings
|
||||
@State private var apiKey = ""
|
||||
|
||||
init(model: AppModel) {
|
||||
self.model = model
|
||||
settings = model.settings
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section("Transcription") {
|
||||
TextField("Endpoint", text: $settings.endpoint, prompt: Text("https://api.example.com"))
|
||||
TextField("Model", text: $settings.model)
|
||||
SecureField("API key", text: $apiKey)
|
||||
.onChange(of: apiKey) { _, value in settings.apiKey = value }
|
||||
TextField("Prompt", text: $settings.prompt, axis: .vertical)
|
||||
.lineLimit(2...4)
|
||||
Picker("Output", selection: $settings.destination) {
|
||||
ForEach(TranscriptDestination.allCases) { destination in
|
||||
Text(destination.label).tag(destination)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section("Controls") {
|
||||
LabeledContent("Record shortcut") {
|
||||
HotkeyRecorder(shortcut: $settings.shortcut)
|
||||
.frame(width: 132, height: 24)
|
||||
}
|
||||
if let shortcutError = model.shortcutError {
|
||||
Text(shortcutError)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.red)
|
||||
}
|
||||
Toggle(
|
||||
"Start at login",
|
||||
isOn: Binding(
|
||||
get: { model.startsAtLogin },
|
||||
set: model.setStartAtLogin
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Section("Permissions") {
|
||||
LabeledContent("Microphone") {
|
||||
Button("Open settings", action: model.openMicrophoneSettings)
|
||||
}
|
||||
LabeledContent("Type at cursor") {
|
||||
Button("Open Accessibility", action: model.openAccessibilitySettings)
|
||||
}
|
||||
}
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.frame(width: 500, height: 470)
|
||||
.onAppear { apiKey = settings.apiKey }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user