[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-accessibility
Subject:    qt5-speech patch
From:       Jeremy Whiting <jpwhiting () kde ! org>
Date:       2021-10-31 5:20:25
Message-ID: CADWV2K4G+KFRyU2+k=sNRjZfac=VxrqrMs6qYsBXKKpw803s6g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello all,

The other day it was brought to our attention that QtSpeech is reversing
the order that speech-dispatcher voices show up in in guis that present the
availableVoices() once a locale has been chosen. The problem stems from the
code that inserts all voices into a QMultiMap using the locale as key then
later gives those voices for the current locale using ::values() which
results in a backwards list. Because of this any application that doesn't
explicitly select a voice ends up using the last instead of the first voice
and often ends up using a strange voice by default (when espeak-ng is used
a +grandma variant is often the default this way).

I've attached a patch that applies cleanly to Qt 5.12.7 and 5.15.2 (or .6
if you have it) and will get it into gerrit tomorrow for Qt 6.3 but since
there aren't going to be more Qt 5.12 releases any distro packagers out
there may want to add it to your qt5-speech packages in the near term.

I'll add it to qt5-speech arch package locally to test tomorrow also and
send that to the arch packagers as well as gerrit.

thanks,
Jeremy Whiting

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hello \
all,</div><div class="gmail_default" style="font-family:monospace"><br></div><div \
class="gmail_default" style="font-family:monospace">The other day it was brought to \
our attention that QtSpeech is reversing the order that speech-dispatcher voices show \
up in in guis that present the availableVoices() once a locale has been chosen. The \
problem stems from the code that inserts all voices into a QMultiMap using the locale \
as key then later gives those voices for the current locale using ::values() which \
results in a backwards list. Because of this any application that doesn&#39;t \
explicitly select a voice ends up using the last instead of the first voice and often \
ends up using a strange voice by default (when espeak-ng is used a +grandma variant \
is often the default this way).</div><div class="gmail_default" \
style="font-family:monospace"><br></div><div class="gmail_default" \
style="font-family:monospace">I&#39;ve attached a patch that applies cleanly to Qt \
5.12.7 and 5.15.2 (or .6 if you have it) and will get it into gerrit tomorrow for Qt \
6.3 but since there aren&#39;t going to be more Qt 5.12 releases any distro packagers \
out there may want to add it to your qt5-speech packages in the near term.</div><div \
class="gmail_default" style="font-family:monospace"><br></div><div \
class="gmail_default" style="font-family:monospace">I&#39;ll add it to qt5-speech \
arch package locally to test tomorrow also and send that to the arch packagers as \
well as gerrit.</div><div class="gmail_default" \
style="font-family:monospace"><br></div><div class="gmail_default" \
style="font-family:monospace">thanks,</div><div class="gmail_default" \
style="font-family:monospace">Jeremy Whiting<br></div></div>


["0001-Reverse-list-of-voices-before-returning-from-Speech-.patch" (application/octet-stream)]

From 6ad7b2894b9ab0730f62202c0eefae61bccd1dc9 Mon Sep 17 00:00:00 2001
From: Jeremy Whiting <jpwhiting@kde.org>
Date: Sat, 30 Oct 2021 23:02:26 -0600
Subject: [PATCH] Reverse list of voices before returning from
 Speech-Dispatcher.

Since QMultiMap::values() gives voices in reverse order from the order
inserted (latest first, oldest last) reverse the list before returning
it to users.
---
 src/plugins/tts/speechdispatcher/qtexttospeech_speechd.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/plugins/tts/speechdispatcher/qtexttospeech_speechd.cpp \
b/src/plugins/tts/speechdispatcher/qtexttospeech_speechd.cpp index 5fd3bc2..0d2a36e \
                100644
--- a/src/plugins/tts/speechdispatcher/qtexttospeech_speechd.cpp
+++ b/src/plugins/tts/speechdispatcher/qtexttospeech_speechd.cpp
@@ -357,7 +357,9 @@ QVector<QLocale> QTextToSpeechEngineSpeechd::availableLocales() \
const  
 QVector<QVoice> QTextToSpeechEngineSpeechd::availableVoices() const
 {
-    return m_voices.values(m_currentLocale.name()).toVector();
+    QList<QVoice> resultList = m_voices.values(m_currentLocale.name());
+    std::reverse(resultList.begin(), resultList.end());
+    return resultList.toVector();
 }
 
 // We have no way of knowing our own client_id since speech-dispatcher seems to be \
                incomplete
-- 
2.33.0.windows.2



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic