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
20 changes: 0 additions & 20 deletions Sources/Pladder/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@
}
}
},
"Asks GitHub once a day for a newer Pladder. Sends nothing about you.": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Fragt einmal am Tag bei GitHub nach einem neueren Pladder. Sendet nichts über dich."
}
}
}
},
"Built into macOS. Adds one to two seconds to each dictation.": {
"localizations": {
"de": {
Expand Down Expand Up @@ -951,16 +941,6 @@
}
}
},
"So music or a call does not end up in the dictation.": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Damit Musik oder ein Anruf nicht im Diktat landet."
}
}
}
},
"Tap to start, tap again to paste.": {
"localizations": {
"de": {
Expand Down
31 changes: 17 additions & 14 deletions Sources/Pladder/Settings/GeneralSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ private struct GetStartedSection: View {
}
}

// Shown in Get Started while it lasts, and in the speech model's own section after.
// Shown in Get Started while it lasts, and in the speech model's own section after, where
// a load is only the Model row's subtitle: a switch of model is not setup.
private struct SpeechModelProgress: View {
let model: AppModel
var showsLoading = true

var body: some View {
switch model.coordinator.engineStatus {
Expand All @@ -106,8 +108,8 @@ private struct SpeechModelProgress: View {
}
}
case .loading:
ProgressView {
Text("Loading the speech model…")
if showsLoading {
BusyRow("Loading the speech model…")
}
case .failed(let failure):
LabeledContent {
Expand Down Expand Up @@ -137,20 +139,14 @@ private struct StartupSection: View {
// Its own line, not the group's footer: the rest of the group is the user's.
Toggle(isOn: $model.settings.checksForUpdatesAutomatically) {
Text("Check for updates automatically")
Text("Asks GitHub once a day for a newer Pladder. Sends nothing about you.")
if model.policy.updateChecks != nil {
Text(ManagedText.footer)
}
}
.accessibilityHint(Text("Asks GitHub once a day for a newer Pladder. Sends nothing about you."))
.disabled(model.policy.updateChecks != nil)
}
Toggle("Play start and stop sounds", isOn: $model.settings.playSounds)
Toggle(isOn: $model.settings.muteOutputWhileDictating) {
Text("Mute other audio while recording")
Text("So music or a call does not end up in the dictation.")
}
.accessibilityHint(Text("So music or a call does not end up in the dictation."))
Toggle("Mute other audio while recording", isOn: $model.settings.muteOutputWhileDictating)
}
}
}
Expand Down Expand Up @@ -250,13 +246,12 @@ private struct SpeechModelSection: View {
}
} label: {
Text("Model")
// The registry's own text, localized where it is built.
Text(verbatim: model.registry.entry(for: model.settings.engineID)?.detail ?? "")
Text(verbatim: detail)
}
.accessibilityHint(Text(verbatim: model.registry.entry(for: model.settings.engineID)?.detail ?? ""))
.accessibilityHint(Text(verbatim: detail))
.disabled(model.policy.pinsEngine)
if !model.showsGetStarted {
SpeechModelProgress(model: model)
SpeechModelProgress(model: model, showsLoading: false)
}
} header: {
Text("Speech Model")
Expand All @@ -267,6 +262,14 @@ private struct SpeechModelSection: View {
}
}

private var detail: String {
if case .loading = model.coordinator.engineStatus, !model.showsGetStarted {
return String(localized: "Loading the speech model…")
}
// The registry's own text, localized where it is built.
return model.registry.entry(for: model.settings.engineID)?.detail ?? ""
}

private var engines: [EngineRegistry.Entry] {
let allowed = model.policy.engines(from: model.registry.available.map(\.id))
return model.registry.available.filter { allowed.contains($0.id) }
Expand Down
23 changes: 9 additions & 14 deletions Sources/Pladder/Settings/OptionCards.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct OptionCard<Thumbnail: View>: View {
@ViewBuilder let thumbnail: Thumbnail

// Computed, since a generic type cannot hold static stored values.
private static var designSize: CGSize { CGSize(width: 132, height: 84) }
private static var designSize: CGSize { CGSize(width: 132, height: 62) }
private static var scale: CGFloat { 0.75 }
private static var cardSize: CGSize {
CGSize(width: (designSize.width * scale).rounded(), height: (designSize.height * scale).rounded())
Expand Down Expand Up @@ -105,31 +105,27 @@ struct OverlayStyleThumbnail: View {
let style: OverlayStyle

private static let previewLevel: Float = 0.55
// One scale for every style, so the cards compare sizes the way the real pills do.
private static let pillScale: CGFloat = 0.65

var body: some View {
DesktopWash()
// Overlay rather than ZStack: a scaled-down pill still lays out at full size, and in
// a ZStack that would stretch the backdrop so the card only shows its middle.
.overlay(alignment: style == .menuBar ? .top : .bottom) {
.overlay(alignment: style == .menuBar ? .top : .center) {
content
}
}

@ViewBuilder
private var content: some View {
switch style {
case .compact:
OverlayPill(state: .recording, level: Self.previewLevel, style: .compact, isPreview: true)
.fixedSize()
.scaleEffect(0.62)
.padding(.bottom, 2)
case .minimal:
OverlayPill(state: .recording, level: Self.previewLevel, style: .minimal, isPreview: true)
.fixedSize()
.scaleEffect(0.8)
.padding(.bottom, 10)
case .menuBar:
menuBar
case .compact, .minimal:
OverlayPill(state: .recording, level: Self.previewLevel, style: style, isPreview: true)
.fixedSize()
.scaleEffect(Self.pillScale)
case .liveTranscript:
OverlayPill(
state: .recording,
Expand All @@ -142,8 +138,7 @@ struct OverlayStyleThumbnail: View {
// Proposed at the card's width the glass shrinks but the row does not, and the dot
// ends up outside the capsule.
.fixedSize()
.scaleEffect(0.8)
.padding(.bottom, 4)
.scaleEffect(Self.pillScale)
}
}

Expand Down
17 changes: 17 additions & 0 deletions Sources/Pladder/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,23 @@ struct WarningLabel: View {
}
}

// Work under way, as System Settings shows it: the sentence, and a small spinner at the
// trailing edge. The regular size is a 32 pt wheel that outweighs the form.
struct BusyRow: View {
let text: LocalizedStringKey

init(_ text: LocalizedStringKey) { self.text = text }

var body: some View {
LabeledContent {
ProgressView()
.controlSize(.small)
} label: {
Text(text)
}
}
}

struct PermissionRow: View {
let title: LocalizedStringKey
let detail: String
Expand Down
4 changes: 1 addition & 3 deletions Sources/Pladder/Settings/TextSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ struct TextSettingsView: View {
Text(fraction, format: .percent.precision(.fractionLength(0)))
}
case .verifying:
ProgressView {
Text("Checking the download…")
}
BusyRow("Checking the download…")
case .failed(let failure):
LabeledContent {
Button("Try Again") { model.polish.retryDownload() }
Expand Down
11 changes: 9 additions & 2 deletions docs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ Three rules decide most questions:
- **Section headers in Title Case** ("Keyboard Shortcuts", "Recording Indicator");
row labels in sentence case ("Mute other audio while recording").
- **A row that needs explaining gets one short subtitle** under its label, saying
what it does or why, not how it works. The same sentence is the control's
what it does or why, not how it works. A label that already says it gets none
("Check for updates automatically", "Mute other audio while recording"). The same sentence is the control's
accessibility hint, so VoiceOver users moving control by control hear it too. On
macOS `.help` and the accessibility hint are one attribute, so a control with help
puts the hint first in it.
Expand All @@ -63,7 +64,13 @@ Three rules decide most questions:
a well with the glyphs (⌥Space) and a clear button. All share one width per
language. Focus rings only with Full Keyboard Access.
- **Choices with a picture** (the recording indicator styles) are a radio group of
cards with a neutral thumbnail, focusable and announced as one group.
cards with a neutral thumbnail, focusable and announced as one group. Every pill is
drawn at one scale and centred, so the cards compare sizes as the real pills do.
- **Work under way** is a sentence with an ellipsis. When it belongs to a row, a
model switch say, it takes that row's subtitle; otherwise it is a row of its own
with a small spinner at the trailing edge (`BusyRow`). A download shows its bar.
Never the regular-size spinner: it outweighs the form, and the menu and its icon
already say the model is loading.
- **Empty states** use `ContentUnavailableView` with the one action that fills them,
and hide the controls that only make sense with content (the dictionary's table,
its add and remove buttons, its test field).
Expand Down
Loading