summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-06-10 15:08:11 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-13 05:58:19 +0000
commitf808ac1f47e67efaa64833bdf8522f5298ac8195 (patch)
treec1efe06d4a6ff42a0050cf64a46a411916d295ef
parent6f4b007d9c8b462b8322f126549e56441f58f152 (diff)
Rename iOS engine to Darwin
It's the default engine for both iOS and macOS. Change-Id: I02c9ac77f10ad6faccf32e6ed58399890cfc770c Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> (cherry picked from commit b456b9fd40ef8ecf0c683159f595ffd97d0e0411) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/tts/CMakeLists.txt2
-rw-r--r--src/plugins/tts/darwin/CMakeLists.txt14
-rw-r--r--src/plugins/tts/darwin/darwin_plugin.json (renamed from src/plugins/tts/ios/ios_plugin.json)4
-rw-r--r--src/plugins/tts/darwin/qtexttospeech_darwin.h (renamed from src/plugins/tts/ios/qtexttospeech_ios.h)12
-rw-r--r--src/plugins/tts/darwin/qtexttospeech_darwin.mm (renamed from src/plugins/tts/ios/qtexttospeech_ios.mm)64
-rw-r--r--src/plugins/tts/darwin/qtexttospeech_darwin_plugin.cpp (renamed from src/plugins/tts/ios/qtexttospeech_ios_plugin.cpp)10
-rw-r--r--src/plugins/tts/darwin/qtexttospeech_darwin_plugin.h (renamed from src/plugins/tts/ios/qtexttospeech_ios_plugin.h)10
-rw-r--r--src/plugins/tts/ios/CMakeLists.txt14
-rw-r--r--src/tts/doc/src/qttexttospeech-engines.qdoc6
-rw-r--r--tests/auto/qtexttospeech/tst_qtexttospeech.cpp2
-rw-r--r--tests/auto/qvoice/tst_qvoice.cpp2
11 files changed, 70 insertions, 70 deletions
diff --git a/src/plugins/tts/CMakeLists.txt b/src/plugins/tts/CMakeLists.txt
index d68bdec..3d332c3 100644
--- a/src/plugins/tts/CMakeLists.txt
+++ b/src/plugins/tts/CMakeLists.txt
@@ -12,7 +12,7 @@ if(APPLE)
if(MACOS AND TARGET Qt::Gui)
add_subdirectory(macos)
endif()
- add_subdirectory(ios)
+ add_subdirectory(darwin)
endif()
if(ANDROID)
add_subdirectory(android)
diff --git a/src/plugins/tts/darwin/CMakeLists.txt b/src/plugins/tts/darwin/CMakeLists.txt
new file mode 100644
index 0000000..fcda955
--- /dev/null
+++ b/src/plugins/tts/darwin/CMakeLists.txt
@@ -0,0 +1,14 @@
+qt_internal_find_apple_system_framework(FWAVFoundation AVFoundation)
+
+qt_internal_add_plugin(QTextToSpeechDarwinPlugin
+ OUTPUT_NAME qtexttospeech_speechdarwin
+ PLUGIN_TYPE texttospeech
+ SOURCES
+ qtexttospeech_darwin.h qtexttospeech_darwin.mm
+ qtexttospeech_darwin_plugin.cpp qtexttospeech_darwin_plugin.h
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::TextToSpeech
+ ${FWAVFoundation}
+)
diff --git a/src/plugins/tts/ios/ios_plugin.json b/src/plugins/tts/darwin/darwin_plugin.json
index 34c72ea..2194283 100644
--- a/src/plugins/tts/ios/ios_plugin.json
+++ b/src/plugins/tts/darwin/darwin_plugin.json
@@ -1,6 +1,6 @@
{
- "Keys": ["ios"],
- "Provider": "ios",
+ "Keys": ["darwin"],
+ "Provider": "darwin",
"Version": 100,
"Priority": 100,
"Features": []
diff --git a/src/plugins/tts/ios/qtexttospeech_ios.h b/src/plugins/tts/darwin/qtexttospeech_darwin.h
index 171e3c7..449491e 100644
--- a/src/plugins/tts/ios/qtexttospeech_ios.h
+++ b/src/plugins/tts/darwin/qtexttospeech_darwin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Speech module of the Qt Toolkit.
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QTEXTTOSPEECHENGINE_IOS_H
-#define QTEXTTOSPEECHENGINE_IOS_H
+#ifndef QTEXTTOSPEECHENGINE_DARWIN_H
+#define QTEXTTOSPEECHENGINE_DARWIN_H
#include <QtCore/qlist.h>
#include <QtTextToSpeech/qtexttospeechengine.h>
@@ -46,13 +46,13 @@ Q_FORWARD_DECLARE_OBJC_CLASS(AVSpeechSynthesisVoice);
QT_BEGIN_NAMESPACE
-class QTextToSpeechEngineIos : public QTextToSpeechEngine
+class QTextToSpeechEngineDarwin : public QTextToSpeechEngine
{
Q_OBJECT
public:
- QTextToSpeechEngineIos(const QVariantMap &parameters, QObject *parent);
- ~QTextToSpeechEngineIos();
+ QTextToSpeechEngineDarwin(const QVariantMap &parameters, QObject *parent);
+ ~QTextToSpeechEngineDarwin();
QList<QLocale> availableLocales() const override;
QList<QVoice> availableVoices() const override;
diff --git a/src/plugins/tts/ios/qtexttospeech_ios.mm b/src/plugins/tts/darwin/qtexttospeech_darwin.mm
index 9af43fa..03d3d4e 100644
--- a/src/plugins/tts/ios/qtexttospeech_ios.mm
+++ b/src/plugins/tts/darwin/qtexttospeech_darwin.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Speech module of the Qt Toolkit.
@@ -36,19 +36,19 @@
#include <AVFoundation/AVFoundation.h>
-#include "qtexttospeech_ios.h"
+#include "qtexttospeech_darwin.h"
#include <QtCore/QCoreApplication>
-@interface QIOSSpeechSynthesizerDelegate : NSObject <AVSpeechSynthesizerDelegate>
+@interface QDarwinSpeechSynthesizerDelegate : NSObject <AVSpeechSynthesizerDelegate>
@end
-@implementation QIOSSpeechSynthesizerDelegate
+@implementation QDarwinSpeechSynthesizerDelegate
{
- QTextToSpeechEngineIos *_engine;
+ QTextToSpeechEngineDarwin *_engine;
}
-- (instancetype)initWithQIOSTextToSpeechEngineIos:(QTextToSpeechEngineIos *)engine
+- (instancetype)initWithTextToSpeechEngineDarwin:(QTextToSpeechEngineDarwin *)engine
{
if ((self = [self init]))
_engine = engine;
@@ -109,11 +109,11 @@
QT_BEGIN_NAMESPACE
-QTextToSpeechEngineIos::QTextToSpeechEngineIos(const QVariantMap &/*parameters*/, QObject *parent)
+QTextToSpeechEngineDarwin::QTextToSpeechEngineDarwin(const QVariantMap &/*parameters*/, QObject *parent)
: QTextToSpeechEngine(parent)
, m_speechSynthesizer([AVSpeechSynthesizer new])
{
- m_speechSynthesizer.delegate = [[QIOSSpeechSynthesizerDelegate alloc] initWithQIOSTextToSpeechEngineIos:this];
+ m_speechSynthesizer.delegate = [[QDarwinSpeechSynthesizerDelegate alloc] initWithTextToSpeechEngineDarwin:this];
if (setLocale(QLocale()) || setLocale(QLocale().language())) {
m_state = QTextToSpeech::Ready;
m_errorReason = QTextToSpeech::ErrorReason::NoError;
@@ -123,13 +123,13 @@ QTextToSpeechEngineIos::QTextToSpeechEngineIos(const QVariantMap &/*parameters*/
}
}
-QTextToSpeechEngineIos::~QTextToSpeechEngineIos()
+QTextToSpeechEngineDarwin::~QTextToSpeechEngineDarwin()
{
[m_speechSynthesizer.delegate autorelease];
[m_speechSynthesizer release];
}
-void QTextToSpeechEngineIos::say(const QString &text)
+void QTextToSpeechEngineDarwin::say(const QString &text)
{
stop(QTextToSpeech::BoundaryHint::Default);
@@ -178,7 +178,7 @@ void QTextToSpeechEngineIos::say(const QString &text)
[m_speechSynthesizer speakUtterance:utterance];
}
-void QTextToSpeechEngineIos::stop(QTextToSpeech::BoundaryHint boundaryHint)
+void QTextToSpeechEngineDarwin::stop(QTextToSpeech::BoundaryHint boundaryHint)
{
Q_UNUSED(boundaryHint);
const AVSpeechBoundary atBoundary = (boundaryHint == QTextToSpeech::BoundaryHint::Immediate
@@ -188,7 +188,7 @@ void QTextToSpeechEngineIos::stop(QTextToSpeech::BoundaryHint boundaryHint)
[m_speechSynthesizer stopSpeakingAtBoundary:atBoundary];
}
-void QTextToSpeechEngineIos::pause(QTextToSpeech::BoundaryHint boundaryHint)
+void QTextToSpeechEngineDarwin::pause(QTextToSpeech::BoundaryHint boundaryHint)
{
const AVSpeechBoundary atBoundary = boundaryHint == QTextToSpeech::BoundaryHint::Immediate
? AVSpeechBoundaryImmediate
@@ -196,45 +196,45 @@ void QTextToSpeechEngineIos::pause(QTextToSpeech::BoundaryHint boundaryHint)
[m_speechSynthesizer pauseSpeakingAtBoundary:atBoundary];
}
-void QTextToSpeechEngineIos::resume()
+void QTextToSpeechEngineDarwin::resume()
{
[m_speechSynthesizer continueSpeaking];
}
-bool QTextToSpeechEngineIos::setRate(double rate)
+bool QTextToSpeechEngineDarwin::setRate(double rate)
{
m_rate = rate;
return true;
}
-double QTextToSpeechEngineIos::rate() const
+double QTextToSpeechEngineDarwin::rate() const
{
return m_rate;
}
-bool QTextToSpeechEngineIos::setPitch(double pitch)
+bool QTextToSpeechEngineDarwin::setPitch(double pitch)
{
m_pitch = pitch;
return true;
}
-double QTextToSpeechEngineIos::pitch() const
+double QTextToSpeechEngineDarwin::pitch() const
{
return m_pitch;
}
-bool QTextToSpeechEngineIos::setVolume(double volume)
+bool QTextToSpeechEngineDarwin::setVolume(double volume)
{
m_volume = volume;
return true;
}
-double QTextToSpeechEngineIos::volume() const
+double QTextToSpeechEngineDarwin::volume() const
{
return m_volume;
}
-QList<QLocale> QTextToSpeechEngineIos::availableLocales() const
+QList<QLocale> QTextToSpeechEngineDarwin::availableLocales() const
{
QSet<QLocale> locales;
for (AVSpeechSynthesisVoice *voice in [AVSpeechSynthesisVoice speechVoices]) {
@@ -245,7 +245,7 @@ QList<QLocale> QTextToSpeechEngineIos::availableLocales() const
return locales.values();
}
-bool QTextToSpeechEngineIos::setLocale(const QLocale &locale)
+bool QTextToSpeechEngineDarwin::setLocale(const QLocale &locale)
{
AVSpeechSynthesisVoice *defaultAvVoice = [AVSpeechSynthesisVoice voiceWithLanguage:locale.bcp47Name().toNSString()];
@@ -267,12 +267,12 @@ bool QTextToSpeechEngineIos::setLocale(const QLocale &locale)
return true;
}
-QLocale QTextToSpeechEngineIos::locale() const
+QLocale QTextToSpeechEngineDarwin::locale() const
{
return m_voice.locale();
}
-QList<QVoice> QTextToSpeechEngineIos::availableVoices() const
+QList<QVoice> QTextToSpeechEngineDarwin::availableVoices() const
{
QList<QVoice> voices;
@@ -285,7 +285,7 @@ QList<QVoice> QTextToSpeechEngineIos::availableVoices() const
return voices;
}
-bool QTextToSpeechEngineIos::setVoice(const QVoice &voice)
+bool QTextToSpeechEngineDarwin::setVoice(const QVoice &voice)
{
AVSpeechSynthesisVoice *avVoice = fromQVoice(voice);
if (!avVoice) {
@@ -298,19 +298,19 @@ bool QTextToSpeechEngineIos::setVoice(const QVoice &voice)
return true;
}
-QVoice QTextToSpeechEngineIos::voice() const
+QVoice QTextToSpeechEngineDarwin::voice() const
{
return m_voice;
}
-AVSpeechSynthesisVoice *QTextToSpeechEngineIos::fromQVoice(const QVoice &voice) const
+AVSpeechSynthesisVoice *QTextToSpeechEngineDarwin::fromQVoice(const QVoice &voice) const
{
const QString identifier = voiceData(voice).toString();
AVSpeechSynthesisVoice *avVoice = [AVSpeechSynthesisVoice voiceWithIdentifier:identifier.toNSString()];
return avVoice;
}
-QVoice QTextToSpeechEngineIos::toQVoice(AVSpeechSynthesisVoice *avVoice) const
+QVoice QTextToSpeechEngineDarwin::toQVoice(AVSpeechSynthesisVoice *avVoice) const
{
// only from macOS 10.15 and iOS 13 on
const QVoice::Gender gender = [avVoice]{
@@ -332,7 +332,7 @@ QVoice QTextToSpeechEngineIos::toQVoice(AVSpeechSynthesisVoice *avVoice) const
gender, QVoice::Other, QString::fromNSString(avVoice.identifier));
}
-void QTextToSpeechEngineIos::setState(QTextToSpeech::State state)
+void QTextToSpeechEngineDarwin::setState(QTextToSpeech::State state)
{
if (m_state == state)
return;
@@ -341,12 +341,12 @@ void QTextToSpeechEngineIos::setState(QTextToSpeech::State state)
emit stateChanged(m_state);
}
-QTextToSpeech::State QTextToSpeechEngineIos::state() const
+QTextToSpeech::State QTextToSpeechEngineDarwin::state() const
{
return m_state;
}
-void QTextToSpeechEngineIos::setError(QTextToSpeech::ErrorReason reason, const QString &string)
+void QTextToSpeechEngineDarwin::setError(QTextToSpeech::ErrorReason reason, const QString &string)
{
m_errorReason = reason;
m_errorString = string;
@@ -359,12 +359,12 @@ void QTextToSpeechEngineIos::setError(QTextToSpeech::ErrorReason reason, const Q
emit errorOccurred(m_errorReason, m_errorString);
}
-QTextToSpeech::ErrorReason QTextToSpeechEngineIos::errorReason() const
+QTextToSpeech::ErrorReason QTextToSpeechEngineDarwin::errorReason() const
{
return m_errorReason;
}
-QString QTextToSpeechEngineIos::errorString() const
+QString QTextToSpeechEngineDarwin::errorString() const
{
return m_errorString;
}
diff --git a/src/plugins/tts/ios/qtexttospeech_ios_plugin.cpp b/src/plugins/tts/darwin/qtexttospeech_darwin_plugin.cpp
index 94bb05b..14f5095 100644
--- a/src/plugins/tts/ios/qtexttospeech_ios_plugin.cpp
+++ b/src/plugins/tts/darwin/qtexttospeech_darwin_plugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Speech module of the Qt Toolkit.
@@ -34,11 +34,11 @@
**
****************************************************************************/
-#include "qtexttospeech_ios_plugin.h"
-#include "qtexttospeech_ios.h"
+#include "qtexttospeech_darwin_plugin.h"
+#include "qtexttospeech_darwin.h"
-QTextToSpeechEngine *QTextToSpeechIosPlugin::createTextToSpeechEngine(const QVariantMap &parameters, QObject *parent, QString *errorString) const
+QTextToSpeechEngine *QTextToSpeechDarwinPlugin::createTextToSpeechEngine(const QVariantMap &parameters, QObject *parent, QString *errorString) const
{
Q_UNUSED(errorString);
- return new QTextToSpeechEngineIos(parameters, parent);
+ return new QTextToSpeechEngineDarwin(parameters, parent);
}
diff --git a/src/plugins/tts/ios/qtexttospeech_ios_plugin.h b/src/plugins/tts/darwin/qtexttospeech_darwin_plugin.h
index d67caf7..5501b01 100644
--- a/src/plugins/tts/ios/qtexttospeech_ios_plugin.h
+++ b/src/plugins/tts/darwin/qtexttospeech_darwin_plugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Speech module of the Qt Toolkit.
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QTEXTTOSPEECHPLUGIN_IOS_H
-#define QTEXTTOSPEECHPLUGIN_IOS_H
+#ifndef QTEXTTOSPEECHPLUGIN_DARWIN_H
+#define QTEXTTOSPEECHPLUGIN_DARWIN_H
#include <QtCore/QObject>
#include <QtCore/QLoggingCategory>
@@ -44,12 +44,12 @@
QT_BEGIN_NAMESPACE
-class QTextToSpeechIosPlugin : public QObject, public QTextToSpeechPlugin
+class QTextToSpeechDarwinPlugin : public QObject, public QTextToSpeechPlugin
{
Q_OBJECT
Q_INTERFACES(QTextToSpeechPlugin)
Q_PLUGIN_METADATA(IID "org.qt-project.qt.speech.tts.plugin/6.0"
- FILE "ios_plugin.json")
+ FILE "darwin_plugin.json")
public:
QTextToSpeechEngine *createTextToSpeechEngine(
diff --git a/src/plugins/tts/ios/CMakeLists.txt b/src/plugins/tts/ios/CMakeLists.txt
deleted file mode 100644
index 92280ca..0000000
--- a/src/plugins/tts/ios/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-qt_internal_find_apple_system_framework(FWAVFoundation AVFoundation)
-
-qt_internal_add_plugin(QTextToSpeechIosPlugin
- OUTPUT_NAME qtexttospeech_speechios
- PLUGIN_TYPE texttospeech
- SOURCES
- qtexttospeech_ios.h qtexttospeech_ios.mm
- qtexttospeech_ios_plugin.cpp qtexttospeech_ios_plugin.h
- LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::TextToSpeech
- ${FWAVFoundation}
-)
diff --git a/src/tts/doc/src/qttexttospeech-engines.qdoc b/src/tts/doc/src/qttexttospeech-engines.qdoc
index a45c3aa..bac715f 100644
--- a/src/tts/doc/src/qttexttospeech-engines.qdoc
+++ b/src/tts/doc/src/qttexttospeech-engines.qdoc
@@ -74,14 +74,14 @@
The SAPI engine does not support any engine specific parameters.
- \section1 iOS
+ \section1 Darwin
- The "ios" engine uses the \l{https://developer.apple.com/documentation/avfoundation/speech_synthesis?language=objc}
+ The "darwin" engine uses the \l{https://developer.apple.com/documentation/avfoundation/speech_synthesis?language=objc}
{AVFoundation} framework that is available on iOS devices and on macOS 10.15. The
documentation of the framework states support for macOS 10.14 as well, but by default
no voices are available on that platform.
- The iOS engine does not support any engine specific parameters.
+ The Darwin engine does not support any engine specific parameters.
\section1 macOS
diff --git a/tests/auto/qtexttospeech/tst_qtexttospeech.cpp b/tests/auto/qtexttospeech/tst_qtexttospeech.cpp
index fd49cef..63da8f9 100644
--- a/tests/auto/qtexttospeech/tst_qtexttospeech.cpp
+++ b/tests/auto/qtexttospeech/tst_qtexttospeech.cpp
@@ -123,7 +123,7 @@ void tst_QTextToSpeech::init()
QSKIP("speechd engine reported an error, "
"make sure the speech-dispatcher service is running!");
}
- } else if (engine == "ios"
+ } else if (engine == "darwin"
&& QOperatingSystemVersion::current() <= QOperatingSystemVersion::MacOSMojave) {
QTextToSpeech tts(engine);
if (!tts.availableLocales().count())
diff --git a/tests/auto/qvoice/tst_qvoice.cpp b/tests/auto/qvoice/tst_qvoice.cpp
index f9e56e2..d0c0943 100644
--- a/tests/auto/qvoice/tst_qvoice.cpp
+++ b/tests/auto/qvoice/tst_qvoice.cpp
@@ -74,7 +74,7 @@ void tst_QVoice::init()
QSKIP("speechd engine reported an error, "
"make sure the speech-dispatcher service is running!");
}
- } else if (engine == "ios"
+ } else if (engine == "darwin"
&& QOperatingSystemVersion::current() <= QOperatingSystemVersion::MacOSMojave) {
QTextToSpeech tts(engine);
if (!tts.availableLocales().count())