Skip to content

Commit

Permalink
Fix Languages
Browse files Browse the repository at this point in the history
  • Loading branch information
niqt committed Aug 22, 2013
1 parent dcb402f commit d458346
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion qgooglespeech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

QGoogleSpeech::QGoogleSpeech(QString language)
{
m_url = "http://translate.google.com/translate_tts?ie=UTF-8&tl=%1&q=%2";

m_language = language;

m_playlist = new QMediaPlaylist;
Expand All @@ -27,7 +29,9 @@ void QGoogleSpeech::setLanguage(QString language)
void QGoogleSpeech::speech(QString text)
{
if (QMultimedia::Available == 0) {
m_playlist->addMedia(QUrl("http://translate.google.com/translate_tts?ie=UTF-8&tl=it&q=" + text));
QString i;
text.replace(" ","+");
m_playlist->addMedia(QUrl(m_url.arg(i).arg(m_language).arg(text)));
m_player->setPlaylist(m_playlist);
m_player->play();
} else {
Expand Down
1 change: 1 addition & 0 deletions qgooglespeech.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class QGOOGLESPEECHSHARED_EXPORT QGoogleSpeech: QObject
QString m_language;
QMediaPlaylist *m_playlist;
QMediaPlayer *m_player;
QString m_url;
public:
QGoogleSpeech(QString language);
void setLanguage(QString language);
Expand Down
2 changes: 1 addition & 1 deletion qgooglespeech.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 2.7.2, 2013-08-22T14:03:00. -->
<!-- Written by QtCreator 2.7.2, 2013-08-22T14:52:02. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
Expand Down

0 comments on commit d458346

Please sign in to comment.