summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTuomas Tuononen <tuomas.tuononen@code-q.fi>2015-11-25 13:18:21 +0200
committerTuomas Tuononen <tuomas.tuononen@code-q.fi>2016-04-05 20:18:21 +0000
commit71a3cbebefd2b05acf0536b30a14aa51a8565b4d (patch)
tree702851527b9258d406ef663d16c2e5970f3fec71
parenta99d17fa754ea25f2729c934788a1693401657d0 (diff)
Improvements for the TTS example application
- Remove double initialization of the default engine on startup - Preserve volume, pitch and speech rate when the engine changes - Enable QTextToSpeech log output Change-Id: I87e197315570c65e2dee9c66fde7eabd729f93f2 Reviewed-by: Jeremy Whiting <jpwhiting@kde.org> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
-rw-r--r--examples/speech/hello_speak/mainwindow.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/speech/hello_speak/mainwindow.cpp b/examples/speech/hello_speak/mainwindow.cpp
index 31e2498..d22d931 100644
--- a/examples/speech/hello_speak/mainwindow.cpp
+++ b/examples/speech/hello_speak/mainwindow.cpp
@@ -41,12 +41,14 @@
#include "mainwindow.h"
+#include <QLoggingCategory>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
- m_speech(new QTextToSpeech(this))
+ m_speech(0)
{
ui.setupUi(this);
+ QLoggingCategory::setFilterRules(QStringLiteral("qt.speech.tts=true \n qt.speech.tts.*=true"));
// Populate engine selection list
ui.engine->addItem("Default", QString("default"));
@@ -118,6 +120,9 @@ void MainWindow::engineSelected(int index)
if (locale.name() == current.name())
current = locale;
}
+ setRate(ui.volume->value());
+ setPitch(ui.pitch->value());
+ m_speech->setVolume(ui.volume->value());
connect(ui.stopButton, &QPushButton::clicked, m_speech, &QTextToSpeech::stop);
connect(ui.pauseButton, &QPushButton::clicked, m_speech, &QTextToSpeech::pause);
connect(ui.resumeButton, &QPushButton::clicked, m_speech, &QTextToSpeech::resume);