summaryrefslogtreecommitdiffstats
path: root/ksayit/KTTSD_Lib
diff options
context:
space:
mode:
Diffstat (limited to 'ksayit/KTTSD_Lib')
-rw-r--r--ksayit/KTTSD_Lib/KTTSDlibSetup.ui121
-rw-r--r--ksayit/KTTSD_Lib/Makefile.am23
-rw-r--r--ksayit/KTTSD_Lib/kdeexportfix.h22
-rw-r--r--ksayit/KTTSD_Lib/kttsdlib.cpp221
-rw-r--r--ksayit/KTTSD_Lib/kttsdlib.h119
-rw-r--r--ksayit/KTTSD_Lib/kttsdlibsetupimpl.cpp76
-rw-r--r--ksayit/KTTSD_Lib/kttsdlibsetupimpl.h46
-rw-r--r--ksayit/KTTSD_Lib/kttsdlibtalker2.cpp166
-rw-r--r--ksayit/KTTSD_Lib/kttsdlibtalker2.h101
9 files changed, 895 insertions, 0 deletions
diff --git a/ksayit/KTTSD_Lib/KTTSDlibSetup.ui b/ksayit/KTTSD_Lib/KTTSDlibSetup.ui
new file mode 100644
index 0000000..8c624e4
--- /dev/null
+++ b/ksayit/KTTSD_Lib/KTTSDlibSetup.ui
@@ -0,0 +1,121 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>KTTSDlibSetup</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KTTSDlibSetup</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>528</width>
+ <height>364</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>KTTSD-Setup</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;p align="center"&gt;If you would like to change the configuration of KTTSD please use the KDE Control Center or click the button below.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>kcm_Button</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Launch Control Center</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>kcm_Button</sender>
+ <signal>clicked()</signal>
+ <receiver>KTTSDlibSetup</receiver>
+ <slot>slotLaunchControlcenter()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot access="protected">slotLaunchControlcenter()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/ksayit/KTTSD_Lib/Makefile.am b/ksayit/KTTSD_Lib/Makefile.am
new file mode 100644
index 0000000..0a26093
--- /dev/null
+++ b/ksayit/KTTSD_Lib/Makefile.am
@@ -0,0 +1,23 @@
+INCLUDES = \
+ $(KTTS_KSPEECH_INCLUDE) \
+ $(all_includes)
+
+METASOURCES = AUTO
+libKTTSD_Lib_la_LDFLAGS = -no-undefined $(all_libraries) -version-info 0:1
+lib_LTLIBRARIES = libKTTSD_Lib.la
+libKTTSD_Lib_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE)
+noinst_HEADERS = kttsdlib.h kttsdlibsetupimpl.h kttsdlibtalker2.h kdeexportfix.h
+
+kspeech_DIR = $(KTTS_KSPEECH_DIR)
+kspeechsink_DIR = $(KTTS_KSPEECH_DIR)
+
+libKTTSD_Lib_la_SOURCES = \
+ kspeech.stub kspeechsink.skel \
+ kttsdlib.cpp \
+ kttsdlibsetupimpl.cpp \
+ KTTSDlibSetup.ui \
+ kttsdlibtalker2.cpp
+AM_CXXFLAGS = -fPIC
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/libKTTSD.pot
diff --git a/ksayit/KTTSD_Lib/kdeexportfix.h b/ksayit/KTTSD_Lib/kdeexportfix.h
new file mode 100644
index 0000000..172dd94
--- /dev/null
+++ b/ksayit/KTTSD_Lib/kdeexportfix.h
@@ -0,0 +1,22 @@
+/***************************************************** vim:set ts=4 sw=4 sts=4:
+ kdelibs < 3.3.2 had a bug in the KDE_EXPORT macro. This file fixes this
+ by undefining it.
+ -------------------
+ Copyright : (C) 2005 by Gary Cramblitt <garycramblitt@comcast.net>
+ -------------------
+ Original author: Gary Cramblitt <garycramblitt@comcast.net>
+ ******************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; version 2 of the License. *
+ * *
+ ***************************************************************************/
+
+#include <kdeversion.h>
+#if KDE_VERSION < KDE_MAKE_VERSION (3,3,2)
+#undef KDE_EXPORT
+#define KDE_EXPORT
+#endif
diff --git a/ksayit/KTTSD_Lib/kttsdlib.cpp b/ksayit/KTTSD_Lib/kttsdlib.cpp
new file mode 100644
index 0000000..224cd21
--- /dev/null
+++ b/ksayit/KTTSD_Lib/kttsdlib.cpp
@@ -0,0 +1,221 @@
+//
+// C++ Implementation: kttsdplugin
+//
+// Description:
+//
+//
+// Author: Robert Vogl <voglrobe@lapislazuli>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+// #include <time.h> // nanosleep
+
+// Qt includes
+#include <qstring.h>
+#include <qstringlist.h>
+
+// KDE includes
+#include <kglobal.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+
+// App specific includes
+#include "kttsdlib.h"
+#include "kttsdlibtalker2.h"
+#include "kttsdlibsetupimpl.h"
+
+
+KTTSDLib::KTTSDLib(QObject *parent, const char *name, KApplication *Appl)
+ : QObject(parent, name), m_Appl(Appl)
+{
+ KGlobal::locale()->insertCatalogue("libKTTSD");
+ m_talker = new kttsdlibtalker2(static_cast<QObject*>(this), "kttsdlibtalker");
+ connect(m_talker, SIGNAL(signalTextFinished(const uint)),
+ this, SLOT(slotTextFinished(const uint)) );
+ connect(m_talker, SIGNAL(signalTextStopped(const uint)),
+ this, SLOT(slotTextStopped(const uint)) );
+ connect(m_talker, SIGNAL(signalTextStarted(const uint)),
+ this, SLOT(slotTextStarted(const uint)) );
+
+ // reset list of currently processed jobs
+ while ( !jobList.empty() ){
+ jobList.pop();
+ }
+
+ // initialize the talker
+ m_talker->KTTSD_init(m_Appl);
+
+ // some presets
+ // m_config = new KSimpleConfig("ksayit_kttsdpluginrc");
+ // m_usersetupimpl = NULL;
+}
+
+
+KTTSDLib::~KTTSDLib()
+{
+ // delete m_config;
+}
+
+
+QString KTTSDLib::getName() const
+{
+ return "KDE KTTSD";
+}
+
+
+QString KTTSDLib::getDescription() const
+{
+ QString str;
+ str = i18n("<qt><big><u>Description:</u></big><br>");
+ str += i18n("This plugin uses the KDE TTS Daemon for speech output.");
+
+ return str;
+}
+
+
+int KTTSDLib::getActions()
+{
+ return ACTIONS::PLAY | ACTIONS::STOP | ACTIONS::PAUSE | ACTIONS::FFWD | ACTIONS::FREV;
+}
+
+
+int KTTSDLib::getStatus() const
+{
+ return TTS::AUDIOFILE;
+}
+
+
+const QWidget* KTTSDLib::getGUI(QFrame *frame)
+{
+ kdDebug(100200) << "KTTSDLib::getGUI()" << endl;
+
+ return new KTTSDlibSetupImpl( frame, "kttsdlibsetup" );
+}
+
+
+void KTTSDLib::reloadConfiguration()
+{
+ kdDebug(100200) << "KTTSDLib::reloadConfiguration()" << endl;
+ // N.A.
+}
+
+
+bool KTTSDLib::saveWasClicked() const
+{
+ kdDebug(100200) << "KTTSDLib::saveWasClicked()" << endl;
+ // N.A.
+
+ return true;
+}
+
+
+void KTTSDLib::setText(const QString &text)
+{
+ kdDebug(100200) << "KTTSDLib::setText()" << endl;
+
+ uint jobNum = m_talker->KTTSD_setText(text, "");
+ jobList.push(jobNum);
+}
+
+
+
+void KTTSDLib::sayText()
+{
+ kdDebug(100200) << "KTTSDLib::sayText()" << endl;
+
+ if( !jobList.empty() ){
+ m_curJobNum = jobList.front();
+ jobList.pop();
+ kdDebug(100200) << " Starting job No.: " << m_curJobNum << endl;
+ m_talker->KTTSD_startText( m_curJobNum );
+ }
+}
+
+
+void KTTSDLib::removeAllJobsFromList()
+{
+ kdDebug(100200) << "KTTSDLib::removeAllJobsFromList()" << endl;
+
+ m_talker->KTTSD_removeText(m_curJobNum);
+
+ while( !jobList.empty() ){
+ uint job = jobList.front();
+ jobList.pop();
+ kdDebug(100200) << "*** removing... " << job << endl;
+ m_talker->KTTSD_removeText( job );
+ }
+}
+
+void KTTSDLib::stop()
+{
+ kdDebug(100200) << "***** KTTSDLib::stop(" << m_curJobNum << ")" << endl;
+ m_talker->KTTSD_stopText(m_curJobNum);
+ removeAllJobsFromList();
+ emit signalFinished();
+}
+
+
+void KTTSDLib::pause()
+{
+ kdDebug(100200) << "void KTTSDLib::pause(" << m_curJobNum << ")" << endl;
+
+ m_talker->KTTSD_pauseText( m_curJobNum );
+}
+
+
+void KTTSDLib::resume()
+{
+ kdDebug(100200) << "void KTTSDLib::resume(" << m_curJobNum << ")" << endl;
+
+ m_talker->KTTSD_resumeText( m_curJobNum );
+}
+
+
+void KTTSDLib::ffwd()
+{
+ kdDebug(100200) << "void KTTSDLib::ffwd(" << m_curJobNum << ")" << endl;
+ m_talker->KTTSD_moveRelTextSentence(1, m_curJobNum);
+}
+
+
+void KTTSDLib::frev()
+{
+ kdDebug(100200) << "void KTTSDLib::frev(" << m_curJobNum << ")" << endl;
+ m_talker->KTTSD_moveRelTextSentence(-1, m_curJobNum);
+}
+
+
+//////////////////////////////////////
+// Signals from the talker
+//////////////////////////////////////
+
+void KTTSDLib::slotTextFinished(const uint job)
+{
+ kdDebug(100200) << "---- KTTSDLib::slotTextFinished(" << job << ")" << endl;
+
+ // check if List is empty. If yes, send signalFinished().
+ if ( jobList.empty() ){
+ kdDebug(100200) << " All jobs processed." << endl;
+ emit signalFinished();
+ } else {
+ sayText();
+ }
+}
+
+void KTTSDLib::slotTextStopped(const uint job)
+{
+ kdDebug(100200) << "---- KTTSDLib::slotTextStopped(" << job << ")" << endl;
+ // removeAllJobsFromList();
+ // emit signalFinished();
+}
+
+
+void KTTSDLib::slotTextStarted(const uint job)
+{
+ kdDebug(100200) << "---- KTTSDLib::slotTextStarted(" << job << ")" << endl;
+ // m_curJobNum = job;
+}
+
+#include "kttsdlib.moc"
diff --git a/ksayit/KTTSD_Lib/kttsdlib.h b/ksayit/KTTSD_Lib/kttsdlib.h
new file mode 100644
index 0000000..6d8de9b
--- /dev/null
+++ b/ksayit/KTTSD_Lib/kttsdlib.h
@@ -0,0 +1,119 @@
+//
+// C++ Interface: kttsdplugin
+//
+// Description:
+//
+//
+// Author: Robert Vogl <voglrobe@lapislazuli>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef KTTSDLIB_H
+#define KTTSDLIB_H
+
+// stl
+#include <queue>
+using namespace std;
+
+// QT includes
+#include <qobject.h>
+#include <qwidget.h>
+#include <qframe.h>
+
+#include <kdemacros.h>
+#include "kdeexportfix.h"
+
+// KDE includes
+#include <kapplication.h>
+
+// App specific includes
+
+
+namespace TTS {
+ enum {AUDIOFILE=1};
+}
+
+namespace ACTIONS {
+ enum {PLAY=1, STOP=2, PAUSE=4, FFWD=8, FREV=16};
+}
+
+
+// forward declarations
+class kttsdlibtalker2;
+
+/**
+@author Robert Vogl
+*/
+class KDE_EXPORT KTTSDLib : public QObject
+{
+Q_OBJECT
+signals:
+ /** Emitted when the plugin has been finished speeking.
+ */
+ void signalFinished();
+
+public slots:
+ /** Called from the talker on textFinished().
+ * \param job The number of the finished job.
+ */
+ void slotTextFinished(const uint job);
+
+ /** Called from the talker on textStopped().
+ * \param job The number of the stopped job.
+ */
+ void slotTextStopped(const uint job);
+
+ /** Called from the talker on textStarted().
+ * \param job The number of the stopped job.
+ */
+ void slotTextStarted(const uint job);
+
+public:
+ KTTSDLib(QObject *parent=0, const char *name=0, KApplication *Appl=0);
+
+ ~KTTSDLib();
+
+ /** Reimplementations from the base class.
+ */
+ QString getName() const;
+
+ QString getDescription() const;
+
+ int getActions();
+
+ const QWidget* getGUI(QFrame *frame);
+
+ void reloadConfiguration();
+
+ bool saveWasClicked() const;
+
+ void setText(const QString &text);
+
+ void sayText();
+
+ int getStatus() const;
+
+ void stop();
+
+ void pause();
+
+ void resume();
+
+ void ffwd();
+
+ void frev();
+
+private slots:
+ void removeAllJobsFromList();
+
+private:
+ KApplication *m_Appl;
+ kttsdlibtalker2 *m_talker;
+ uint m_curJobNum;
+ typedef queue<uint> jobListType;
+ jobListType jobList;
+
+};
+
+#endif
diff --git a/ksayit/KTTSD_Lib/kttsdlibsetupimpl.cpp b/ksayit/KTTSD_Lib/kttsdlibsetupimpl.cpp
new file mode 100644
index 0000000..0c7bc8f
--- /dev/null
+++ b/ksayit/KTTSD_Lib/kttsdlibsetupimpl.cpp
@@ -0,0 +1,76 @@
+//
+// C++ Implementation: kttsdlibsetupimpl
+//
+// Description:
+//
+//
+// Author: Robert Vogl <voglrobe@lapislazuli>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include <stdio.h>
+
+// Qt includes
+#include <qpushbutton.h>
+
+// KDE includes
+#include <kdebug.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+// App specific includes
+#include "kttsdlibsetupimpl.h"
+
+KTTSDlibSetupImpl::KTTSDlibSetupImpl(QWidget *parent, const char *name)
+ : KTTSDlibSetup(parent, name)
+{
+}
+
+
+KTTSDlibSetupImpl::~KTTSDlibSetupImpl()
+{
+}
+
+
+void KTTSDlibSetupImpl::slotLaunchControlcenter()
+{
+ kdDebug(100200) << "KTTSDlibSetupImpl::slotLaunchControlCenter()" << endl;
+
+ // check if controllcenter module for KTTSD exists
+ FILE *fp;
+ char cmdresult[20];
+
+ // if ( (fp = popen("kcmshell --list | grep kcmkttsmgr", "r")) != NULL){
+ if ( (fp = popen("kcmshell --list | grep kcmkttsd", "r")) != NULL){
+ fgets(cmdresult, 18, fp);
+ pclose(fp);
+ }
+ if ( !QCString(cmdresult).contains("kcmkttsd") ){
+ QString error = i18n("Control Center Module for KTTSD not found.");
+ KMessageBox::sorry(this, error, i18n("Problem"));
+ return;
+ }
+
+ // invoke the Control Center Module
+ KProcess *kcmproc = new KProcess();
+ connect(kcmproc, SIGNAL(processExited(KProcess*)),
+ this, SLOT(slotKCMProcessExited(KProcess*)) );
+ (*kcmproc) << "kcmshell";
+ (*kcmproc) << "kcmkttsd";
+ kcmproc->start(KProcess::NotifyOnExit);
+
+ kcm_Button->setEnabled(false);
+}
+
+
+void KTTSDlibSetupImpl::slotKCMProcessExited(KProcess *p)
+{
+ kdDebug(100200) << "slotKCMProcessExited()" << endl;
+ kcm_Button->setEnabled(true);
+}
+
+
+
+#include "kttsdlibsetupimpl.moc"
diff --git a/ksayit/KTTSD_Lib/kttsdlibsetupimpl.h b/ksayit/KTTSD_Lib/kttsdlibsetupimpl.h
new file mode 100644
index 0000000..1fcf585
--- /dev/null
+++ b/ksayit/KTTSD_Lib/kttsdlibsetupimpl.h
@@ -0,0 +1,46 @@
+//
+// C++ Interface: kttsdsetupimpl
+//
+// Description:
+//
+//
+// Author: Robert Vogl <voglrobe@lapislazuli>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef KTTSDSETUPIMPL_H
+#define KTTSDSETUPIMPL_H
+
+// Qt includes
+
+// KDE includes
+#include <kprocess.h>
+
+// App specific includes
+#include "KTTSDlibSetup.h"
+
+/**
+@author Robert Vogl
+*/
+class KTTSDlibSetupImpl : public KTTSDlibSetup
+{
+Q_OBJECT
+public:
+ KTTSDlibSetupImpl(QWidget *parent = 0, const char *name = 0);
+
+ ~KTTSDlibSetupImpl();
+
+protected slots:
+ /** Connected with the button to launch the controlcenter.
+ */
+ void slotLaunchControlcenter();
+
+private slots:
+
+ /** Called when the Control Center Module was closed.
+ */
+ void slotKCMProcessExited(KProcess *p);
+};
+
+#endif
diff --git a/ksayit/KTTSD_Lib/kttsdlibtalker2.cpp b/ksayit/KTTSD_Lib/kttsdlibtalker2.cpp
new file mode 100644
index 0000000..808f8f2
--- /dev/null
+++ b/ksayit/KTTSD_Lib/kttsdlibtalker2.cpp
@@ -0,0 +1,166 @@
+//
+// C++ Implementation: kttsdlibtalker2
+//
+// Description:
+//
+//
+// Author: Robert Vogl <voglrobe@lapislazuli>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include <unistd.h> //sleep
+
+// Qt includes
+#include <qstring.h>
+
+// KDE includes
+#include <kdebug.h>
+
+// App specific includes
+#include "kttsdlibtalker2.h"
+
+kttsdlibtalker2::kttsdlibtalker2(QObject *parent, const char *name)
+ : QObject(parent, name), DCOPStub("kttsd", "KSpeech")
+{
+ m_client = NULL;
+
+ connectDCOPSignal("kttsd", "KSpeech",
+ "textStarted(QCString, uint)",
+ "textStarted(QCString, uint)", false);
+
+ connectDCOPSignal("kttsd", "KSpeech",
+ "textFinished(QCString, uint)",
+ "textFinished(QCString, uint)", false);
+
+ connectDCOPSignal("kttsd", "KSpeech",
+ "textStopped(QCString, uint)",
+ "textStopped(QCString, uint)", false);
+
+}
+
+
+kttsdlibtalker2::~kttsdlibtalker2()
+{
+}
+
+
+void kttsdlibtalker2::KTTSD_init(KApplication *Appl)
+{
+ kdDebug(100200) << "kttsdlibtalker2::KTTSD_init()" << endl;
+
+ m_client = Appl->dcopClient();
+ if ( !m_client->isApplicationRegistered("kttsd")){
+ QString error;
+ if ( Appl->startServiceByDesktopName("kttsd", QStringList(), &error) ){
+ // throw(error);
+ kdDebug() << "Starting KTTSD failed with message " << error << endl;
+ }
+ }
+ m_objID = m_client->appId();
+
+ kdDebug(100200) << " sucessfully registered. objID: " << m_objID << endl;
+}
+
+
+uint kttsdlibtalker2::KTTSD_setText(const QString &text, QString lang)
+{
+ kdDebug(100200) << "kttsdlibtalker2::KTTSD_setText()" << endl;
+ uint jobNum = setText(text, lang);
+ return jobNum;
+}
+
+
+void kttsdlibtalker2::KTTSD_startText(uint jobNum)
+{
+ kdDebug(100200) << "kttsdlibtalker2::KTTSD_startText()" << endl;
+ startText(jobNum);
+}
+
+
+void kttsdlibtalker2::KTTSD_stopText(uint jobNum)
+{
+ kdDebug(100200) << "kttsdlibtalker2::KTTSD_stopText()" << endl;
+ stopText(jobNum);
+}
+
+
+void kttsdlibtalker2::KTTSD_pauseText(uint jobNum)
+{
+ kdDebug(100200) << "kttsdlibtalker2::KTTSD_pauseText()" << endl;
+ pauseText(jobNum);
+}
+
+
+void kttsdlibtalker2::KTTSD_resumeText(uint jobNum)
+{
+ kdDebug(100200) << "kttsdlibtalker2::KTTSD_resumeText()" << endl;
+ resumeText(jobNum);
+}
+
+
+uint kttsdlibtalker2::KTTSD_moveRelTextSentence(const int n, const uint jobNum)
+{
+ kdDebug(100200) << "kttsdlibtalker2::KTTSD_moveRelTextSentence()" << endl;
+ uint seqNum = moveRelTextSentence(n, jobNum);
+ return seqNum;
+}
+
+
+void kttsdlibtalker2::KTTSD_removeText(uint jobNum)
+{
+ kdDebug(100200) << "kttsdlibtalker2::KTTSD_removeText()" << endl;
+ removeText(jobNum);
+}
+
+
+int kttsdlibtalker2::KTTSD_getTextJobState(uint jobNum)
+{
+
+ return 0;
+}
+
+
+int kttsdlibtalker2::KTTSD_getCurrentTextJob()
+{
+
+ return 0;
+}
+
+
+
+////////////////////////////////////////////
+// DCOP signals
+////////////////////////////////////////////
+
+ASYNC kttsdlibtalker2::textStarted(const QCString &appID,
+ const uint jobNum)
+{
+ kdDebug(100200) << "*** kttsdlibtalker2::textStarted()" << endl;
+ if ( appID != m_objID )
+ return;
+ emit signalTextStarted(jobNum);
+}
+
+
+ASYNC kttsdlibtalker2::textFinished(const QCString &appID,
+ const uint jobNum)
+{
+ kdDebug(100200) << "*** kttsdlibtalker2::textFinished()" << endl;
+ if ( appID != m_objID )
+ return;
+ emit signalTextFinished(jobNum);
+}
+
+
+ASYNC kttsdlibtalker2::textStopped(const QCString &appID,
+ const uint jobNum)
+{
+ kdDebug(100200) << "*** kttsdlibtalker2::textStopped()" << endl;
+ if ( appID != m_objID )
+ return;
+ emit signalTextStopped(jobNum);
+}
+
+#include "kttsdlibtalker2.moc"
diff --git a/ksayit/KTTSD_Lib/kttsdlibtalker2.h b/ksayit/KTTSD_Lib/kttsdlibtalker2.h
new file mode 100644
index 0000000..e39f1c8
--- /dev/null
+++ b/ksayit/KTTSD_Lib/kttsdlibtalker2.h
@@ -0,0 +1,101 @@
+//
+// C++ Interface: kttsdlibtalker2
+//
+// Description:
+//
+//
+// Author: Robert Vogl <voglrobe@lapislazuli>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef KTTSDLIBTALKER2_H
+#define KTTSDLIBTALKER2_H
+
+// Qt includes
+#include <qobject.h>
+#include <qcstring.h>
+
+#include <kspeech_stub.h>
+#include <kspeechsink.h>
+
+// KDE includes
+#include <kapplication.h>
+#include <dcopclient.h>
+
+/**
+@author Robert Vogl
+*/
+class kttsdlibtalker2 : public QObject, public KSpeech_stub, virtual public KSpeechSink
+{
+Q_OBJECT
+
+signals:
+ void signalTextStarted(const uint);
+ void signalTextFinished(const uint);
+ void signalTextStopped(const uint);
+
+public:
+ kttsdlibtalker2(QObject *parent = 0, const char *name = 0);
+
+ ~kttsdlibtalker2();
+
+ /** Intializes the DCOP interface.
+ */
+ void KTTSD_init(KApplication *Appl);
+
+ /** See \p KSpeech Class Reference. Returns the job number.
+ */
+ uint KTTSD_setText(const QString &text, QString lang);
+
+ /** See \p KSpeech Class Reference.
+ */
+ void KTTSD_startText(uint jobNum);
+
+ /** See \p KSpeech Class Reference.
+ */
+ void KTTSD_stopText(uint jobNum);
+
+ /** See \p KSpeech Class Reference.
+ */
+ void KTTSD_pauseText(uint jobNum);
+
+ /** See \p KSpeech Class Reference.
+ */
+ void KTTSD_resumeText(uint jobNum);
+
+ /** See \p KSpeech Class Reference.
+ */
+ uint KTTSD_moveRelTextSentence(const int n, const uint jobNum = 0);
+
+ /** See \p KSpeech Class Reference.
+ */
+ int KTTSD_getTextJobState(uint jobNum);
+
+ /** See \p KSpeech Class Reference.
+ */
+ void KTTSD_removeText(uint jobNum);
+
+ /** See \p KSpeech Class Reference.
+ */
+ int KTTSD_getCurrentTextJob();
+
+
+protected:
+ ////////////////////////////////////////////
+ // Slots for DCOP signals
+ ////////////////////////////////////////////
+ ASYNC textStarted(const QCString &appID, const uint jobNum);
+ ASYNC textFinished(const QCString &appID, const uint jobNum);
+ ASYNC textStopped(const QCString &appID, const uint jobNum);
+
+private:
+ QCString m_objID;
+ KApplication *m_Appl;
+ DCOPClient *m_client;
+ uint m_jobNum;
+
+
+};
+
+#endif