Work around startup UI freeze caused by QtTextToSpeech
This merge request works around an annoying startup hang that I introduced when adding text-to-speech to NeoChat. The previous implementation was a QML singleton that used the `TextToSpeech` QML component. Unfortunately that component blocks the UI thread when first loading it, while it connects to speech-dispatcher. This MR just rewrites that singleton in C++, and moves initialization of QtTextToSpeech to the first time you read a message aloud. It doesn't fix the performance problem, but it at least stops it from affecting startup. In the future, I'd like to move speech operations to a background thread to completely mitigate the initialization freeze.
This commit is contained in:
@@ -94,7 +94,7 @@ DelegateContextMenu {
|
||||
text: i18nc("@action:inmenu", "Read Text Aloud")
|
||||
icon.name: "audio-speakers-symbolic"
|
||||
onTriggered: {
|
||||
TextToSpeechWrapper.say(i18nc("@info text-to-speech %1 is author %2 is message text", "%1 said %2", root.author.displayName, root.plainText))
|
||||
TextToSpeechHelper.speak(i18nc("@info text-to-speech %1 is author %2 is message text", "%1 said %2", root.author.displayName, root.plainText))
|
||||
}
|
||||
}
|
||||
Kirigami.Action {
|
||||
|
||||
Reference in New Issue
Block a user