rbutil: Port TTS preview to QT6

Change-Id: Ib4a5b1ef1cd3927792e0022e387b6abc8e5f099e
This commit is contained in:
Solomon Peachy 2026-06-26 21:30:40 -04:00
parent 5462f203d3
commit 02f7dabc67
2 changed files with 11 additions and 5 deletions

View file

@ -55,4 +55,5 @@ Version 1.5.2
* Generate additional talk clips for language name and 'invalid voice file' * Generate additional talk clips for language name and 'invalid voice file'
* When installing development builds, fall back to daily artefacts for non-firmware files * When installing development builds, fall back to daily artefacts for non-firmware files
* Where possible, extract voice corrections file from the actual device * Where possible, extract voice corrections file from the actual device
* Port TTS preview to QT6
* Drop support for Qt5, now requires Qt6. * Drop support for Qt5, now requires Qt6.

View file

@ -20,8 +20,9 @@
#include <QProgressDialog> #include <QProgressDialog>
#include <QFileDialog> #include <QFileDialog>
#include <QUrl> #include <QUrl>
#if defined(QT_MULTIMEDIA_LIB) && (QT_VERSION < 0x060000)
#include <QSound> #if defined(QT_MULTIMEDIA_LIB)
#include <QSoundEffect>
#endif #endif
#include "version.h" #include "version.h"
@ -449,7 +450,7 @@ void Config::updateTtsState(int index)
{ {
ui.configTTSstatus->setText(tr("Configuration OK")); ui.configTTSstatus->setText(tr("Configuration OK"));
ui.configTTSstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/go-next.svg"))); ui.configTTSstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/go-next.svg")));
#if defined(QT_MULTIMEDIA_LIB) && (QT_VERSION < 0x060000) #if defined(QT_MULTIMEDIA_LIB)
ui.testTTS->setEnabled(true); ui.testTTS->setEnabled(true);
#else #else
ui.testTTS->setEnabled(false); ui.testTTS->setEnabled(false);
@ -908,7 +909,7 @@ void Config::configTts()
void Config::testTts() void Config::testTts()
{ {
#if defined(QT_MULTIMEDIA_LIB) && (QT_VERSION < 0x060000) #if defined(QT_MULTIMEDIA_LIB)
QString errstr; QString errstr;
int index = ui.comboTts->currentIndex(); int index = ui.comboTts->currentIndex();
TTSBase* tts; TTSBase* tts;
@ -955,7 +956,11 @@ void Config::testTts()
} }
tts->stop(); tts->stop();
if(!filename.isEmpty()) { if(!filename.isEmpty()) {
QSound::play(filename); QSoundEffect effect;
effect.setSource(QUrl::fromLocalFile(filename));
effect.setLoopCount(0);
effect.setVolume(1.0f);
effect.play();
} }
ui.testTTS->setEnabled(true); ui.testTTS->setEnabled(true);
delete tts; /* Config objects are never deleted (in fact, they are delete tts; /* Config objects are never deleted (in fact, they are