rbutil: add options to create .talk files only for Folders or only for Files or for...
[Rockbox.git] / rbutil / rbutilqt / talkfile.h
blob1b8d9ca2e235adf22a58565e485e9a67f99ef6bf
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
21 #ifndef TALKFILE_H
22 #define TALKFILE_H
24 #include "progressloggerinterface.h"
26 class TTSBase : public QObject
28 Q_OBJECT
29 public:
30 TTSBase(){}
31 virtual ~TTSBase(){}
32 virtual bool voice(QString text,QString wavfile){(void)text; (void)wavfile; return false;}
33 virtual bool start(){return false;}
34 virtual bool stop(){return false;}
36 void setTTSexe(QString exe){m_TTSexec=exe;}
37 void setTTsOpts(QString opts) {m_TTSOpts=opts;}
38 void setTTsLanguage(QString language) {m_TTSLanguage = language;}
39 void setTTsTemplate(QString t) { m_TTSTemplate = t; }
41 protected:
42 QString m_TTSexec;
43 QString m_TTSOpts;
44 QString m_TTSTemplate;
45 QString m_TTSLanguage;
49 class TalkFileCreator :public QObject
51 Q_OBJECT
53 public:
54 TalkFileCreator(QObject* parent=0);
56 bool createTalkFiles(ProgressloggerInterface* logger);
58 void setTTSexe(QString exe){m_TTSexec=exe;}
59 void setEncexe(QString exe){m_EncExec=exe;}
61 void setTTsType(QString tts) { m_curTTS = tts; }
62 void setTTsOpts(QString opts) {m_TTSOpts=opts;}
63 void setTTsLanguage(QString language) {m_TTSLanguage = language;}
64 void setTTsTemplate(QString t) { m_curTTSTemplate = t; }
66 void setEncType(QString enc) { m_curEnc = enc; }
67 void setEncOpts(QString opts) {m_EncOpts=opts;}
68 void setEncTemplate(QString t) { m_curEncTemplate = t; }
70 void setDir(QString dir){m_dir = dir; }
71 void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
73 void setOverwriteTalk(bool ov) {m_overwriteTalk = ov;}
74 void setOverwriteWav(bool ov) {m_overwriteWav = ov;}
75 void setRemoveWav(bool ov) {m_removeWav = ov;}
76 void setRecursive(bool ov) {m_recursive = ov;}
77 void setStripExtensions(bool ov) {m_stripExtensions = ov;}
78 void setTalkFolders(bool ov) {m_talkFolders = ov;}
79 void setTalkFiles(bool ov) {m_talkFiles = ov;}
81 private slots:
82 void abort();
84 private:
85 TTSBase* m_tts;
86 //bool initTTS();
87 //bool stopTTS();
88 bool initEncoder();
90 bool encode(QString input,QString output);
91 //bool voice(QString text,QString wavfile);
93 QString m_dir;
94 QString m_mountpoint;
95 QString m_curTTS;
96 QString m_TTSexec;
97 QString m_TTSOpts;
98 QString m_TTSLanguage;
99 QString m_curTTSTemplate;
101 QString m_curEnc;
102 QString m_EncExec;
103 QString m_EncOpts;
104 QString m_curEncTemplate;
106 bool m_overwriteTalk;
107 bool m_overwriteWav;
108 bool m_removeWav;
109 bool m_recursive;
110 bool m_stripExtensions;
111 bool m_talkFolders;
112 bool m_talkFiles;
114 ProgressloggerInterface* m_logger;
116 bool m_abort;
119 class TTSSapi : public TTSBase
121 public:
122 TTSSapi() {};
123 virtual bool voice(QString text,QString wavfile);
124 virtual bool start();
125 virtual bool stop();
127 private:
128 QProcess* voicescript;
131 class TTSExes : public TTSBase
133 public:
134 TTSExes() {};
135 virtual bool voice(QString text,QString wavfile);
136 virtual bool start();
137 virtual bool stop() {return true;}
139 private:
143 #endif