Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Sources/App/OpenTypeApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,15 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
width: SettingsWindowLayout.width,
height: SettingsWindowLayout.height
),
styleMask: [.titled, .closable, .miniaturizable, .resizable],
styleMask: SettingsWindowLayout.styleMask,
backing: .buffered,
defer: false
)
window.title = SettingsWindowTitle.current
window.minSize = NSSize(
width: SettingsWindowLayout.minimumWidth,
height: SettingsWindowLayout.minimumHeight
)
window.setFrameAutosaveName("UtterSettingsWindow")
window.contentMinSize = SettingsWindowLayout.contentSize
window.contentMaxSize = SettingsWindowLayout.contentSize
window.setContentSize(SettingsWindowLayout.contentSize)
window.center()
window.contentView = NSHostingView(rootView: settingsView)
window.isReleasedWhenClosed = false
Expand Down
2 changes: 1 addition & 1 deletion Sources/Config/AppSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum SpeechEngineType: String, Codable, CaseIterable {
case mimo = "mimo"

static var selectableCases: [SpeechEngineType] {
allCases.filter { $0 != .mimo }
[.qwen3, .whisper, .apple, .volc]
}

var label: String {
Expand Down
1 change: 1 addition & 0 deletions Sources/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"common.copy_clipboard" = "Copy to Clipboard";
"common.cannot_undo" = "This action cannot be undone.";
"common.recommended" = "Recommended";
"common.recommended_short" = "Rec.";
"common.custom" = "Custom";
"common.retry" = "Retry";

Expand Down
1 change: 1 addition & 0 deletions Sources/Resources/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"common.copy_clipboard" = "复制到剪贴板";
"common.cannot_undo" = "此操作不可撤销。";
"common.recommended" = "推荐";
"common.recommended_short" = "推荐";
"common.custom" = "自定义";
"common.retry" = "重试";

Expand Down
80 changes: 27 additions & 53 deletions Sources/UI/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,38 @@ import Speech

struct AboutView: View {
var body: some View {
VStack(spacing: 0) {
SettingsPageHeader(
kind: .about,
title: ProductBrand.displayName,
subtitle: L("settings.page.about.subtitle")
) {
SettingsPageBadge(title: version, symbol: "shippingbox")
Form {
Section {
permRow(icon: "hand.raised.fill", name: L("perm.accessibility"),
hint: L("perm.accessibility_hint"), granted: accessibilityGranted, action: openAccessibility)
permRow(icon: "mic.fill", name: L("perm.microphone"),
hint: L("perm.microphone_hint"), granted: microphoneGranted, action: requestMicrophone)
permRow(icon: "waveform", name: L("perm.speech"),
hint: L("perm.speech_hint"), granted: speechGranted, action: requestSpeech)
permRow(icon: "rectangle.dashed.badge.record", name: L("perm.screen"),
hint: L("perm.screen_hint"), granted: screenCaptureGranted, action: requestScreenCapture)
} header: {
HStack {
Text(L("settings.permissions"))
Spacer()
Button {
checkAll()
} label: {
Image(systemName: "arrow.clockwise")
}
.buttonStyle(.plain)
.accessibilityLabel(L("settings.permissions"))
}
}
Divider()

ScrollView {
VStack(spacing: 14) {
SettingsPanel { permissionsSection }
SettingsPanel { appInfo }
}
.padding(20)
Section {
appInfo
}
}
.formStyle(.grouped)
.scrollContentBackground(.hidden)
.settingsPageSurface()
.onAppear { checkAll() }
}

// MARK: - App Info
Expand Down Expand Up @@ -65,43 +78,6 @@ struct AboutView: View {
@State private var speechGranted = false
@State private var screenCaptureGranted = false

private var permissionsSection: some View {
VStack(alignment: .leading, spacing: 12) {
HStack {
Label(L("settings.permissions"), systemImage: "lock.shield")
.font(.headline)
Spacer()
Button {
checkAll()
} label: {
Image(systemName: "arrow.clockwise")
.font(.system(size: 11))
}
.buttonStyle(.plain)
.foregroundStyle(.secondary)
}

VStack(spacing: 0) {
permRow(icon: "hand.raised.fill", name: L("perm.accessibility"),
hint: L("perm.accessibility_hint"), granted: accessibilityGranted, action: openAccessibility)
Divider().padding(.horizontal, 12)
permRow(icon: "mic.fill", name: L("perm.microphone"),
hint: L("perm.microphone_hint"), granted: microphoneGranted, action: requestMicrophone)
Divider().padding(.horizontal, 12)
permRow(icon: "waveform", name: L("perm.speech"),
hint: L("perm.speech_hint"), granted: speechGranted, action: requestSpeech)
Divider().padding(.horizontal, 12)
permRow(icon: "rectangle.dashed.badge.record", name: L("perm.screen"),
hint: L("perm.screen_hint"), granted: screenCaptureGranted, action: requestScreenCapture)
}
.background(Color(nsColor: .controlBackgroundColor))
.clipShape(RoundedRectangle(cornerRadius: 8))
.overlay(RoundedRectangle(cornerRadius: 8).stroke(Color(nsColor: .separatorColor), lineWidth: 0.5))

}
.onAppear { checkAll() }
}

private func permRow(icon: String, name: String, hint: String, granted: Bool, action: @escaping () -> Void) -> some View {
HStack(spacing: 10) {
Image(systemName: icon)
Expand All @@ -125,8 +101,6 @@ struct AboutView: View {
.controlSize(.mini)
}
}
.padding(.horizontal, 12)
.padding(.vertical, 8)
}

// MARK: - Permission actions
Expand Down
30 changes: 6 additions & 24 deletions Sources/UI/DictionaryManagementView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ struct DictionaryManagementView: View {
@State private var showClearConfirmation = false

var body: some View {
VStack(alignment: .leading, spacing: 10) {
header
Section {
Toggle(L("dictionary.auto_learning"), isOn: $settings.enableCorrectionLearning)
addRow
filterRow
entriesList
footer
} header: {
Text(L("dictionary.title"))
} footer: {
Text(L("dictionary.subtitle"))
}
.alert(L("dictionary.clear_learned_confirm"), isPresented: $showClearConfirmation) {
Button(L("common.cancel"), role: .cancel) {}
Expand All @@ -36,22 +40,6 @@ struct DictionaryManagementView: View {
}
}

private var header: some View {
VStack(alignment: .leading, spacing: 5) {
HStack {
Label(L("dictionary.title"), systemImage: "text.book.closed")
.font(.headline)
Spacer()
Toggle(L("dictionary.auto_learning"), isOn: $settings.enableCorrectionLearning)
.toggleStyle(.switch)
.controlSize(.small)
}
Text(L("dictionary.subtitle"))
.font(.caption)
.foregroundStyle(.secondary)
}
}

private var addRow: some View {
HStack(spacing: 8) {
TextField(L("dictionary.spoken_form"), text: $newOriginal)
Expand Down Expand Up @@ -106,12 +94,6 @@ struct DictionaryManagementView: View {
}
}
.frame(minHeight: 110, maxHeight: 190)
.background(Color(nsColor: .controlBackgroundColor))
.clipShape(RoundedRectangle(cornerRadius: 6))
.overlay {
RoundedRectangle(cornerRadius: 6)
.stroke(Color(nsColor: .separatorColor), lineWidth: 0.5)
}
}
}
}
Expand Down
Loading
Loading