Skip to content

Commit

Permalink
Voice engine #73: Select language and voice by the left mouse button.
Browse files Browse the repository at this point in the history
  • Loading branch information
filimo committed Jan 15, 2020
1 parent bb6bd61 commit db168e0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,35 @@ struct StatusBarView_Voice_Select: View {

var body: some View {
Group {
Text(store.language)
.contextMenu {
ForEach(SpeechSynthesizer.languages, id: \.self) { language in
Button(
action: {
self.store.language = language
self.store.voiceName = "Select voice"
},
label: { Text(language) }
)
}
}
Text(store.voiceName)
.contextMenu {
ForEach(SpeechSynthesizer.getVoices(language: store.language), id: \.id) { voice in
Button(
action: {
self.store.voiceName = voice.name
SpeechSynthesizer.speak(isVoiceEnabled: true)
},
label: {
Text("\(voice.name) \(voice.premium ? "(premium)" : "")")
}
)
}
MenuButton(store.language) {
ForEach(SpeechSynthesizer.languages, id: \.self) { language in
Button(
action: {
self.store.language = language
self.store.voiceName = "Select voice"
},
label: { Text(language) }
)
}.fixedSize()
}
.menuButtonStyle(BorderlessButtonMenuButtonStyle())
.fixedSize()

MenuButton(store.voiceName) {
ForEach(SpeechSynthesizer.getVoices(language: store.language), id: \.id) { voice in
Button(
action: {
self.store.voiceName = voice.name
SpeechSynthesizer.speak(isVoiceEnabled: true)
},
label: {
Text("\(voice.name) \(voice.premium ? "(premium)" : "")")
}
)
}
}
.menuButtonStyle(BorderlessButtonMenuButtonStyle())
.fixedSize()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ReaderTranslatorMac/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.8.11</string>
<string>1.8.12</string>
<key>CFBundleVersion</key>
<string>1800</string>
<key>LSApplicationCategoryType</key>
Expand Down

0 comments on commit db168e0

Please sign in to comment.