summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-04-07 17:03:13 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-04-13 06:45:03 +0000
commitabfec2fe8adc6978457733d1e844709ef202a793 (patch)
tree77d62e7ba829d0999f82924061c7232774b3cfda
parent5c209ef946ea5edf9f173879419651dc694ba551 (diff)
Revert "Add engine parameters in QTextToSpeech constructor"
Having string based parameter passing is not Qt style, let's add getters and setters as needed. This reverts commit ca8768b90c07bff5804b1fbb704041a4472f65e9. Change-Id: Iff8edec13ac27371a116ed17f66cf90ab3a8f257 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
-rw-r--r--examples/speech/hello_speak/mainwindow.cpp2
-rw-r--r--src/tts/qtexttospeech.cpp15
-rw-r--r--src/tts/qtexttospeech.h2
-rw-r--r--src/tts/qtexttospeech_p.h2
4 files changed, 10 insertions, 11 deletions
diff --git a/examples/speech/hello_speak/mainwindow.cpp b/examples/speech/hello_speak/mainwindow.cpp
index 9f25d37..f78e4f9 100644
--- a/examples/speech/hello_speak/mainwindow.cpp
+++ b/examples/speech/hello_speak/mainwindow.cpp
@@ -105,7 +105,7 @@ void MainWindow::engineSelected(int index)
if (engineName == "default")
m_speech = new QTextToSpeech(this);
else
- m_speech = new QTextToSpeech(engineName, QVariantMap(), this);
+ m_speech = new QTextToSpeech(engineName, this);
disconnect(ui.language, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MainWindow::languageSelected);
ui.language->clear();
// Populate the languages combobox before connecting its signal.
diff --git a/src/tts/qtexttospeech.cpp b/src/tts/qtexttospeech.cpp
index 0fe752e..0985db1 100644
--- a/src/tts/qtexttospeech.cpp
+++ b/src/tts/qtexttospeech.cpp
@@ -53,7 +53,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
QMutex QTextToSpeechPrivate::m_mutex;
-QTextToSpeechPrivate::QTextToSpeechPrivate(QTextToSpeech *speech, const QString &engine, const QVariantMap &parameters)
+QTextToSpeechPrivate::QTextToSpeechPrivate(QTextToSpeech *speech, const QString &engine)
: m_engine(0),
m_speech(speech),
m_providerName(engine),
@@ -74,9 +74,10 @@ QTextToSpeechPrivate::QTextToSpeechPrivate(QTextToSpeech *speech, const QString
loadPlugin();
if (m_plugin) {
QString errorString;
- m_engine = m_plugin->createTextToSpeechEngine(parameters, 0, &errorString);
+ m_engine = m_plugin->createTextToSpeechEngine(QVariantMap(), 0, &errorString);
if (!m_engine) {
- qCritical() << "Error creating text-to-speech engine" << m_providerName << errorString;
+ qCritical() << "Error creating text-to-speech engine" << m_providerName
+ << (errorString.isEmpty() ? QStringLiteral("") : (QStringLiteral(": ") + errorString));
}
} else {
qCritical() << "Error loading text-to-speech plug-in" << m_providerName;
@@ -198,7 +199,7 @@ void QTextToSpeechPrivate::loadPluginMetadata(QHash<QString, QJsonObject> &list)
\sa availableEngines()
*/
QTextToSpeech::QTextToSpeech(QObject *parent)
- : QObject(*new QTextToSpeechPrivate(this, QString(), QVariantMap()), parent)
+ : QObject(*new QTextToSpeechPrivate(this, QString()), parent)
{
Q_D(QTextToSpeech);
// Connect state change signal directly from the engine to the public API signal
@@ -213,14 +214,12 @@ QTextToSpeech::QTextToSpeech(QObject *parent)
If \a engine is empty, the default engine plug-in is used. The default
engine may be platform-specific.
- The method optionally accepts \a parameters that may be engine-specific.
-
If loading the plug-in fails, QTextToSpeech::state() will return QTextToSpeech::BackendError.
\sa availableEngines()
*/
-QTextToSpeech::QTextToSpeech(const QString &engine, const QVariantMap &parameters, QObject *parent)
- : QObject(*new QTextToSpeechPrivate(this, engine, parameters), parent)
+QTextToSpeech::QTextToSpeech(const QString &engine, QObject *parent)
+ : QObject(*new QTextToSpeechPrivate(this, engine), parent)
{
Q_D(QTextToSpeech);
// Connect state change signal directly from the engine to the public API signal
diff --git a/src/tts/qtexttospeech.h b/src/tts/qtexttospeech.h
index bd35c8f..ee88992 100644
--- a/src/tts/qtexttospeech.h
+++ b/src/tts/qtexttospeech.h
@@ -71,7 +71,7 @@ public:
};
explicit QTextToSpeech(QObject *parent = Q_NULLPTR);
- explicit QTextToSpeech(const QString &engine, const QVariantMap &parameters = QVariantMap(), QObject *parent = Q_NULLPTR);
+ explicit QTextToSpeech(const QString &engine, QObject *parent = Q_NULLPTR);
State state() const;
QVector<QLocale> availableLocales() const;
diff --git a/src/tts/qtexttospeech_p.h b/src/tts/qtexttospeech_p.h
index 45c0395..c6e213e 100644
--- a/src/tts/qtexttospeech_p.h
+++ b/src/tts/qtexttospeech_p.h
@@ -61,7 +61,7 @@ class QTextToSpeech;
class QTextToSpeechPrivate : public QObjectPrivate
{
public:
- QTextToSpeechPrivate(QTextToSpeech *speech, const QString &engine, const QVariantMap &parameters);
+ QTextToSpeechPrivate(QTextToSpeech *speech, const QString &engine);
~QTextToSpeechPrivate();
static QHash<QString, QJsonObject> plugins(bool reload = false);