mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 00:58:32 -04:00
fixed tts playback in Qt5 (translator)
This commit is contained in:
parent
4006bf6e43
commit
1bb112a848
@ -1,6 +1,7 @@
|
||||
#include <QUrl>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QMediaPlayer>
|
||||
#else
|
||||
#include <Phonon/MediaObject>
|
||||
#include <Phonon/MediaSource>
|
||||
@ -163,6 +164,7 @@ YACReaderTranslator::YACReaderTranslator(QWidget * parent)
|
||||
|
||||
//multimedia/phonon
|
||||
#if QT_VERSION >= 0x050000
|
||||
player = new QMediaPlayer;
|
||||
#else
|
||||
music = createPlayer(MusicCategory);
|
||||
#endif
|
||||
@ -291,6 +293,10 @@ void YACReaderTranslator::play()
|
||||
{
|
||||
//QMessageBox::question(this,"xxx",ttsSource.toString());
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
||||
player->setMedia(ttsSource);
|
||||
player->play();
|
||||
|
||||
#else
|
||||
MediaSource src(ttsSource);
|
||||
src.setAutoDelete(true);
|
||||
|
@ -15,6 +15,7 @@ class YACReaderBusyWidget;
|
||||
#include <QUrl>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
class QMediaPlayer;
|
||||
#else
|
||||
#include<Phonon/MediaObject>
|
||||
using namespace Phonon;
|
||||
@ -51,7 +52,7 @@ protected:
|
||||
private:
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
||||
QMediaPlayer *player;
|
||||
#else
|
||||
MediaObject * music;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user