1 /***************************************************************************
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
21 #include <QtCore/QObject>
23 #include <k3process.h>
24 #include <ktemporaryfile.h>
26 /**This class is used internally by TextToSpeechSystem in order to do the actual speaking.
27 *@author Gunnar Schmi Dt
30 class Speech
: public QObject
{
44 * Speaks the given text.
45 * @param command the program that shall be executed for speaking
46 * @param stdin true if the program shall receive its data via standard input
47 * @param text The text that shall be spoken
49 void speak(QString command
, bool use_stdin
, const QString
&text
, const QString
&language
, int encoding
, QTextCodec
*codec
);
52 * Prepares a command for being executed. During the preparation the
53 * command is parsed and occurrences of "%t" are replaced by text.
54 * @param command the command that shall be executed for speaking
55 * @param text the quoted text that can be inserted into the command
57 QString
prepareCommand (QString command
, const QString
&text
,
58 const QString
&filename
, const QString
&language
);
61 void wroteStdin (K3Process
*p
);
62 void processExited (K3Process
*p
);
63 void receivedStdout (K3Process
*proc
, char *buffer
, int buflen
);
64 void receivedStderr (K3Process
*proc
, char *buffer
, int buflen
);
67 K3ShellProcess process
;
69 KTemporaryFile tempFile
;