[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeaccessibility/kmouth
From:       Laurent Montel <montel () kde ! org>
Date:       2006-12-26 14:27:33
Message-ID: 1167143253.075791.3916.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 616704 by mlaurent:

Use interface
(I like to use dbus interface it allows to fix some porting bugs)


 M  +2 -0      CMakeLists.txt  
 M  +9 -6      texttospeechsystem.cpp  


--- trunk/KDE/kdeaccessibility/kmouth/CMakeLists.txt #616703:616704
@@ -45,6 +45,8 @@
    kmouth.cpp 
    main.cpp )
 
+set(kspeech_xml  ${DBUS_INTERFACES_DIR}/org.kde.KSpeech.xml)
+qt4_add_dbus_interface(kmouth_SRCS ${kspeech_xml} kspeech_interface)
 kde4_automoc(${kmouth_SRCS})
 
 kde4_add_ui_files(kmouth_SRCS preferencesui.ui texttospeechconfigurationui.ui )
--- trunk/KDE/kdeaccessibility/kmouth/texttospeechsystem.cpp #616703:616704
@@ -24,6 +24,7 @@
 #include <kconfig.h>
 #include <kspeech.h>
 #include <kdebug.h>
+#include <kspeech_interface.h>
 
 #include "speech.h"
 
@@ -42,14 +43,16 @@
 bool kttsdSay (const QString &text, const QString &language) {
    // TODO: Would be better to save off this QDBusInterface pointer and
    // set defaults only once.
-   QDBusInterface kttsd("org.kde.kttsd", "/KSpeech", "org.kde.KSpeech");
-   kttsd.call("setApplicationName", "KMouth");
-   kttsd.call("setDefaultTalker", language);
+   org::kde::KSpeech kspeech("org.kde.kttsd", "/KSpeech", QDBusConnection::sessionBus());
+   kspeech.setApplicationName("KMouth");
+   kspeech.setDefaultTalker(language);
+
    // FIXME: language is incorrect.
    kDebug() << "kttsdSay: language = " << language << endl;
-   kttsd.call("setDefaultPriority", KSpeech::jpWarning);
-   QDBusReply<bool> reply = kttsd.call("say", text, 0);
-	return reply;
+   kspeech.setDefaultPriority(KSpeech::jpWarning);
+   QDBusReply<int> val = kspeech.say(text, 0);
+   
+   return (val>0);
 }
 
 void TextToSpeechSystem::speak (const QString &text, const QString &language) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic