summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/speech/CMakeLists.txt3
-rw-r--r--examples/speech/quickspeech/CMakeLists.txt46
-rw-r--r--examples/speech/quickspeech/Main.qml (renamed from examples/speech/quickspeech/main.qml)0
-rw-r--r--examples/speech/quickspeech/doc/src/quickspeech.qdoc2
-rw-r--r--examples/speech/quickspeech/main.cpp18
-rw-r--r--examples/speech/quickspeech/qmldir2
-rw-r--r--examples/speech/quickspeech/quickspeech.pro21
-rw-r--r--examples/speech/speech.pro1
-rw-r--r--src/tts/qtexttospeech.cpp18
9 files changed, 100 insertions, 11 deletions
diff --git a/examples/speech/CMakeLists.txt b/examples/speech/CMakeLists.txt
index 7cb6232..ca9e61c 100644
--- a/examples/speech/CMakeLists.txt
+++ b/examples/speech/CMakeLists.txt
@@ -6,3 +6,6 @@
if(TARGET Qt::Widgets)
qt_internal_add_example(hello_speak)
endif()
+if(TARGET Qt::Quick)
+ qt_internal_add_example(quickspeech)
+endif()
diff --git a/examples/speech/quickspeech/CMakeLists.txt b/examples/speech/quickspeech/CMakeLists.txt
new file mode 100644
index 0000000..4da44cb
--- /dev/null
+++ b/examples/speech/quickspeech/CMakeLists.txt
@@ -0,0 +1,46 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(quickspeech VERSION 0.1 LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/speech/quickspeech")
+
+find_package(Qt6 REQUIRED COMPONENTS Quick TextToSpeech)
+
+qt_standard_project_setup(REQUIRES 6.5)
+
+qt_add_executable(quickspeech
+ main.cpp
+)
+
+qt_add_qml_module(quickspeech
+ URI main
+ VERSION 1.0
+ QML_FILES "Main.qml"
+)
+
+set_target_properties(quickspeech PROPERTIES
+ MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
+ MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
+ MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
+ MACOSX_BUNDLE TRUE
+ WIN32_EXECUTABLE TRUE
+)
+
+target_link_libraries(quickspeech PRIVATE
+ Qt6::Quick
+ Qt6::TextToSpeech
+)
+
+install(TARGETS quickspeech
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/speech/quickspeech/main.qml b/examples/speech/quickspeech/Main.qml
index 3d7b019..3d7b019 100644
--- a/examples/speech/quickspeech/main.qml
+++ b/examples/speech/quickspeech/Main.qml
diff --git a/examples/speech/quickspeech/doc/src/quickspeech.qdoc b/examples/speech/quickspeech/doc/src/quickspeech.qdoc
index c9b6535..25de184 100644
--- a/examples/speech/quickspeech/doc/src/quickspeech.qdoc
+++ b/examples/speech/quickspeech/doc/src/quickspeech.qdoc
@@ -21,7 +21,7 @@
\section1 Initializing a TextToSpeech
First, we initialize the text to speech object \c{tts}:
- \quotefromfile quickspeech/main.qml
+ \quotefromfile quickspeech/Main.qml
\skipto TextToSpeech {
\printuntil rate: rateSlider.value
diff --git a/examples/speech/quickspeech/main.cpp b/examples/speech/quickspeech/main.cpp
new file mode 100644
index 0000000..0aaac65
--- /dev/null
+++ b/examples/speech/quickspeech/main.cpp
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
+ &app, []() { QCoreApplication::exit(-1); },
+ Qt::QueuedConnection);
+ engine.loadFromModule("main", "Main");
+
+ return app.exec();
+}
diff --git a/examples/speech/quickspeech/qmldir b/examples/speech/quickspeech/qmldir
new file mode 100644
index 0000000..1c8f319
--- /dev/null
+++ b/examples/speech/quickspeech/qmldir
@@ -0,0 +1,2 @@
+module main
+Main 1.0 Main.qml
diff --git a/examples/speech/quickspeech/quickspeech.pro b/examples/speech/quickspeech/quickspeech.pro
index 3f53fd7..89f5158 100644
--- a/examples/speech/quickspeech/quickspeech.pro
+++ b/examples/speech/quickspeech/quickspeech.pro
@@ -1 +1,20 @@
-error(This example can be run directly with the qml tool!)
+TEMPLATE = app
+TARGET = quickspeech
+
+QT += quick texttospeech
+
+SOURCES += main.cpp
+
+qml_resources.files = \
+ qmldir \
+ Main.qml
+
+qml_resources.prefix = /qt/qml/main
+
+RESOURCES += qml_resources
+
+target.path = $$[QT_INSTALL_EXAMPLES]/speech/quickspeech
+INSTALLS += target
+
+DISTFILES += \
+ qmldir
diff --git a/examples/speech/speech.pro b/examples/speech/speech.pro
index 2edc74c..93ae172 100644
--- a/examples/speech/speech.pro
+++ b/examples/speech/speech.pro
@@ -1,2 +1,3 @@
TEMPLATE = subdirs
qtHaveModule(widgets): SUBDIRS += hello_speak
+qtHaveModule(quick): SUBDIRS += quickspeech
diff --git a/src/tts/qtexttospeech.cpp b/src/tts/qtexttospeech.cpp
index cd1aae2..f8c9031 100644
--- a/src/tts/qtexttospeech.cpp
+++ b/src/tts/qtexttospeech.cpp
@@ -259,14 +259,14 @@ void QTextToSpeechPrivate::disconnectSynthesizeFunctor()
Use \l say() to start reading text to the default audio device, and
\l stop(), \l pause(), and \l resume() to control the reading of the text.
- \snippet quickspeech/main.qml initialize
+ \snippet quickspeech/Main.qml initialize
\codeline
\dots
\codeline
- \snippet quickspeech/main.qml say0
- \snippet quickspeech/main.qml say1
- \snippet quickspeech/main.qml pause
- \snippet quickspeech/main.qml resume
+ \snippet quickspeech/Main.qml say0
+ \snippet quickspeech/Main.qml say1
+ \snippet quickspeech/Main.qml pause
+ \snippet quickspeech/Main.qml resume
\dots
To synthesize text into PCM data for further processing, use synthesize().
@@ -600,7 +600,7 @@ QStringList QTextToSpeech::availableEngines()
\sa QTextToSpeech::State say() stop() pause()
- \snippet quickspeech/main.qml stateChanged
+ \snippet quickspeech/Main.qml stateChanged
*/
/*!
@@ -653,7 +653,7 @@ QTextToSpeech::State QTextToSpeech::state() const
\l {QTextToSpeech::Capability::}{WordByWordProgress} capability.
The following code highlights the word that is spoken in a TextArea \c input:
- \snippet quickspeech/main.qml sayingWord
+ \snippet quickspeech/Main.qml sayingWord
\sa QTextToSpeech::Capability, say()
*/
@@ -741,8 +741,8 @@ QString QTextToSpeech::errorString() const
This function starts sythesizing the speech asynchronously, and reads the text to the
default audio output device.
- \snippet quickspeech/main.qml say0
- \snippet quickspeech/main.qml say1
+ \snippet quickspeech/Main.qml say0
+ \snippet quickspeech/Main.qml say1
\note All in-progress readings are stopped before beginning to read the recently
synthesized text.