~neon/kmouth/master

1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
1
/***************************************************************************
2
                          speech.h  -  description
3
                             -------------------
4
    begin                : Son Sep 8 2002
5
    copyright            : (C) 2002 by Gunnar Schmi Dt
6
    email                : kmouth@schmi-dt.de
7
 ***************************************************************************/
8
9
/***************************************************************************
10
 *                                                                         *
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.                                   *
15
 *                                                                         *
16
 ***************************************************************************/
17
18
#ifndef SPEECH_H
19
#define SPEECH_H
20
21
#include <qobject.h>
22
#include <qstring.h>
23
#include <kprocess.h>
24
25
/**This class is used internally by TextToSpeechSystem in order to do the actual speaking.
26
  *@author Gunnar Schmi Dt
27
  */
28
29
class Speech : public QObject {
30
   Q_OBJECT
31
public:
32
   enum CharacterCodec {
33
      Local    = 0,
34
      Latin1   = 1,
35
      Unicode  = 2,
36
      UseCodec = 3
37
   };
38
39
   Speech();
40
   ~Speech();
41
42
   /**
43
    * Speaks the given text.
44
    * @param command the program that shall be executed for speaking
50 by Dirk Mueller
speling fixes
45
    * @param stdin true if the program shall receive its data via standard input
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
46
    * @param text The text that shall be spoken
47
    */
56 by Gunnar Schmidt
Made the speech synthesis multilingual and made the word completion remember typed words
48
   void speak(QString command, bool use_stdin, const QString &text, const QString &language, int encoding, QTextCodec *codec);
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
49
50
   /**
51
    * Prepares a command for being executed. During the preparation the
50 by Dirk Mueller
speling fixes
52
    * command is parsed and occurrences of "%t" are replaced by text.
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
53
    * @param command the command that shall be executed for speaking
54
    * @param text the quoted text that can be inserted into the command
55
    */
56 by Gunnar Schmidt
Made the speech synthesis multilingual and made the word completion remember typed words
56
   QString prepareCommand (QString command, const QString &text, const QString &language);
1 by Gunnar Schmidt
Imported KMouth into kdeaccessibility
57
58
public slots:
59
   void wroteStdin (KProcess *p);
60
   void processExited (KProcess *p);
61
   void receivedStdout (KProcess *proc, char *buffer, int buflen);
62
   void receivedStderr (KProcess *proc, char *buffer, int buflen);
63
64
private:
65
   KShellProcess process;
66
   QByteArray encText;
67
};
68
69
#endif