1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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
// TQt includes
#include <tqstring.h>
// KDE includes
#include <kdebug.h>
// App specific includes
#include "kttsdlibtalker2.h"
kttsdlibtalker2::kttsdlibtalker2(TQObject *parent, const char *name)
: TQObject(parent, name), DCOPStub("kttsd", "KSpeech")
{
m_client = NULL;
connectDCOPSignal("kttsd", "KSpeech",
"textStarted(TQCString, uint)",
"textStarted(TQCString, uint)", false);
connectDCOPSignal("kttsd", "KSpeech",
"textFinished(TQCString, uint)",
"textFinished(TQCString, uint)", false);
connectDCOPSignal("kttsd", "KSpeech",
"textStopped(TQCString, uint)",
"textStopped(TQCString, 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")){
TQString error;
if ( Appl->startServiceByDesktopName("kttsd", TQStringList(), &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 TQString &text, TQString 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 TQCString &appID,
const uint jobNum)
{
kdDebug(100200) << "*** kttsdlibtalker2::textStarted()" << endl;
if ( appID != m_objID )
return;
emit signalTextStarted(jobNum);
}
ASYNC kttsdlibtalker2::textFinished(const TQCString &appID,
const uint jobNum)
{
kdDebug(100200) << "*** kttsdlibtalker2::textFinished()" << endl;
if ( appID != m_objID )
return;
emit signalTextFinished(jobNum);
}
ASYNC kttsdlibtalker2::textStopped(const TQCString &appID,
const uint jobNum)
{
kdDebug(100200) << "*** kttsdlibtalker2::textStopped()" << endl;
if ( appID != m_objID )
return;
emit signalTextStopped(jobNum);
}
#include "kttsdlibtalker2.moc"
|