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