Hello community, here is the log from the commit of package jovie for openSUSE:Factory checked in at 2013-12-02 12:33:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/jovie (Old) and /work/SRC/openSUSE:Factory/.jovie.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "jovie" Changes: -------- --- /work/SRC/openSUSE:Factory/jovie/jovie.changes 2013-10-03 15:49:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.jovie.new/jovie.changes 2013-12-02 12:34:01.000000000 +0100 @@ -1,0 +2,21 @@ +Sat Nov 16 18:02:41 UTC 2013 - [email protected] + +- Update to 4.11.90 + * KDE 4.12 Beta 2 release + * See http://www.kde.org/announcements/announce-4.12-beta2.php + +------------------------------------------------------------------- +Sat Nov 9 23:03:52 UTC 2013 - [email protected] + +- Update to 4.11.80 + * KDE 4.12 Beta 1 release + * See http://www.kde.org/announcements/announce-4.12-beta1.php + +------------------------------------------------------------------- +Sat Nov 2 15:17:13 UTC 2013 - [email protected] + +- Update to 4.11.3 + * KDE 4.11.3 bugfix release + * See http://www.kde.org/announcements/announce-4.11.3.php + +------------------------------------------------------------------- Old: ---- jovie-4.11.2.tar.xz New: ---- jovie-4.11.90.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ jovie.spec ++++++ --- /var/tmp/diff_new_pack.2CkMe9/_old 2013-12-02 12:34:01.000000000 +0100 +++ /var/tmp/diff_new_pack.2CkMe9/_new 2013-12-02 12:34:01.000000000 +0100 @@ -27,7 +27,7 @@ License: GPL-2.0+ Group: System/GUI/KDE Url: http://www.kde.org -Version: 4.11.2 +Version: 4.11.90 Release: 0 Source0: jovie-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ jovie-4.11.2.tar.xz -> jovie-4.11.90.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/CMakeLists.txt new/jovie-4.11.90/CMakeLists.txt --- old/jovie-4.11.2/CMakeLists.txt 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/CMakeLists.txt 2013-10-29 23:12:30.000000000 +0100 @@ -6,6 +6,11 @@ include (KDE4Defaults) include (MacroLibrary) +find_package( Qt4 REQUIRED QT_USE_QT* ) +include( ${QT_USE_FILE} ) + +enable_testing() + add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) add_definitions( -DQT_NO_CAST_FROM_ASCII ) add_definitions( -DQT_NO_CAST_TO_ASCII ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/doc/index.docbook new/jovie-4.11.90/doc/index.docbook --- old/jovie-4.11.2/doc/index.docbook 2013-08-28 19:09:13.000000000 +0200 +++ new/jovie-4.11.90/doc/index.docbook 2013-10-29 23:12:30.000000000 +0100 @@ -315,7 +315,7 @@ <sect1 id="general"> -<title>Starting Jovie and Setting General Options</title> +<title>Starting &jovie; and Setting General Options</title> <para>Once you have configured at least one talker, you can start the &kde; Text-to-Speech System. Click on the @@ -346,9 +346,9 @@ <para> <calloutlist> <callout arearefs="pt-gen-1"><para>Check this box to activate the &jovie; system. -This starts the &kde; TTS Daemon (Jovie). If Jovie starts successfully, +This starts the &kde; TTS Daemon (&jovie;). If Jovie starts successfully, the <guilabel>Jobs</guilabel> tab will appear. -Once Jovie has been started, you can begin creating and speaking text jobs. +Once &jovie; has been started, you can begin creating and speaking text jobs. See <xref linkend="jobmgr" />. Unchecking will stop Jovie and deactivate the &kde; TTS system. </para></callout> <callout arearefs="pt-gen-6"><para>Be sure to click here to save your settings.</para></callout> @@ -400,7 +400,7 @@ </calloutlist> </para> -<note><para>The <guilabel>Jobs</guilabel> tab only appears when Jovie is running. If you do not see the <guilabel>Jobs</guilabel> tab, click on the +<note><para>The <guilabel>Jobs</guilabel> tab only appears when &jovie; is running. If you do not see the <guilabel>Jobs</guilabel> tab, click on the <guilabel>General</guilabel> tab and check the <guilabel>Enable Text-to-Speech (Jovie)</guilabel> box.</para> </note> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/filters/stringreplacer/CMakeLists.txt new/jovie-4.11.90/filters/stringreplacer/CMakeLists.txt --- old/jovie-4.11.2/filters/stringreplacer/CMakeLists.txt 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/filters/stringreplacer/CMakeLists.txt 2013-10-29 23:12:30.000000000 +0100 @@ -2,7 +2,9 @@ ########### next target ############### -set(jovie_stringreplacerplugin_PART_SRCS stringreplacerconf.cpp stringreplacerproc.cpp stringreplacerplugin.cpp ) +set(jovie_stringreplacerplugin_PART_SRCS + stringreplacerconf.cpp stringreplacerproc.cpp + stringreplacerplugin.cpp cdataescaper.cpp) kde4_add_ui_files(jovie_stringreplacerplugin_PART_SRCS stringreplacerconfwidget.ui editreplacementwidget.ui ) @@ -14,6 +16,18 @@ install(TARGETS jovie_stringreplacerplugin DESTINATION ${PLUGIN_INSTALL_DIR} ) +########### test cdata escaper ########## + +set(test_cdataescaper_SRCS testcdataescaper.cpp cdataescaper.cpp) +kde4_add_unit_test( + test_cdataescaper TESTNAME jovie-cdata_esecaper + ${test_cdataescaper_SRCS} +) +target_link_libraries(test_cdataescaper + ${KDE4_KDECORE_LIBS} + ${QT_QTTEST_LIBRARY} + ${QT_QTCORE_LIBRARY} +) ########### install files ############### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/filters/stringreplacer/cdataescaper.cpp new/jovie-4.11.90/filters/stringreplacer/cdataescaper.cpp --- old/jovie-4.11.2/filters/stringreplacer/cdataescaper.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/jovie-4.11.90/filters/stringreplacer/cdataescaper.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -0,0 +1,19 @@ +#include "cdataescaper.h" +#include <QString> + +static const QLatin1String A0("&"); +static const QLatin1String B0("&"); +static const QLatin1String A1("]]>"); +static const QLatin1String B1("]]>"); + +void cdataEscape(QString* s) +{ + s->replace(A0, B0); + s->replace(A1, B1); +} + +void cdataUnescape(QString* s) +{ + s->replace(B1, A1); + s->replace(B0, A0); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/filters/stringreplacer/cdataescaper.h new/jovie-4.11.90/filters/stringreplacer/cdataescaper.h --- old/jovie-4.11.2/filters/stringreplacer/cdataescaper.h 1970-01-01 01:00:00.000000000 +0100 +++ new/jovie-4.11.90/filters/stringreplacer/cdataescaper.h 2013-10-29 23:12:30.000000000 +0100 @@ -0,0 +1,9 @@ +#ifndef CDATAESCAPER_H +#define CDATAESCAPER_H + +#include <QString> + +void cdataEscape(QString* s); +void cdataUnescape(QString* s); + +#endif // CDATAESCAPER_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/filters/stringreplacer/stringreplacerconf.cpp new/jovie-4.11.90/filters/stringreplacer/stringreplacerconf.cpp --- old/jovie-4.11.2/filters/stringreplacer/stringreplacerconf.cpp 2013-08-28 19:09:13.000000000 +0200 +++ new/jovie-4.11.90/filters/stringreplacer/stringreplacerconf.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -51,6 +51,7 @@ // KTTS includes. #include "selectlanguagedlg.h" #include "filterconf.h" +#include "cdataescaper.h" StringReplacerConf::StringReplacerConf( QWidget *parent, const QVariantList& args ) : KttsFilterConf(parent, args), @@ -209,8 +210,17 @@ QDomElement prop = propNode.toElement(); if (prop.tagName() == QLatin1String( "type" )) wordType = prop.text(); if (prop.tagName() == QLatin1String( "case" )) matchCase = prop.text(); - if (prop.tagName() == QLatin1String( "match" )) match = prop.text(); - if (prop.tagName() == QLatin1String( "subst" )) subst = prop.text(); + if (prop.tagName() == QLatin1String( "match" )) + { + match = prop.text(); + cdataUnescape( &match ); + } + + if (prop.tagName() == QLatin1String( "subst" )) + { + subst = prop.text(); + cdataUnescape( &subst ); + } } QString wordTypeStr = (wordType==QLatin1String( "RegExp" )?i18nc("Abbreviation for 'Regular Expression'", "RegExp"):i18n("Word")); @@ -305,17 +315,22 @@ propTag = doc.createElement( QLatin1String( "case" ) ); wordTag.appendChild( propTag); t = doc.createTextNode( - substLView->item(row, 2)->text()==i18nc("Yes or no", "Yes")?QLatin1String( "Yes" ):QLatin1String( "No" ) ); + substLView->item(row, 1)->text()==i18nc("Yes or no", "Yes")?QLatin1String( "Yes" ):QLatin1String( "No" ) ); propTag.appendChild( t ); propTag = doc.createElement( QLatin1String( "match" ) ); wordTag.appendChild( propTag); - t = doc.createCDATASection( substLView->item(row, 2)->text() ); + QString s = substLView->item(row, 2)->text(); + cdataEscape( &s ); + t = doc.createCDATASection( s ); propTag.appendChild( t ); propTag = doc.createElement( QLatin1String( "subst" ) ); wordTag.appendChild( propTag); - t = doc.createCDATASection( substLView->item(row, 3)->text() ); + s = substLView->item(row, 3)->text(); + cdataEscape( &s ); + t = doc.createCDATASection( s ); + propTag.appendChild( t ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/filters/stringreplacer/stringreplacerproc.cpp new/jovie-4.11.90/filters/stringreplacer/stringreplacerproc.cpp --- old/jovie-4.11.2/filters/stringreplacer/stringreplacerproc.cpp 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/filters/stringreplacer/stringreplacerproc.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -40,6 +40,7 @@ // KTTS includes. #include "filterproc.h" #include "talkercode.h" +#include "cdataescaper.h" /** * Constructor. @@ -129,9 +130,17 @@ QDomNode propNode = propList.item(propIndex); QDomElement prop = propNode.toElement(); if (prop.tagName() == QLatin1String( "type" )) wordType = prop.text(); - if (prop.tagName() == QLatin1String( "case" )) matchCase = prop.text(); - if (prop.tagName() == QLatin1String( "match" )) match = prop.text(); - if (prop.tagName() == QLatin1String( "subst" )) subst = prop.text(); + if (prop.tagName() == QLatin1String( "case" )) matchCase = prop.text(); + if (prop.tagName() == QLatin1String( "match" )) + { + match = prop.text(); + cdataUnescape( &match ); + } + if (prop.tagName() == QLatin1String( "subst" )) + { + subst = prop.text(); + cdataUnescape( &subst ); + } } // Build Regular Expression for each word's match string. QRegExp rx; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/filters/stringreplacer/testcdataescaper.cpp new/jovie-4.11.90/filters/stringreplacer/testcdataescaper.cpp --- old/jovie-4.11.2/filters/stringreplacer/testcdataescaper.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/jovie-4.11.90/filters/stringreplacer/testcdataescaper.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -0,0 +1,35 @@ +#include <QtTest> +#include "testcdataescaper.h" +#include "cdataescaper.h" + +static const QString original( + QString::fromAscii("foo & bar ]]> baz") + ); +static const QString escaped( + QString::fromAscii("foo & bar ]]> baz") + ); + +void TestCDATAEscaper::escape() +{ + QString s(original); + cdataEscape(&s); + QCOMPARE(s, escaped); +} + +void TestCDATAEscaper::unescape() +{ + QString s(escaped); + cdataUnescape(&s); + QCOMPARE(s, original); +} + +void TestCDATAEscaper::roundtrip() +{ + QString s(original); + cdataEscape(&s); + cdataUnescape(&s); + QCOMPARE(s, original); +} + +QTEST_MAIN(TestCDATAEscaper) +#include "testcdataescaper.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/filters/stringreplacer/testcdataescaper.h new/jovie-4.11.90/filters/stringreplacer/testcdataescaper.h --- old/jovie-4.11.2/filters/stringreplacer/testcdataescaper.h 1970-01-01 01:00:00.000000000 +0100 +++ new/jovie-4.11.90/filters/stringreplacer/testcdataescaper.h 2013-10-29 23:12:30.000000000 +0100 @@ -0,0 +1,16 @@ +#ifndef TESTCDATAESCAPER_H +#define TESTCDATAESCAPER_H + +#include <QObject> + +class TestCDATAEscaper : public QObject +{ + Q_OBJECT + +private slots: + void escape(); + void unescape(); + void roundtrip(); +}; + +#endif // TESTCDATAESCAPER_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/jovie/jovie.cpp new/jovie-4.11.90/jovie/jovie.cpp --- old/jovie-4.11.2/jovie/jovie.cpp 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/jovie/jovie.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -48,9 +48,11 @@ // Jovie includes. #include "talkermgr.h" +#include "talkercode.h" // define spd_debug here to avoid a link error in speech-dispatcher 0.6.7's header file for now #define spd_debug spd_debug2 #include "speaker.h" +#include "jovietrayicon.h" #include "kspeechadaptor.h" @@ -60,10 +62,12 @@ { JoviePrivate() { + trayIcon = new JovieTrayIcon(); } ~JoviePrivate() { + delete trayIcon; } friend class Jovie; @@ -73,6 +77,12 @@ * The DBUS sender ID of last application to call KTTSD. */ QString callingAppId; + + /* + * The tray icon. + */ + JovieTrayIcon *trayIcon; + }; /* Jovie Class ========================================================= */ @@ -137,6 +147,16 @@ Speaker::Instance()->getAppData(callingAppId())->setDefaultTalker(defaultTalker); } +void Jovie::setCurrentTalker(const TalkerCode &talker) +{ + Speaker::Instance()->setOutputModule(talker.outputModule()); + Speaker::Instance()->setLanguage(TalkerCode::languageCodeToLanguage(talker.language())); + Speaker::Instance()->setVoiceType(talker.voiceType()); + Speaker::Instance()->setVolume(talker.volume()); + Speaker::Instance()->setSpeed(talker.rate()); + Speaker::Instance()->setPitch(talker.pitch()); +} + int Jovie::defaultPriority() { return Speaker::Instance()->getAppData(callingAppId())->defaultPriority(); @@ -264,6 +284,11 @@ return Speaker::Instance()->languagesByModule(module); } +QStringList Jovie::getPossibleTalkers() +{ + return Speaker::Instance()->getPossibleTalkers(); +} + void Jovie::setSpeed(int speed) { if (speed < -100 || speed > 100) { @@ -482,6 +507,8 @@ if (ready()) { QDBusConnection::sessionBus().registerObject(QLatin1String( "/KSpeech" ), this, QDBusConnection::ExportAdaptors); } + + d->trayIcon->slotUpdateTalkersMenu(); } void Jovie::setCallingAppId(const QString& appId) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/jovie/jovie.h new/jovie-4.11.90/jovie/jovie.h --- old/jovie-4.11.2/jovie/jovie.h 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/jovie/jovie.h 2013-10-29 23:12:30.000000000 +0100 @@ -36,6 +36,7 @@ #include <kspeech.h> class JoviePrivate; +class TalkerCode; /** * Jovie -- the KDE Text-to-Speech API. @@ -102,6 +103,12 @@ void setDefaultTalker(const QString &defaultTalker); /** + * Sets the current talker for all applications. + * @param talker TalkerCode representing wanted options + */ + void setCurrentTalker(const TalkerCode &talker); + + /** * Returns the default priority for speech jobs submitted by the application. * @return Default job priority. * @@ -278,7 +285,14 @@ QStringList outputModules(); QStringList languagesByModule(const QString & module); - + + /** + * Get all possible talkers supported by speech-dispatcher configuration + * + * @returns QStringList of talkercodes + */ + QStringList getPossibleTalkers(); + // runtime slots to change the current speech configuration void setSpeed(int speed); int speed(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/jovie/jovietrayicon.cpp new/jovie-4.11.90/jovie/jovietrayicon.cpp --- old/jovie-4.11.2/jovie/jovietrayicon.cpp 2013-09-26 21:25:01.000000000 +0200 +++ new/jovie-4.11.90/jovie/jovietrayicon.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -100,6 +100,11 @@ actSpeakClipboard->setGlobalShortcut(KShortcut()); contextMenu()->addAction (actSpeakClipboard); + talkersMenu = new QMenu(i18n("Select Talker")); + contextMenu()->addMenu(talkersMenu); + + slotUpdateTalkersMenu(); + actConfigure = KStandardAction::preferences(this, SLOT(configureSelected()), contextMenu()); contextMenu()->addAction(actConfigure); @@ -122,6 +127,28 @@ { } +void JovieTrayIcon::slotUpdateTalkersMenu(){ + talkersMenu->clear(); + + // Object for the KTTSD configuration. + KConfig config(QLatin1String( "kttsdrc" )); + + // Load existing Talkers into Talker List. + TalkerListModel talkerListModel; + talkerListModel.loadTalkerCodesFromConfig(&config); + + TalkerCode::TalkerCodeList list = talkerListModel.datastore(); + + for (int i=0;i<list.size();i++) { + TalkerCode talkerCode=list.at(i); + KAction* act=new KAction(this); + act->setText(talkerCode.name()); + act->setProperty("talkercode",talkerCode.getTalkerCode()); + connect(act,SIGNAL(triggered()),this,SLOT(talkerSelected())); + talkersMenu->addAction(act); + } +} + void JovieTrayIcon::slotActivateRequested(bool active, const QPoint &pos) { Q_UNUSED(active) @@ -148,6 +175,14 @@ Jovie::Instance()->sayClipboard(); } +void JovieTrayIcon::talkerSelected() +{ + KAction* act=(KAction*)QObject::sender (); + TalkerCode talkerCode; + talkerCode.setTalkerCode(act->property("talkercode").toString()); + Jovie::Instance()->setCurrentTalker(talkerCode); +} + void JovieTrayIcon::aboutSelected() { QPointer<KAboutApplicationDialog> aboutDlg = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/jovie/jovietrayicon.h new/jovie-4.11.90/jovie/jovietrayicon.h --- old/jovie-4.11.2/jovie/jovietrayicon.h 2013-09-26 21:25:01.000000000 +0200 +++ new/jovie-4.11.90/jovie/jovietrayicon.h 2013-10-29 23:12:30.000000000 +0100 @@ -29,7 +29,8 @@ // KDE includes. #include <kmenu.h> #include <kstatusnotifieritem.h> - +#include "talkercode.h" +#include "talkerlistmodel.h" class QEvent; class KAction; @@ -44,6 +45,7 @@ protected Q_SLOTS: void slotActivateRequested(bool active, const QPoint &pos); virtual void contextMenuAboutToShow(); + void slotUpdateTalkersMenu(); private slots: @@ -56,16 +58,17 @@ void configureKeysSelected(); void aboutSelected(); void helpSelected(); - + void talkerSelected(); private: void setupIcons(); - KAction* actStop; KAction* actPause; KAction* actResume; KAction* actRepeat; KAction* actSpeakClipboard; KAction* actConfigure; + QMenu* talkersMenu; + friend class Jovie; }; #endif // _JOVIETRAYICON_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/jovie/main.cpp new/jovie-4.11.90/jovie/main.cpp --- old/jovie-4.11.2/jovie/main.cpp 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/jovie/main.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -35,7 +35,6 @@ // KTTSD includes. #include "jovie.h" -#include "jovietrayicon.h" int main (int argc, char *argv[]){ KAboutData aboutdata("jovie", 0, ki18n("Jovie"), @@ -47,6 +46,7 @@ aboutdata.addAuthor(ki18n("Gunnar Schmi Dt"), ki18n("Contributor"),"[email protected]"); aboutdata.addAuthor(ki18n("Olaf Schmidt"), ki18n("Contributor"),"[email protected]"); aboutdata.addAuthor(ki18n("Paul Giannaros"), ki18n("Contributor"), "[email protected]"); + aboutdata.addAuthor(ki18n("Simion Ploscariu"), ki18n("Contributor"), "[email protected]"); aboutdata.addCredit(ki18n("Jorge Luis Arzola"), ki18n("Testing"), "[email protected]"); aboutdata.addCredit(ki18n("David Powell"), ki18n("Testing"), "[email protected]"); aboutdata.setProgramIconName(QLatin1String( "preferences-desktop-text-to-speech" )); @@ -83,8 +83,6 @@ Jovie* service = Jovie::Instance(); service->init(); - JovieTrayIcon* tray = new JovieTrayIcon(); - // kDebug() << "Entering event loop."; return app.exec(); delete service; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/jovie/speaker.cpp new/jovie-4.11.90/jovie/speaker.cpp --- old/jovie-4.11.2/jovie/speaker.cpp 2013-09-26 21:25:01.000000000 +0200 +++ new/jovie-4.11.90/jovie/speaker.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -329,11 +329,6 @@ return (root.tagName() == QLatin1String( "speak" )); } -QStringList Speaker::moduleNames() -{ - return d->outputModules; -} - QStringList Speaker::parseText(const QString &text, const QString &appId /*=NULL*/) { // There has to be a better way @@ -409,7 +404,15 @@ kDebug() << "Changing language from " << d->currentTalker.getTranslatedDescription() << " to " << talkerCode.getTranslatedDescription(); setOutputModule(talkerCode.outputModule()); - setLanguage(TalkerCode::languageCodeToLanguage(talkerCode.language())); + // If there's a voiceName, use it, otherwise just use the language + if (!talkerCode.voiceName().isEmpty()) + { + setVoiceName(talkerCode.voiceName()); + } + else + { + setLanguage(TalkerCode::languageCodeToLanguage(talkerCode.language())); + } setVoiceType(talkerCode.voiceType()); setVolume(talkerCode.volume()); setSpeed(talkerCode.rate()); @@ -497,20 +500,7 @@ QStringList Speaker::outputModules() { - QStringList modules; - - if (d->connection) { - char ** modulenames = spd_list_modules(d->connection); - while (modulenames != NULL && modulenames[0] != NULL) - { - modules << QLatin1String( modulenames[0] ); - ++modulenames; - } - } - else { - // emit some error message - } - return modules; + return d->outputModules; } QStringList Speaker::languagesByModule(const QString & module) @@ -530,6 +520,32 @@ return languages; } +QStringList Speaker::getPossibleTalkers() +{ + QStringList talkers; + + foreach (const QString &module, d->outputModules) + { + if (d->connection && + spd_set_output_module(d->connection, module.toUtf8().data()) == 0) + { + SPDVoice ** voices = spd_list_synthesis_voices(d->connection); + kDebug() << "Got voices for output module " << module; + while (voices != NULL && voices[0] != NULL) + { + TalkerCode code; + code.setOutputModule(module); + code.setVoiceName(QLatin1String(voices[0]->name)); + code.setLanguage(QLatin1String(voices[0]->language)); + talkers.append (code.getTalkerCode()); + ++voices; + } + } + } + + return talkers; +} + void Speaker::setSpeed(int speed) { if (d->connection) { @@ -583,6 +599,19 @@ return d->currentTalker.outputModule(); } +void Speaker::setVoiceName(const QString & voiceName) +{ + if (d->connection) { + int result = spd_set_synthesis_voice(d->connection, voiceName.toUtf8().data()); + d->currentTalker.setVoiceName(voiceName); + } +} + +QString Speaker::voiceName() +{ + return d->currentTalker.voiceName(); +} + void Speaker::setLanguage(const QString & language) { if (d->connection) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/jovie/speaker.h new/jovie-4.11.90/jovie/speaker.h --- old/jovie-4.11.2/jovie/speaker.h 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/jovie/speaker.h 2013-10-29 23:12:30.000000000 +0100 @@ -184,12 +184,10 @@ * Get the output modules available from speech-dispatcher */ QStringList outputModules(); - - /** - * Get the languages available for the given output module - */ QStringList languagesByModule(const QString & module); + QStringList getPossibleTalkers(); + void setSpeed(int speed); void setPitch(int pitch); void setVolume(int volume); @@ -197,6 +195,7 @@ void setOutputModule(const QString & module); void setLanguage(const QString & language); void setVoiceType(int voiceType); + void setVoiceName(const QString & voiceName); int speed(); int pitch(); @@ -204,6 +203,7 @@ QString outputModule(); QString language(); int voiceType(); + QString voiceName(); signals: /** @@ -224,11 +224,6 @@ Speaker(); /** - * get the list of available modules that are configured in speech-dispatcher - */ - QStringList moduleNames(); - - /** * Determines whether the given text is SSML markup. */ bool isSsml(const QString &text); @@ -243,7 +238,7 @@ QStringList parseText(const QString &text, const QString &appId); private: - SpeakerPrivate* d; + SpeakerPrivate* const d; static Speaker * m_instance; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/kcmkttsmgr/talkerwidget.cpp new/jovie-4.11.90/kcmkttsmgr/talkerwidget.cpp --- old/jovie-4.11.2/kcmkttsmgr/talkerwidget.cpp 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/kcmkttsmgr/talkerwidget.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -40,6 +40,7 @@ const int kLanguageColumn = 0; const int kSynthesizerColumn = 1; +const int kVoiceNameColumn = 2; TalkerWidget::TalkerWidget(QWidget* parent) : QWidget(parent) @@ -72,30 +73,35 @@ QTableWidgetItem * defaultItem = 0; - foreach (const QString & module, m_outputModules) + QStringList possibleTalkers = kspeech->getPossibleTalkers(); + foreach (const QString & talkerString, possibleTalkers) { - QStringList languages = kspeech->languagesByModule(module); + TalkerCode code(talkerString); + kDebug() << "Adding talker to talker widget with value " << talkerString; - foreach (const QString & language, languages) - { - int rowcount = mUi->AvailableTalkersTable->rowCount(); - mUi->AvailableTalkersTable->setRowCount(rowcount + 1); + int rowcount = mUi->AvailableTalkersTable->rowCount(); + mUi->AvailableTalkersTable->setRowCount(rowcount + 1); - // set the synthesizer item - QTableWidgetItem * item = new QTableWidgetItem(module); - mUi->AvailableTalkersTable->setItem(rowcount, kSynthesizerColumn, item); - - QString langName = TalkerCode::languageCodeToLanguage(language); - if (language == languageCode) - { - defaultItem = item; - } - - // set the language name item - item = new QTableWidgetItem(langName.isEmpty() ? language : langName); - item->setToolTip(language); - mUi->AvailableTalkersTable->setItem(rowcount, kLanguageColumn, item); + // set the synthesizer item + QTableWidgetItem * item = new QTableWidgetItem(code.outputModule()); + mUi->AvailableTalkersTable->setItem(rowcount, kSynthesizerColumn, item); + + // set the voice name item + item = new QTableWidgetItem(code.voiceName()); + item->setToolTip(code.voiceName()); + mUi->AvailableTalkersTable->setItem(rowcount, kVoiceNameColumn, item); + + QString language = code.language(); + QString langName = TalkerCode::languageCodeToLanguage(language); + if (language == languageCode) + { + defaultItem = item; } + + // set the language name item + item = new QTableWidgetItem(langName.isEmpty() ? language : langName); + item->setToolTip(language); + mUi->AvailableTalkersTable->setItem(rowcount, kLanguageColumn, item); } // turn sorting on now that the table is populated diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/kcmkttsmgr/talkerwidget.ui new/jovie-4.11.90/kcmkttsmgr/talkerwidget.ui --- old/jovie-4.11.2/kcmkttsmgr/talkerwidget.ui 2013-08-28 19:09:13.000000000 +0200 +++ new/jovie-4.11.90/kcmkttsmgr/talkerwidget.ui 2013-10-29 23:12:30.000000000 +0100 @@ -73,6 +73,11 @@ <string>Synthesizer</string> </property> </column> + <column> + <property name="text"> + <string>Voice Name</string> + </property> + </column> </widget> </item> <item row="2" column="0"> @@ -271,9 +276,9 @@ </widget> <customwidgets> <customwidget> - <class>KIntSpinBox</class> - <extends>QSpinBox</extends> - <header>knuminput.h</header> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> </customwidget> <customwidget> <class>KLineEdit</class> @@ -281,9 +286,9 @@ <header>klineedit.h</header> </customwidget> <customwidget> - <class>KComboBox</class> - <extends>QComboBox</extends> - <header>kcombobox.h</header> + <class>KIntSpinBox</class> + <extends>QSpinBox</extends> + <header>knuminput.h</header> </customwidget> </customwidgets> <tabstops> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/libkttsd/talkercode.cpp new/jovie-4.11.90/libkttsd/talkercode.cpp --- old/jovie-4.11.2/libkttsd/talkercode.cpp 2013-09-26 21:25:01.000000000 +0200 +++ new/jovie-4.11.90/libkttsd/talkercode.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -35,10 +35,35 @@ #include <kdebug.h> #include <kservicetypetrader.h> +class TalkerCodePrivate +{ +public: + TalkerCodePrivate(TalkerCode *parent) + :q(parent) + { + } + + ~TalkerCodePrivate() + { + } + + QString name; /* name="xxx" */ + QString language; /* lang="xx" */ + int voiceType; /* voiceType="xxx" */ + int volume; /* volume="xxx" */ + int rate; /* rate="xxx" */ + int pitch; /* pitch="xxx" */ + QString voiceName; /* voiceName="xxx" */ + QString outputModule; /* synthesizer="xxx" */ + + TalkerCode *q; +}; + /** * Constructor. */ TalkerCode::TalkerCode(const QString &code/*=QString()*/, bool normal /*=false*/) +:d(new TalkerCodePrivate(this)) { if (!code.isEmpty()) parseTalkerCode(code); @@ -49,42 +74,122 @@ /** * Copy Constructor. */ -TalkerCode::TalkerCode(TalkerCode* talker, bool normal /*=false*/) +TalkerCode::TalkerCode(const TalkerCode& other) +:d(new TalkerCodePrivate(this)) { - m_name = talker->name(); - m_language = talker->language(); - m_voiceType = talker->voiceType(); - m_volume = talker->volume(); - m_rate = talker->rate(); - m_pitch = talker->pitch(); - m_outputModule = talker->outputModule(); - //if (normal) - // normalize(); + d->name = other.name(); + d->language = other.language(); + d->voiceType = other.voiceType(); + d->volume = other.volume(); + d->rate = other.rate(); + d->pitch = other.pitch(); + d->voiceName = other.voiceName(); + d->outputModule = other.outputModule(); } /** * Destructor. */ -TalkerCode::~TalkerCode() { } +TalkerCode::~TalkerCode() +{ + delete d; +} + +TalkerCode &TalkerCode::operator=(const TalkerCode &other) +{ + d->name = other.name(); + d->language = other.language(); + d->voiceType = other.voiceType(); + d->volume = other.volume(); + d->rate = other.rate(); + d->pitch = other.pitch(); + d->voiceName = other.voiceName(); + d->outputModule = other.outputModule(); + return *this; +} /** * Properties. */ -QString TalkerCode::name() const { return m_name; } -QString TalkerCode::language() const { return m_language; } -int TalkerCode::voiceType() const { return m_voiceType; } -int TalkerCode::volume() const { return m_volume; } -int TalkerCode::rate() const { return m_rate; } -int TalkerCode::pitch() const { return m_pitch; } -QString TalkerCode::outputModule() const { return m_outputModule; } - -void TalkerCode::setName(const QString &name) { m_name = name; } -void TalkerCode::setLanguage(const QString &language) { m_language = language; } -void TalkerCode::setVoiceType(int voiceType) { m_voiceType = voiceType; } -void TalkerCode::setVolume(int volume) { m_volume = volume; } -void TalkerCode::setRate(int rate) { m_rate = rate; } -void TalkerCode::setPitch(int pitch) { m_pitch = pitch; } -void TalkerCode::setOutputModule(const QString &moduleName) { m_outputModule = moduleName; } +QString TalkerCode::name() const +{ + return d->name; +} + +QString TalkerCode::language() const +{ + return d->language; +} + +int TalkerCode::voiceType() const +{ + return d->voiceType; +} + +int TalkerCode::volume() const +{ + return d->volume; +} + +int TalkerCode::rate() const +{ + return d->rate; +} + +int TalkerCode::pitch() const +{ + return d->pitch; +} + +QString TalkerCode::voiceName() const +{ + return d->voiceName; +} + +QString TalkerCode::outputModule() const +{ + return d->outputModule; +} + +void TalkerCode::setName(const QString &name) +{ + d->name = name; +} + +void TalkerCode::setLanguage(const QString &language) +{ + d->language = language; +} + +void TalkerCode::setVoiceType(int voiceType) +{ + d->voiceType = voiceType; +} + +void TalkerCode::setVolume(int volume) +{ + d->volume = volume; +} + +void TalkerCode::setRate(int rate) +{ + d->rate = rate; +} + +void TalkerCode::setPitch(int pitch) +{ + d->pitch = pitch; +} + +void TalkerCode::setVoiceName(const QString &voiceName) +{ + d->voiceName = voiceName; +} + +void TalkerCode::setOutputModule(const QString &moduleName) +{ + d->outputModule = moduleName; +} /** * The Talker Code returned in XML format. @@ -96,8 +201,17 @@ QString TalkerCode::getTalkerCode() const { - QString code = QString(QLatin1String( "<voice name=\"%1\" lang=\"%2\" outputModule=\"%3\" voiceType=\"%4\">" )).arg(m_name).arg(m_language).arg(m_outputModule).arg(m_voiceType); - code += QString(QLatin1String( "<prosody volume=\"%1\" rate=\"%2\" pitch=\"%3\" /></voice>" )).arg(m_volume).arg(m_rate).arg(m_pitch); + QString xml(QLatin1String("<voice name=\"%1\" lang=\"%2\" outputModule=\"%3\"" + " voiceName=\"%4\" voiceType=\"%5\">" + "<prosody volume=\"%6\" rate=\"%7\" pitch=\"%8\" /></voice>")); + QString code = xml.arg(d->name) + .arg(d->language) + .arg(d->outputModule) + .arg(d->voiceName) + .arg(d->voiceType) + .arg(d->volume) + .arg(d->rate) + .arg(d->pitch); return code; } @@ -107,22 +221,22 @@ QString TalkerCode::getTranslatedDescription() const { QString code; - if (!m_name.isEmpty()) + if (!d->name.isEmpty()) { - code = m_name; + code = d->name; } else { - code = m_language; + code = d->language; bool prefer; - QString fullLangCode = m_language; + QString fullLangCode = d->language; if (!fullLangCode.isEmpty()) code = languageCodeToLanguage( fullLangCode ); // TODO: The PlugInName is always English. Need a way to convert this to a translated // name (possibly via DesktopEntryNameToName, but to do that, we need the desktopEntryName // from the config file). - if (!m_outputModule.isEmpty()) code += QLatin1Char( ' ' ) + stripPrefer(m_outputModule, prefer); - code += QLatin1Char(' ') + translatedVoiceType(m_voiceType); - code += QString(QLatin1String(" volume: %1 rate: %2")).arg(m_volume).arg(m_rate); + if (!d->outputModule.isEmpty()) code += QLatin1Char( ' ' ) + stripPrefer(d->outputModule, prefer); + code += QLatin1Char(' ') + translatedVoiceType(d->voiceType); + code += QString(QLatin1String(" volume: %1 rate: %2")).arg(d->volume).arg(d->rate); code = code.trimmed(); } if (code.isEmpty()) @@ -202,27 +316,28 @@ QDomElement voice = doc.firstChildElement(QLatin1String( "voice" )); if (!voice.isNull()) { - m_name = voice.attribute(QLatin1String( "name" )); - m_language = voice.attribute(QLatin1String( "lang" )); - m_outputModule = voice.attribute(QLatin1String( "outputModule" )); + d->name = voice.attribute(QLatin1String( "name" )); + d->language = voice.attribute(QLatin1String( "lang" )); + d->outputModule = voice.attribute(QLatin1String( "outputModule" )); + d->voiceName = voice.attribute(QLatin1String( "voiceName" )); bool result = false; - m_voiceType = voice.attribute(QLatin1String( "voiceType" )).toInt(&result); + d->voiceType = voice.attribute(QLatin1String( "voiceType" )).toInt(&result); if (!result) - m_voiceType = 1; + d->voiceType = 1; QDomElement prosody = voice.firstChildElement(QLatin1String( "prosody" )); if (!prosody.isNull()) { bool result = false; - m_volume = prosody.attribute(QLatin1String( "volume" )).toInt(&result); + d->volume = prosody.attribute(QLatin1String( "volume" )).toInt(&result); if (!result) - m_volume = 0; - m_rate = prosody.attribute(QLatin1String( "rate" )).toInt(&result); + d->volume = 0; + d->rate = prosody.attribute(QLatin1String( "rate" )).toInt(&result); if (!result) - m_rate = 0; - m_pitch = prosody.attribute(QLatin1String( "pitch" )).toInt(&result); + d->rate = 0; + d->pitch = prosody.attribute(QLatin1String( "pitch" )).toInt(&result); if (!result) - m_pitch = 0; + d->pitch = 0; } else { @@ -266,7 +381,7 @@ for (int ndx = 0; ndx < talkersCount; ++ndx) { priorityMatch[ndx] = 0; - // kDebug() << "Comparing language code " << parsedTalkerCode.languageCode() << " to " << m_loadedPlugIns[ndx].parsedTalkerCode.languageCode(); + // kDebug() << "Comparing language code " << parsedTalkerCode.languageCode() << " to " << d->loadedPlugIns[ndx].parsedTalkerCode.languageCode(); } // Determine the maximum number of priority attributes that were matched. int maxPriority = -1; @@ -346,20 +461,22 @@ bool TalkerCode::operator==(TalkerCode &other) const { - return m_language == other.language() && - m_voiceType == other.voiceType() && - m_rate == other.rate() && - m_volume == other.volume() && - m_pitch == other.pitch() && - m_outputModule == other.outputModule(); + return d->language == other.language() && + d->voiceType == other.voiceType() && + d->rate == other.rate() && + d->volume == other.volume() && + d->pitch == other.pitch() && + d->voiceName == other.voiceName() && + d->outputModule == other.outputModule(); } bool TalkerCode::operator!=(TalkerCode &other) const { - return m_language != other.language() || - m_voiceType != other.voiceType() || - m_rate != other.rate() || - m_volume != other.volume() || - m_pitch != other.pitch() || - m_outputModule != other.outputModule(); + return d->language != other.language() || + d->voiceType != other.voiceType() || + d->rate != other.rate() || + d->volume != other.volume() || + d->pitch != other.pitch() || + d->voiceName != other.voiceName() || + d->outputModule != other.outputModule(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/libkttsd/talkercode.h new/jovie-4.11.90/libkttsd/talkercode.h --- old/jovie-4.11.2/libkttsd/talkercode.h 2013-09-26 21:25:01.000000000 +0200 +++ new/jovie-4.11.90/libkttsd/talkercode.h 2013-10-29 23:12:30.000000000 +0100 @@ -33,6 +33,8 @@ // KDE includes. #include <kdemacros.h> +class TalkerCodePrivate; + class KDE_EXPORT TalkerCode { public: @@ -40,16 +42,19 @@ * Constructor. */ explicit TalkerCode(const QString &code=QString(), bool normal=false); + /** * Copy Constructor. */ - explicit TalkerCode(TalkerCode* talker, bool normal=false); + TalkerCode(const TalkerCode& other); /** * Destructor. */ ~TalkerCode(); + TalkerCode &operator=(const TalkerCode &other); + bool operator==(TalkerCode &other) const; bool operator!=(TalkerCode &other) const; @@ -58,12 +63,13 @@ /** * Properties. */ - QString name() const; /* name */ + QString name() const; /* user given name */ QString language() const; /* lang="xx" */ int voiceType() const; /* voiceType="xxx" equivalent to SPDVoiceType enumeration */ int volume() const; /* volume="xxx" */ int rate() const; /* rate="xxx" */ int pitch() const; /* pitch="xxx" */ + QString voiceName() const; /* voice name from synthesizer */ QString outputModule() const; /* synthesizer="xxx" */ /** @@ -77,6 +83,7 @@ void setVolume(int volume); void setRate(int rate); void setPitch(int pitch); + void setVoiceName(const QString &voiceName); void setOutputModule(const QString &moduleName); /** @@ -156,13 +163,7 @@ */ void parseTalkerCode(const QString &talkerCode); - QString m_name; /* name="xxx" */ - QString m_language; /* lang="xx" */ - int m_voiceType; /* voiceType="xxx" */ - int m_volume; /* volume="xxx" */ - int m_rate; /* rate="xxx" */ - int m_pitch; /* pitch="xxx" */ - QString m_outputModule; /* synthesizer="xxx" */ + TalkerCodePrivate * const d; }; #endif // TALKERCODE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jovie-4.11.2/libkttsd/talkerlistmodel.cpp new/jovie-4.11.90/libkttsd/talkerlistmodel.cpp --- old/jovie-4.11.2/libkttsd/talkerlistmodel.cpp 2013-06-28 19:39:54.000000000 +0200 +++ new/jovie-4.11.90/libkttsd/talkerlistmodel.cpp 2013-10-29 23:12:30.000000000 +0100 @@ -156,9 +156,10 @@ TalkerCode TalkerListModel::getRow(int row) const { + TalkerCode code; if (row < 0 || row >= rowCount()) - return TalkerCode(); - return m_talkerCodes[row]; + return code; + return m_talkerCodes.at(row); } bool TalkerListModel::appendRow(TalkerCode& talker) @@ -206,7 +207,7 @@ kDebug() << "TalkerListWidget::loadTalkerCodes: talkerID = " << talkerID; KConfigGroup talkGroup(c, "Talkers"); QString talkerCode = talkGroup.readEntry(talkerID); - TalkerCode tc = TalkerCode(talkerCode, true); + TalkerCode tc(talkerCode, true); kDebug() << "TalkerCodeWidget::loadTalkerCodes: talkerCode = " << talkerCode; //tc.setId(talkerID); appendRow(tc); -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
