diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-04-08 16:41:25 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-05-06 19:43:34 +0000 |
commit | 32a23e3e669bd90576a2ef092f2cf2556a636f23 (patch) | |
tree | 083d13c26d1a3a8ec258d2c641fcdf8a2ebba4b7 /examples/speech/hello_speak/mainwindow.cpp | |
parent | abfec2fe8adc6978457733d1e844709ef202a793 (diff) |
Align volume with qtmultimedia and others: 0.0 to 1.0
Change-Id: I0fe28819d6e7be48ddb587c21435f6be329f8ec5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'examples/speech/hello_speak/mainwindow.cpp')
-rw-r--r-- | examples/speech/hello_speak/mainwindow.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/speech/hello_speak/mainwindow.cpp b/examples/speech/hello_speak/mainwindow.cpp index f78e4f9..58fd99d 100644 --- a/examples/speech/hello_speak/mainwindow.cpp +++ b/examples/speech/hello_speak/mainwindow.cpp @@ -60,6 +60,7 @@ MainWindow::MainWindow(QWidget *parent) connect(ui.speakButton, &QPushButton::clicked, this, &MainWindow::speak); connect(ui.pitch, &QSlider::valueChanged, this, &MainWindow::setPitch); connect(ui.rate, &QSlider::valueChanged, this, &MainWindow::setRate); + connect(ui.volume, &QSlider::valueChanged, this, &MainWindow::setVolume); connect(ui.engine, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MainWindow::engineSelected); } @@ -82,6 +83,11 @@ void MainWindow::setPitch(int pitch) m_speech->setPitch(pitch / 10.0); } +void MainWindow::setVolume(int volume) +{ + m_speech->setVolume(volume / 100.0); +} + void MainWindow::stateChanged(QTextToSpeech::State state) { if (state == QTextToSpeech::Speaking) { @@ -122,11 +128,10 @@ void MainWindow::engineSelected(int index) } setRate(ui.rate->value()); setPitch(ui.pitch->value()); - m_speech->setVolume(ui.volume->value()); + 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); - connect(ui.volume, &QSlider::valueChanged, m_speech, &QTextToSpeech::setVolume); connect(m_speech, &QTextToSpeech::stateChanged, this, &MainWindow::stateChanged); connect(m_speech, &QTextToSpeech::localeChanged, this, &MainWindow::localeChanged); |