summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2008-01-11 23:59:12 +0000
committerDominik Wenger <domonoky@googlemail.com>2008-01-11 23:59:12 +0000
commit9f686700d47e8fcfa0fec65bfbfcf5d5cde3f752 (patch)
tree02e30405bb8664f1fb912e8c0063ea096663fe25 /rbutil/rbutilqt
parent5be332938d51b75dee8856ad87e2edbe9b8ce3b2 (diff)
downloadrockbox-9f686700d47e8fcfa0fec65bfbfcf5d5cde3f752.tar.gz
rockbox-9f686700d47e8fcfa0fec65bfbfcf5d5cde3f752.zip
rbutil: added creation of voice files with rbutil.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16059 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/createvoicefrm.ui191
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp113
-rw-r--r--rbutil/rbutilqt/createvoicewindow.h56
-rw-r--r--rbutil/rbutilqt/rbutil.ini141
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp16
-rw-r--r--rbutil/rbutilqt/rbutilqt.h1
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro19
-rw-r--r--rbutil/rbutilqt/rbutilqt.qrc3
-rw-r--r--rbutil/rbutilqt/rbutilqtfrm.ui57
-rw-r--r--rbutil/rbutilqt/tts.cpp4
-rw-r--r--rbutil/rbutilqt/voicefile.cpp275
-rw-r--r--rbutil/rbutilqt/voicefile.h84
12 files changed, 871 insertions, 89 deletions
diff --git a/rbutil/rbutilqt/createvoicefrm.ui b/rbutil/rbutilqt/createvoicefrm.ui
new file mode 100644
index 0000000000..8847409f37
--- /dev/null
+++ b/rbutil/rbutilqt/createvoicefrm.ui
@@ -0,0 +1,191 @@
1<ui version="4.0" >
2 <class>CreateVoiceFrm</class>
3 <widget class="QDialog" name="CreateVoiceFrm" >
4 <property name="windowModality" >
5 <enum>Qt::WindowModal</enum>
6 </property>
7 <property name="geometry" >
8 <rect>
9 <x>0</x>
10 <y>0</y>
11 <width>637</width>
12 <height>421</height>
13 </rect>
14 </property>
15 <property name="windowTitle" >
16 <string>Create Voice File</string>
17 </property>
18 <layout class="QGridLayout" >
19 <item rowspan="5" row="0" column="0" >
20 <widget class="QLabel" name="label" >
21 <property name="text" >
22 <string/>
23 </property>
24 <property name="pixmap" >
25 <pixmap resource="rbutilqt.qrc" >:/icons/icons/wizard.xpm</pixmap>
26 </property>
27 <property name="alignment" >
28 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
29 </property>
30 </widget>
31 </item>
32 <item row="0" column="1" colspan="2" >
33 <widget class="QLabel" name="label_2" >
34 <property name="sizePolicy" >
35 <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
36 <horstretch>0</horstretch>
37 <verstretch>0</verstretch>
38 </sizepolicy>
39 </property>
40 <property name="text" >
41 <string>Select the Language you want to generate a voicefile for:</string>
42 </property>
43 </widget>
44 </item>
45 <item row="1" column="1" colspan="2" >
46 <widget class="QComboBox" name="comboLanguage" />
47 </item>
48 <item row="2" column="1" colspan="2" >
49 <widget class="QGroupBox" name="groupBox_2" >
50 <property name="title" >
51 <string>Generation settings</string>
52 </property>
53 <layout class="QGridLayout" >
54 <item row="0" column="0" >
55 <widget class="QLabel" name="labelEncProfile" >
56 <property name="text" >
57 <string>Encoder profile:</string>
58 </property>
59 </widget>
60 </item>
61 <item row="1" column="0" >
62 <widget class="QLabel" name="labelTtsProfile" >
63 <property name="text" >
64 <string>TTS profile:</string>
65 </property>
66 </widget>
67 </item>
68 <item row="2" column="0" >
69 <widget class="QPushButton" name="change" >
70 <property name="sizePolicy" >
71 <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
72 <horstretch>0</horstretch>
73 <verstretch>0</verstretch>
74 </sizepolicy>
75 </property>
76 <property name="text" >
77 <string>Change</string>
78 </property>
79 </widget>
80 </item>
81 <item row="2" column="1" >
82 <spacer>
83 <property name="orientation" >
84 <enum>Qt::Horizontal</enum>
85 </property>
86 <property name="sizeHint" >
87 <size>
88 <width>40</width>
89 <height>20</height>
90 </size>
91 </property>
92 </spacer>
93 </item>
94 </layout>
95 </widget>
96 </item>
97 <item row="3" column="1" >
98 <spacer>
99 <property name="orientation" >
100 <enum>Qt::Vertical</enum>
101 </property>
102 <property name="sizeHint" >
103 <size>
104 <width>20</width>
105 <height>201</height>
106 </size>
107 </property>
108 </spacer>
109 </item>
110 <item row="4" column="1" >
111 <spacer>
112 <property name="orientation" >
113 <enum>Qt::Horizontal</enum>
114 </property>
115 <property name="sizeHint" >
116 <size>
117 <width>40</width>
118 <height>20</height>
119 </size>
120 </property>
121 </spacer>
122 </item>
123 <item row="4" column="2" >
124 <layout class="QHBoxLayout" >
125 <item>
126 <widget class="QPushButton" name="buttonOk" >
127 <property name="text" >
128 <string>&amp;Install</string>
129 </property>
130 <property name="icon" >
131 <iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset>
132 </property>
133 </widget>
134 </item>
135 <item>
136 <widget class="QPushButton" name="buttonCancel" >
137 <property name="text" >
138 <string>&amp;Cancel</string>
139 </property>
140 <property name="icon" >
141 <iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset>
142 </property>
143 </widget>
144 </item>
145 </layout>
146 </item>
147 </layout>
148 </widget>
149 <tabstops>
150 <tabstop>change</tabstop>
151 <tabstop>buttonOk</tabstop>
152 <tabstop>buttonCancel</tabstop>
153 </tabstops>
154 <resources>
155 <include location="rbutilqt.qrc" />
156 </resources>
157 <connections>
158 <connection>
159 <sender>buttonOk</sender>
160 <signal>clicked()</signal>
161 <receiver>CreateVoiceFrm</receiver>
162 <slot>accept()</slot>
163 <hints>
164 <hint type="sourcelabel" >
165 <x>472</x>
166 <y>418</y>
167 </hint>
168 <hint type="destinationlabel" >
169 <x>382</x>
170 <y>328</y>
171 </hint>
172 </hints>
173 </connection>
174 <connection>
175 <sender>buttonCancel</sender>
176 <signal>clicked()</signal>
177 <receiver>CreateVoiceFrm</receiver>
178 <slot>reject()</slot>
179 <hints>
180 <hint type="sourcelabel" >
181 <x>561</x>
182 <y>428</y>
183 </hint>
184 <hint type="destinationlabel" >
185 <x>522</x>
186 <y>332</y>
187 </hint>
188 </hints>
189 </connection>
190 </connections>
191</ui>
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp
new file mode 100644
index 0000000000..b8a14498de
--- /dev/null
+++ b/rbutil/rbutilqt/createvoicewindow.cpp
@@ -0,0 +1,113 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Riebeling
10 * $Id: createvoicewindow.cpp 15932 2007-12-15 13:13:57Z domonoky $
11 *
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.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "createvoicewindow.h"
21#include "ui_createvoicefrm.h"
22
23#include "browsedirtree.h"
24#include "configure.h"
25
26CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
27{
28 ui.setupUi(this);
29 voicecreator = new VoiceFileCreator(this);
30
31 connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
32}
33
34void CreateVoiceWindow::change()
35{
36 Config *cw = new Config(this,4);
37 cw->setUserSettings(userSettings);
38 cw->setDevices(devices);
39 cw->show();
40 connect(cw, SIGNAL(settingsUpdated()), this, SIGNAL(settingsUpdated()));
41}
42
43void CreateVoiceWindow::accept()
44{
45 logger = new ProgressLoggerGui(this);
46 logger->show();
47 connect(logger,SIGNAL(closed()),this,SLOT(close()));
48
49 QString platform = userSettings->value("platform").toString();
50 QString lang = ui.comboLanguage->currentText();
51
52 //safe selected language
53 userSettings->setValue("voicelanguage",lang);
54 userSettings->sync();
55
56 //configure voicecreator
57 voicecreator->setUserSettings(userSettings);
58 voicecreator->setDeviceSettings(devices);
59 voicecreator->setMountPoint(userSettings->value("mountpoint").toString());
60 voicecreator->setTargetId(devices->value(platform + "/targetid").toInt());
61 voicecreator->setLang(lang);
62 voicecreator->setProxy(m_proxy);
63
64 //start creating
65 voicecreator->createVoiceFile(logger);
66}
67
68
69
70void CreateVoiceWindow::setDeviceSettings(QSettings *dev)
71{
72 devices = dev;
73 qDebug() << "Install::setDeviceSettings:" << devices;
74
75 // fill in language combobox
76 devices->beginGroup("languages");
77 QStringList keys = devices->allKeys();
78 QStringList languages;
79 for(int i =0 ; i < keys.size();i++)
80 {
81 languages << devices->value(keys.at(i)).toString();
82 }
83 devices->endGroup();
84
85 ui.comboLanguage->addItems(languages);
86 // set saved lang
87 ui.comboLanguage->setCurrentIndex(ui.comboLanguage->findText(userSettings->value("voicelanguage").toString()));
88}
89
90void CreateVoiceWindow::setUserSettings(QSettings *user)
91{
92 userSettings = user;
93
94 QString ttsName = userSettings->value("tts", "none").toString();
95 TTSBase* tts = getTTS(ttsName);
96 tts->setUserCfg(userSettings);
97 if(tts->configOk())
98 ui.labelTtsProfile->setText(tr("Selected TTS engine : <b>%1</b>").arg(ttsName));
99 else
100 ui.labelTtsProfile->setText(tr("Selected TTS Engine: <b>%1</b>").arg("Invalid TTS configuration!"));
101
102 QString encoder = userSettings->value("encoder", "none").toString();
103 EncBase* enc = getEncoder(encoder);
104 enc->setUserCfg(userSettings);
105 if(enc->configOk())
106 ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder));
107 else
108 ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
109
110}
111
112
113
diff --git a/rbutil/rbutilqt/createvoicewindow.h b/rbutil/rbutilqt/createvoicewindow.h
new file mode 100644
index 0000000000..76472721fe
--- /dev/null
+++ b/rbutil/rbutilqt/createvoicewindow.h
@@ -0,0 +1,56 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: installtalkwindow.h 15926 2007-12-14 19:49:11Z domonoky $
11 *
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.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef CREATEVOICEWINDOW_H
21#define CREATEVOICEWINDOW_H
22
23#include <QtGui>
24
25#include <QSettings>
26
27#include "ui_createvoicefrm.h"
28#include "progressloggergui.h"
29#include "voicefile.h"
30
31class CreateVoiceWindow : public QDialog
32{
33 Q_OBJECT
34 public:
35 CreateVoiceWindow(QWidget *parent = 0);
36 void setUserSettings(QSettings*);
37 void setDeviceSettings(QSettings*);
38 void setProxy(QUrl proxy){m_proxy = proxy;}
39
40 signals:
41 void settingsUpdated(void);
42
43 public slots:
44 void accept(void);
45 void change(void);
46
47 private:
48 VoiceFileCreator* voicecreator;
49 Ui::CreateVoiceFrm ui;
50 ProgressLoggerGui* logger;
51 QSettings *devices;
52 QSettings *userSettings;
53 QUrl m_proxy;
54};
55
56#endif
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini
index 1c118a5959..2f2e904ab4 100644
--- a/rbutil/rbutilqt/rbutil.ini
+++ b/rbutil/rbutilqt/rbutil.ini
@@ -13,6 +13,7 @@ themes_url=http://www.rockbox-themes.org
13manual_url=http://download.rockbox.org/manual 13manual_url=http://download.rockbox.org/manual
14doom_url=http://download.rockbox.org/useful/rockdoom.zip 14doom_url=http://download.rockbox.org/useful/rockdoom.zip
15voice_url=http://www.rockbox.org/voices/ 15voice_url=http://www.rockbox.org/voices/
16genlang_url=http://www.rockbox.org/genlang/
16 17
17[platforms] 18[platforms]
18platform01=player 19platform01=player
@@ -56,6 +57,7 @@ resolution=11x2x1
56manualname= 57manualname=
57brand=Archos 58brand=Archos
58voicename=player 59voicename=player
60targetid=1
59 61
60[recorder] 62[recorder]
61name="Jukebox Recorder 6 / 10 / 15 / 20" 63name="Jukebox Recorder 6 / 10 / 15 / 20"
@@ -68,6 +70,7 @@ resolution=112x64x1
68manualname= 70manualname=
69brand=Archos 71brand=Archos
70voicename=recorder 72voicename=recorder
73targetid=2
71 74
72[recorder8mb] 75[recorder8mb]
73name="Jukebox Recorder 6 / 10 / 15 / 20 (with 8MiB memory)" 76name="Jukebox Recorder 6 / 10 / 15 / 20 (with 8MiB memory)"
@@ -80,6 +83,7 @@ resolution=112x64x1
80manualname=rockbox-recorder 83manualname=rockbox-recorder
81brand=Archos 84brand=Archos
82voicename=recorder 85voicename=recorder
86targetid=2
83 87
84[recorderv2] 88[recorderv2]
85name="Jukebox Recorder v2 (20GB)" 89name="Jukebox Recorder v2 (20GB)"
@@ -92,6 +96,7 @@ resolution=112x64x1
92manualname= 96manualname=
93brand=Archos 97brand=Archos
94voicename=recorderv2 98voicename=recorderv2
99targetid=4
95 100
96[fmrecorder] 101[fmrecorder]
97name="Jukebox Recorder FM" 102name="Jukebox Recorder FM"
@@ -104,6 +109,7 @@ resolution=112x64x1
104manualname= 109manualname=
105brand=Archos 110brand=Archos
106voicename=fmrecorder 111voicename=fmrecorder
112targetid=3
107 113
108[fmrecorder8mb] 114[fmrecorder8mb]
109name="Jukebox Recorder FM (with 8MiB memory)" 115name="Jukebox Recorder FM (with 8MiB memory)"
@@ -116,6 +122,7 @@ resolution=112x64x1
116manualname=rockbox-fmrecorder 122manualname=rockbox-fmrecorder
117brand=Archos 123brand=Archos
118voicename=fmrecorder 124voicename=fmrecorder
125targetid=3
119 126
120[ondiosp] 127[ondiosp]
121name="Ondio SP" 128name="Ondio SP"
@@ -128,6 +135,7 @@ resolution=112x64x1
128manualname= 135manualname=
129brand=Archos 136brand=Archos
130voicename=ondiosp 137voicename=ondiosp
138targetid=7
131 139
132[ondiofm] 140[ondiofm]
133name="Ondio FM" 141name="Ondio FM"
@@ -140,6 +148,7 @@ resolution=112x64x1
140manualname= 148manualname=
141brand=Archos 149brand=Archos
142voicename=ondiofm 150voicename=ondiofm
151targetid=8
143 152
144[h100] 153[h100]
145name="iHP100 / iHP110" 154name="iHP100 / iHP110"
@@ -153,6 +162,7 @@ manualname=rockbox-h100
153brand=Iriver 162brand=Iriver
154usbid=0x10063001 163usbid=0x10063001
155voicename=h100 164voicename=h100
165targetid=11
156 166
157[h120] 167[h120]
158name="iHP120 / iHP140 / H120 / H140" 168name="iHP120 / iHP140 / H120 / H140"
@@ -166,6 +176,7 @@ manualname=rockbox-h100
166brand=Iriver 176brand=Iriver
167usbid=0x10063002 177usbid=0x10063002
168voicename=h120 178voicename=h120
179targetid=9
169 180
170[h300] 181[h300]
171name="H320 / H340" 182name="H320 / H340"
@@ -179,6 +190,7 @@ manualname=rockbox-h300
179brand=Iriver 190brand=Iriver
180usbid=0x10063003 191usbid=0x10063003
181voicename=h300 192voicename=h300
193targetid=10
182 194
183[h10_5gbums] 195[h10_5gbums]
184name="H10 (5 / 6GB) UMS" 196name="H10 (5 / 6GB) UMS"
@@ -192,6 +204,7 @@ manualname=
192brand=Iriver 204brand=Iriver
193usbid=0x41022002 205usbid=0x41022002
194voicename=h10_5gb 206voicename=h10_5gb
207targetid=24
195 208
196[h10_5gbmtp] 209[h10_5gbmtp]
197name="H10 (5 / 6GB) MTP" 210name="H10 (5 / 6GB) MTP"
@@ -205,6 +218,7 @@ manualname=
205brand=Iriver 218brand=Iriver
206usbid=0x41022105 219usbid=0x41022105
207voicename=h10_5gb 220voicename=h10_5gb
221targetid=24
208 222
209[h10] 223[h10]
210name="H10 (20GB)" 224name="H10 (20GB)"
@@ -219,6 +233,7 @@ brand=Iriver
219usbid=0x0b7000ba 233usbid=0x0b7000ba
220usberror=0x41022101 234usberror=0x41022101
221voicename=h10 235voicename=h10
236targetid=22
222 237
223[ipod1g2g] 238[ipod1g2g]
224name="Ipod (1st / 2nd gen)" 239name="Ipod (1st / 2nd gen)"
@@ -231,6 +246,7 @@ resolution=160x128x2
231manualname= 246manualname=
232brand=Apple 247brand=Apple
233voicename=ipod1g2g 248voicename=ipod1g2g
249targetid=29
234 250
235[ipodcolor] 251[ipodcolor]
236name="Ipod Colour / Photo / U2 (4th gen)" 252name="Ipod Colour / Photo / U2 (4th gen)"
@@ -243,6 +259,7 @@ resolution=220x176x16
243manualname= 259manualname=
244brand=Apple 260brand=Apple
245voicename=ipodcolor 261voicename=ipodcolor
262targetid=13
246 263
247[ipodnano] 264[ipodnano]
248name="Ipod Nano (1st gen)" 265name="Ipod Nano (1st gen)"
@@ -256,6 +273,7 @@ manualname=
256brand=Apple 273brand=Apple
257usbid=0x05ac120a 274usbid=0x05ac120a
258voicename=ipodnano 275voicename=ipodnano
276targetid=14
259 277
260[ipod4gray] 278[ipod4gray]
261name="Ipod (4th gen, greyscale)" 279name="Ipod (4th gen, greyscale)"
@@ -268,6 +286,7 @@ resolution=160x128x2
268manualname= 286manualname=
269brand=Apple 287brand=Apple
270voicename=ipod4gray 288voicename=ipod4gray
289targetid=17
271 290
272[ipodvideo] 291[ipodvideo]
273name="Ipod Video (5th gen) 30GB" 292name="Ipod Video (5th gen) 30GB"
@@ -280,6 +299,7 @@ resolution=320x240x16
280manualname= 299manualname=
281brand=Apple 300brand=Apple
282voicename=ipodvideo 301voicename=ipodvideo
302targetid=15
283 303
284[ipodvideo64mb] 304[ipodvideo64mb]
285name="Ipod Video (5th gen) 60/80GB" 305name="Ipod Video (5th gen) 60/80GB"
@@ -292,6 +312,7 @@ resolution=320x240x16
292manualname= 312manualname=
293brand=Apple 313brand=Apple
294voicename=ipodvideo 314voicename=ipodvideo
315targetid=15
295 316
296[ipod3g] 317[ipod3g]
297name="Ipod (3rd gen)" 318name="Ipod (3rd gen)"
@@ -305,6 +326,7 @@ manualname=
305brand=Apple 326brand=Apple
306usbid=0x05ac1201 327usbid=0x05ac1201
307voicename=ipod3g 328voicename=ipod3g
329targetid=16
308 330
309[ipodmini1g] 331[ipodmini1g]
310name="Ipod Mini (1st gen)" 332name="Ipod Mini (1st gen)"
@@ -317,6 +339,7 @@ resolution=138x110x2
317manualname=rockbox-ipodmini2g 339manualname=rockbox-ipodmini2g
318brand=Apple 340brand=Apple
319voicename=ipodmini1g 341voicename=ipodmini1g
342targetid=18
320 343
321[ipodmini2g] 344[ipodmini2g]
322name="Ipod Mini (2nd gen)" 345name="Ipod Mini (2nd gen)"
@@ -329,6 +352,7 @@ resolution=138x110x2
329manualname=rockbox-ipodmini2g 352manualname=rockbox-ipodmini2g
330brand=Apple 353brand=Apple
331voicename=ipodmini2g 354voicename=ipodmini2g
355targetid=21
332 356
333[iaudiox5] 357[iaudiox5]
334name="iAudio X5 / X5L" 358name="iAudio X5 / X5L"
@@ -343,6 +367,7 @@ brand=Cowon
343usbid=0x0e210510 367usbid=0x0e210510
344usbid=0x0e210513 368usbid=0x0e210513
345voicename=iaudiox5 369voicename=iaudiox5
370targetid=12
346 371
347[iaudiox5v] 372[iaudiox5v]
348name="iAudio X5V" 373name="iAudio X5V"
@@ -355,6 +380,7 @@ resolution=160x128x2
355manualname= 380manualname=
356brand=Cowon 381brand=Cowon
357voicename=iaudiox5v 382voicename=iaudiox5v
383targetid=12
358 384
359[iaudiom5] 385[iaudiom5]
360name="iAudio M5 / M5L" 386name="iAudio M5 / M5L"
@@ -368,6 +394,7 @@ manualname=
368brand=Cowon 394brand=Cowon
369usbid=0x0e210520 395usbid=0x0e210520
370voicename=iaudiom5 396voicename=iaudiom5
397targetid=28
371 398
372[gigabeatf] 399[gigabeatf]
373name="Gigabeat F / X" 400name="Gigabeat F / X"
@@ -380,6 +407,7 @@ manualname=
380brand=Toshiba 407brand=Toshiba
381usbid=0x09300009 408usbid=0x09300009
382voicename=gigabeatf 409voicename=gigabeatf
410targetid=20
383 411
384[sansae200] 412[sansae200]
385name="Sansa E200" 413name="Sansa E200"
@@ -394,6 +422,7 @@ brand=Sandisk
394usbid=0x07817421 422usbid=0x07817421
395usberror=0x07810720 423usberror=0x07810720
396voicename=sansae200 424voicename=sansae200
425targetid=23
397 426
398[sansac200] 427[sansac200]
399name="Sansa C200" 428name="Sansa C200"
@@ -406,80 +435,44 @@ resolution=132x80x16
406manualname= 435manualname=
407brand=Sandisk 436brand=Sandisk
408voicename=sansac200 437voicename=sansac200
438targetid=30
439
440[languages]
441lang1=africaans
442lang2=bulgarian
443lang3=catala
444lang4=chinese-simp
445lang5=chinese-trad
446lang6=czech
447lang7=dansk
448lang8=deutsch
449lang9=eesti
450lang10=english
451lang11=espanol
452lang12=esperanto
453lang13=finnish
454lang14=francais
455lang15=galego
456lang16=greek
457lang17=hebrew
458lang18=islenska
459lang19=italiano
460lang20=japanese
461lang21=korean
462lang22=magyar
463lang23=nederlands
464lang24=norsk
465lang25=norsk-nynorsk
466lang26=polski
467lang27=portugues
468lang28=portugues-brasileiro
469lang29=romaneste
470lang30=russian
471lang31=slovenscina
472lang32=svenska
473lang33=thai
474lang34=turkce
475lang35=wallisertitsch
409 476
410[tts]
411ttspreset01 = "espeak (default)"
412ttspreset02 = "espeak (user-adjusted)"
413ttspreset03 = "flite (default)"
414ttspreset04 = "flite (user-adjusted)"
415ttspreset05 = "sapi (default)"
416ttspreset06 = "sapi (user-adjusted)"
417ttspreset07 = "swift (default)"
418ttspreset08 = "swift (user-adjusted)"
419
420
421[ttspreset01]
422tts = "espeak"
423options = ""
424template = "\"%exe\" \"%options\" -w \"%wavfile\" \"%text\""
425edit = false
426os = all
427needslanguagecfg = false
428
429[ttspreset02]
430tts = "espeak"
431options = ""
432template = "\"%exe\" \"%options\" -w \"%wavfile\" \"%text\""
433edit = true
434os = all
435needslanguagecfg = false
436
437[ttspreset03]
438tts = "flite"
439options = ""
440template = "\"%exe\" \"%options\" -o \"%wavfile\" \"%text\""
441edit = false
442os = all
443needslanguagecfg = false
444
445[ttspreset04]
446tts = "flite"
447options = ""
448template = "\"%exe\" \"%options\" -o \"%wavfile\" \"%text\""
449edit = true
450os = all
451needslanguagecfg = false
452
453[ttspreset05]
454tts = "sapi"
455options = ""
456template = "cscript //nologo \"%exe\" /language:%lang \"%options\""
457edit = false
458os = win32
459needslanguagecfg = true
460
461[ttspreset06]
462tts = "sapi"
463options = ""
464template = "cscript //nologo \"%exe\" /language:%lang \"%options\""
465edit = true
466os = win32
467needslanguagecfg = true
468
469[ttspreset07]
470tts = "swift"
471options = ""
472template = "\"%exe\" \"%options\" -o \"%wavfile\" \"%text\""
473edit = false
474os = all
475needslanguagecfg = false
476
477[ttspreset08]
478tts = "swift"
479options = ""
480template = "\"%exe\" \"%options\" -o \"%wavfile\" \"%text\""
481edit = true
482os = all
483needslanguagecfg = false
484 477
485 478
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 7d0a887849..a28defc413 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -26,6 +26,7 @@
26#include "configure.h" 26#include "configure.h"
27#include "install.h" 27#include "install.h"
28#include "installtalkwindow.h" 28#include "installtalkwindow.h"
29#include "createvoicewindow.h"
29#include "httpget.h" 30#include "httpget.h"
30#include "installbootloader.h" 31#include "installbootloader.h"
31#include "installthemes.h" 32#include "installthemes.h"
@@ -89,6 +90,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
89 connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFontsBtn())); 90 connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFontsBtn()));
90 connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoomBtn())); 91 connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoomBtn()));
91 connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles())); 92 connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
93 connect(ui.buttonCreateVoice, SIGNAL(clicked()), this, SLOT(createVoiceFile()));
92 connect(ui.buttonVoice, SIGNAL(clicked()), this, SLOT(installVoice())); 94 connect(ui.buttonVoice, SIGNAL(clicked()), this, SLOT(installVoice()));
93 connect(ui.buttonThemes, SIGNAL(clicked()), this, SLOT(installThemes())); 95 connect(ui.buttonThemes, SIGNAL(clicked()), this, SLOT(installThemes()));
94 connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall())); 96 connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall()));
@@ -106,6 +108,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
106 connect(ui.actionInstall_Themes, SIGNAL(triggered()), this, SLOT(installThemes())); 108 connect(ui.actionInstall_Themes, SIGNAL(triggered()), this, SLOT(installThemes()));
107 connect(ui.actionInstall_Game_Files, SIGNAL(triggered()), this, SLOT(installDoomBtn())); 109 connect(ui.actionInstall_Game_Files, SIGNAL(triggered()), this, SLOT(installDoomBtn()));
108 connect(ui.actionInstall_Voice_File, SIGNAL(triggered()), this, SLOT(installVoice())); 110 connect(ui.actionInstall_Voice_File, SIGNAL(triggered()), this, SLOT(installVoice()));
111 connect(ui.actionCreate_Voice_File, SIGNAL(triggered()), this, SLOT(createVoiceFile()));
109 connect(ui.actionCreate_Talk_Files, SIGNAL(triggered()), this, SLOT(createTalkFiles())); 112 connect(ui.actionCreate_Talk_Files, SIGNAL(triggered()), this, SLOT(createTalkFiles()));
110 connect(ui.actionRemove_bootloader, SIGNAL(triggered()), this, SLOT(uninstallBootloader())); 113 connect(ui.actionRemove_bootloader, SIGNAL(triggered()), this, SLOT(uninstallBootloader()));
111 connect(ui.actionUninstall_Rockbox, SIGNAL(triggered()), this, SLOT(uninstall())); 114 connect(ui.actionUninstall_Rockbox, SIGNAL(triggered()), this, SLOT(uninstall()));
@@ -753,6 +756,19 @@ void RbUtilQt::createTalkFiles(void)
753 756
754} 757}
755 758
759void RbUtilQt::createVoiceFile(void)
760{
761 if(chkConfig(true)) return;
762 CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
763 installWindow->setUserSettings(userSettings);
764 installWindow->setDeviceSettings(devices);
765 installWindow->setProxy(proxy());
766
767 installWindow->show();
768 connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
769 connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
770}
771
756void RbUtilQt::uninstall(void) 772void RbUtilQt::uninstall(void)
757{ 773{
758 if(chkConfig(true)) return; 774 if(chkConfig(true)) return;
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h
index f656caf451..f030d69f3c 100644
--- a/rbutil/rbutilqt/rbutilqt.h
+++ b/rbutil/rbutilqt/rbutilqt.h
@@ -91,6 +91,7 @@ class RbUtilQt : public QMainWindow
91 void installDoom(void); 91 void installDoom(void);
92 92
93 void createTalkFiles(void); 93 void createTalkFiles(void);
94 void createVoiceFile(void);
94 void downloadDone(bool); 95 void downloadDone(bool);
95 void downloadDone(int, bool); 96 void downloadDone(int, bool);
96 void downloadBleedingDone(bool); 97 void downloadBleedingDone(bool);
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index b240770c33..fe95a4c665 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -42,8 +42,12 @@ SOURCES += rbutilqt.cpp \
42 browseof.cpp \ 42 browseof.cpp \
43 preview.cpp \ 43 preview.cpp \
44 encoders.cpp \ 44 encoders.cpp \
45 tts.cpp 45 tts.cpp \
46 46 ../../tools/wavtrim.c \
47 ../../tools/voicefont.c \
48 voicefile.cpp \
49 createvoicewindow.cpp
50
47HEADERS += rbutilqt.h \ 51HEADERS += rbutilqt.h \
48 install.h \ 52 install.h \
49 httpget.h \ 53 httpget.h \
@@ -80,10 +84,14 @@ HEADERS += rbutilqt.h \
80 browseof.h \ 84 browseof.h \
81 preview.h \ 85 preview.h \
82 encoders.h \ 86 encoders.h \
83 tts.h 87 tts.h \
88 ../../tools/wavtrim.h \
89 ../../tools/voicefont.h \
90 voicefile.h \
91 createvoicewindow.h
84 92
85# Needed by QT on Win 93# Needed by QT on Win
86INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex 94INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools
87 95
88LIBS += -L../../tools/rbspeex -lrbspeex 96LIBS += -L../../tools/rbspeex -lrbspeex
89 97
@@ -115,7 +123,8 @@ FORMS += rbutilqtfrm.ui \
115 rbspeexcfgfrm.ui \ 123 rbspeexcfgfrm.ui \
116 encexescfgfrm.ui \ 124 encexescfgfrm.ui \
117 ttsexescfgfrm.ui \ 125 ttsexescfgfrm.ui \
118 sapicfgfrm.ui 126 sapicfgfrm.ui \
127 createvoicefrm.ui
119 128
120RESOURCES += rbutilqt.qrc 129RESOURCES += rbutilqt.qrc
121win32 { 130win32 {
diff --git a/rbutil/rbutilqt/rbutilqt.qrc b/rbutil/rbutilqt/rbutilqt.qrc
index 0e571d6585..71e4c93d19 100644
--- a/rbutil/rbutilqt/rbutilqt.qrc
+++ b/rbutil/rbutilqt/rbutilqt.qrc
@@ -3,6 +3,9 @@
3 <file>CREDITS</file> 3 <file>CREDITS</file>
4 <file>gpl-2.0.html</file> 4 <file>gpl-2.0.html</file>
5 </qresource> 5 </qresource>
6 <qresource>
7 <file alias="builtin/VOICE_PAUSE.wav">../../tools/VOICE_PAUSE.wav</file>
8 </qresource>
6 <qresource prefix="/icons" > 9 <qresource prefix="/icons" >
7 <file>icons/audio-input-microphone.png</file> 10 <file>icons/audio-input-microphone.png</file>
8 <file>icons/bootloader_btn.png</file> 11 <file>icons/bootloader_btn.png</file>
diff --git a/rbutil/rbutilqt/rbutilqtfrm.ui b/rbutil/rbutilqt/rbutilqtfrm.ui
index fe929db54d..2eec1be54c 100644
--- a/rbutil/rbutilqt/rbutilqtfrm.ui
+++ b/rbutil/rbutilqt/rbutilqtfrm.ui
@@ -490,16 +490,16 @@ p, li { white-space: pre-wrap; }
490 <property name="text" > 490 <property name="text" >
491 <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> 491 <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
492p, li { white-space: pre-wrap; } 492p, li { white-space: pre-wrap; }
493&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> 493&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
494&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Install Voice file&lt;/span>&lt;/p> 494&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">&lt;span style=" font-weight:600;">Install Voice file&lt;/span>&lt;/p>
495&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Voice files are needed to make Rockbox speak the user interface. Speaking is enabled by default, so if you installed the voice file Rockbox will speak.&lt;/p>&lt;/body>&lt;/html></string> 495&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">Voice files are needed to make Rockbox speak the user interface. Speaking is enabled by default, so if you installed the voice file Rockbox will speak.&lt;/p>&lt;/body>&lt;/html></string>
496 </property> 496 </property>
497 <property name="wordWrap" > 497 <property name="wordWrap" >
498 <bool>true</bool> 498 <bool>true</bool>
499 </property> 499 </property>
500 </widget> 500 </widget>
501 </item> 501 </item>
502 <item row="1" column="0" > 502 <item row="2" column="0" >
503 <widget class="QToolButton" name="buttonTalk" > 503 <widget class="QToolButton" name="buttonTalk" >
504 <property name="text" > 504 <property name="text" >
505 <string>Install Talk files</string> 505 <string>Install Talk files</string>
@@ -515,7 +515,7 @@ p, li { white-space: pre-wrap; }
515 </property> 515 </property>
516 </widget> 516 </widget>
517 </item> 517 </item>
518 <item row="1" column="1" > 518 <item row="2" column="1" >
519 <widget class="QLabel" name="labelTalk" > 519 <widget class="QLabel" name="labelTalk" >
520 <property name="text" > 520 <property name="text" >
521 <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> 521 <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
@@ -526,7 +526,7 @@ p, li { white-space: pre-wrap; }
526 </property> 526 </property>
527 </widget> 527 </widget>
528 </item> 528 </item>
529 <item row="2" column="0" > 529 <item row="3" column="0" >
530 <spacer> 530 <spacer>
531 <property name="orientation" > 531 <property name="orientation" >
532 <enum>Qt::Vertical</enum> 532 <enum>Qt::Vertical</enum>
@@ -539,7 +539,7 @@ p, li { white-space: pre-wrap; }
539 </property> 539 </property>
540 </spacer> 540 </spacer>
541 </item> 541 </item>
542 <item row="2" column="1" > 542 <item row="3" column="1" >
543 <spacer> 543 <spacer>
544 <property name="orientation" > 544 <property name="orientation" >
545 <enum>Qt::Vertical</enum> 545 <enum>Qt::Vertical</enum>
@@ -552,6 +552,34 @@ p, li { white-space: pre-wrap; }
552 </property> 552 </property>
553 </spacer> 553 </spacer>
554 </item> 554 </item>
555 <item row="1" column="0" >
556 <widget class="QToolButton" name="buttonCreateVoice" >
557 <property name="text" >
558 <string>Install Voice files</string>
559 </property>
560 <property name="icon" >
561 <iconset resource="rbutilqt.qrc" >:/icons/icons/talkfile_btn.png</iconset>
562 </property>
563 <property name="iconSize" >
564 <size>
565 <width>56</width>
566 <height>46</height>
567 </size>
568 </property>
569 </widget>
570 </item>
571 <item row="1" column="1" >
572 <widget class="QLabel" name="labelCreateVoice" >
573 <property name="text" >
574 <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
575p, li { white-space: pre-wrap; }
576&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
577&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">&lt;span style=" font-size:9pt; font-weight:600;">Create Voice file&lt;/span>&lt;/p>
578&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">Voice files are needed to make Rockbox speak the user interface. Speaking is enabled by default, so&lt;/p>
579&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"> if you installed the voice file Rockbox will speak.&lt;/p>&lt;/body>&lt;/html></string>
580 </property>
581 </widget>
582 </item>
555 </layout> 583 </layout>
556 </widget> 584 </widget>
557 <widget class="QWidget" name="uninstall" > 585 <widget class="QWidget" name="uninstall" >
@@ -801,7 +829,7 @@ p, li { white-space: pre-wrap; }
801 <x>0</x> 829 <x>0</x>
802 <y>0</y> 830 <y>0</y>
803 <width>662</width> 831 <width>662</width>
804 <height>29</height> 832 <height>21</height>
805 </rect> 833 </rect>
806 </property> 834 </property>
807 <widget class="QMenu" name="menu_File" > 835 <widget class="QMenu" name="menu_File" >
@@ -853,6 +881,7 @@ p, li { white-space: pre-wrap; }
853 <string>Accessibility</string> 881 <string>Accessibility</string>
854 </property> 882 </property>
855 <addaction name="actionInstall_Voice_File" /> 883 <addaction name="actionInstall_Voice_File" />
884 <addaction name="actionCreate_Voice_File" />
856 <addaction name="actionCreate_Talk_Files" /> 885 <addaction name="actionCreate_Talk_Files" />
857 </widget> 886 </widget>
858 <widget class="QMenu" name="menuUninstallation" > 887 <widget class="QMenu" name="menuUninstallation" >
@@ -1024,6 +1053,18 @@ p, li { white-space: pre-wrap; }
1024 <string>Download HTML manual (zip)</string> 1053 <string>Download HTML manual (zip)</string>
1025 </property> 1054 </property>
1026 </action> 1055 </action>
1056 <action name="actionCreate_Voice_File" >
1057 <property name="icon" >
1058 <iconset resource="rbutilqt.qrc" >:/icons/icons/talkfile_btn.png</iconset>
1059 </property>
1060 <property name="text" >
1061 <string>Create Voice File</string>
1062 </property>
1063 <property name="iconText" >
1064 <string>Create Voic&lt;resource type="image" qrc="C:/cygwin/home/Domonoky/rockbox-svn/rockbox-rbspeex/rbutil/rbutilqt/rbutilqt.qrc" file=":/icons/icons/talkfile_btn.png" />
1065e File</string>
1066 </property>
1067 </action>
1027 </widget> 1068 </widget>
1028 <tabstops> 1069 <tabstops>
1029 <tabstop>tabWidget</tabstop> 1070 <tabstop>tabWidget</tabstop>
diff --git a/rbutil/rbutilqt/tts.cpp b/rbutil/rbutilqt/tts.cpp
index aa5f661fcb..b7c89ecbe9 100644
--- a/rbutil/rbutilqt/tts.cpp
+++ b/rbutil/rbutilqt/tts.cpp
@@ -284,7 +284,7 @@ bool TTSSapi::voice(QString text,QString wavfile)
284{ 284{
285 QString query = "SPEAK\t"+wavfile+"\t"+text+"\r\n"; 285 QString query = "SPEAK\t"+wavfile+"\t"+text+"\r\n";
286 qDebug() << "voicing" << query; 286 qDebug() << "voicing" << query;
287 voicescript->write(query.toLocal8Bit()); 287 voicescript->write(query.toUtf8());
288 voicescript->write("SYNC\tbla\r\n"); 288 voicescript->write("SYNC\tbla\r\n");
289 voicescript->waitForReadyRead(); 289 voicescript->waitForReadyRead();
290 return true; 290 return true;
@@ -293,7 +293,7 @@ bool TTSSapi::voice(QString text,QString wavfile)
293bool TTSSapi::stop() 293bool TTSSapi::stop()
294{ 294{
295 QString query = "QUIT\r\n"; 295 QString query = "QUIT\r\n";
296 voicescript->write(query.toLocal8Bit()); 296 voicescript->write(query.toUtf8());
297 voicescript->waitForFinished(); 297 voicescript->waitForFinished();
298 delete voicescript; 298 delete voicescript;
299 return true; 299 return true;
diff --git a/rbutil/rbutilqt/voicefile.cpp b/rbutil/rbutilqt/voicefile.cpp
new file mode 100644
index 0000000000..9390fa2fe9
--- /dev/null
+++ b/rbutil/rbutilqt/voicefile.cpp
@@ -0,0 +1,275 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: voicefile.h 15932 2007-12-15 13:13:57Z domonoky $
11 *
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.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "voicefile.h"
21
22#define STATE_INVALID 0
23#define STATE_PHRASE 1
24#define STATE_VOICE 2
25
26
27VoiceFileCreator::VoiceFileCreator(QObject* parent) :QObject(parent)
28{
29
30}
31
32void VoiceFileCreator::abort()
33{
34 m_abort = true;
35}
36
37bool VoiceFileCreator::createVoiceFile(ProgressloggerInterface* logger)
38{
39 m_abort = false;
40 m_logger = logger;
41 m_logger->addItem("Starting Voicefile generation",LOGINFO);
42
43 // test if tempdir exists
44 if(!QDir(QDir::tempPath()+"/rbvoice/").exists())
45 {
46 QDir(QDir::tempPath()).mkdir("rbvoice");
47 }
48
49 m_path = QDir::tempPath() + "/rbvoice/";
50
51 // read rockbox-info.txt
52 QFile info(m_mountpoint+"/.rockbox/rockbox-info.txt");
53 if(!info.open(QIODevice::ReadOnly))
54 {
55 m_logger->addItem("failed to open rockbox-info.txt",LOGERROR);
56 return false;
57 }
58
59 QString target, features,version;
60 while (!info.atEnd()) {
61 QString line = info.readLine();
62
63 if(line.contains("Target:"))
64 {
65 target = line.remove("Target:").trimmed();
66 }
67 else if(line.contains("Features:"))
68 {
69 features = line.remove("Features:").trimmed();
70 }
71 else if(line.contains("Version:"))
72 {
73 version = line.remove("Version:").trimmed();
74 version = version.left(version.indexOf("-")).remove(0,1);
75 }
76 }
77 info.close();
78
79 //prepare download url
80 QUrl genlangUrl = deviceSettings->value("genlang_url").toString() +"?lang=" +m_lang+"&t="+target+"&rev="+version+"&f="+features;
81
82 qDebug() << "downloading " << genlangUrl;
83
84 //download the correct genlang output
85 QTemporaryFile *downloadFile = new QTemporaryFile(this);
86 downloadFile->open();
87 filename = downloadFile->fileName();
88 downloadFile->close();
89 // get the real file.
90 getter = new HttpGet(this);
91 getter->setProxy(m_proxy);
92 getter->setFile(downloadFile);
93 getter->getFile(genlangUrl);
94
95 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
96 connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
97 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
98 connect(m_logger, SIGNAL(aborted()), getter, SLOT(abort()));
99 return true;
100 }
101
102
103void VoiceFileCreator::downloadRequestFinished(int id, bool error)
104{
105 qDebug() << "Install::downloadRequestFinished" << id << error;
106 qDebug() << "error:" << getter->errorString();
107
108 downloadDone(error);
109}
110
111
112void VoiceFileCreator::downloadDone(bool error)
113{
114 qDebug() << "Voice creator::downloadDone, error:" << error;
115
116 // update progress bar
117 int max = m_logger->getProgressMax();
118 if(max == 0) {
119 max = 100;
120 m_logger->setProgressMax(max);
121 }
122 m_logger->setProgressValue(max);
123 if(getter->httpResponse() != 200 && !getter->isCached()) {
124 m_logger->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()),LOGERROR);
125 m_logger->abort();
126 return;
127 }
128 if(getter->isCached()) m_logger->addItem(tr("Cached file used."), LOGINFO);
129 if(error) {
130 m_logger->addItem(tr("Download error: %1").arg(getter->errorString()),LOGERROR);
131 m_logger->abort();
132 return;
133 }
134 else m_logger->addItem(tr("Download finished."),LOGOK);
135 QApplication::processEvents();
136
137
138 m_logger->setProgressMax(0);
139 //open downloaded file
140 QFile genlang(filename);
141 if(!genlang.open(QIODevice::ReadOnly))
142 {
143 m_logger->addItem("failed to open downloaded file",LOGERROR);
144 m_logger->abort();
145 return;
146 }
147
148 //tts
149 m_tts = getTTS(userSettings->value("tts").toString());
150 m_tts->setUserCfg(userSettings);
151
152 if(!m_tts->start())
153 {
154 m_logger->addItem("Init of TTS engine failed",LOGERROR);
155 m_logger->abort();
156 return;
157 }
158
159 // Encoder
160 m_enc = getEncoder(userSettings->value("encoder").toString());
161 m_enc->setUserCfg(userSettings);
162
163 if(!m_enc->start())
164 {
165 m_logger->addItem("Init of Encoder engine failed",LOGERROR);
166 m_tts->stop();
167 m_logger->abort();
168 return;
169 }
170
171 QApplication::processEvents();
172
173 connect(m_logger,SIGNAL(aborted()),this,SLOT(abort()));
174 QStringList mp3files;
175
176 QTextStream in(&genlang);
177 in.setCodec("UTF-8");
178
179 bool emptyfile = true;
180 while (!in.atEnd())
181 {
182 if(m_abort)
183 {
184 m_logger->addItem("aborted.",LOGERROR);
185 break;
186 }
187
188 QString comment = in.readLine();
189 QString id = in.readLine();
190 QString voice = in.readLine();
191
192 id = id.remove("id:").remove('"').trimmed();
193 voice = voice.remove("voice:").remove('"').trimmed();
194
195 QString wavname = m_path + "/" + id + ".wav";
196 QString toSpeak = voice;
197 QString encodedname = m_path + "/" + id +".mp3";
198
199 // todo PAUSE
200 if(id == "VOICE_PAUSE")
201 {
202 QFile::copy(":/builtin/builtin/VOICE_PAUSE.wav",m_path + "/VOICE_PAUSE.wav");
203
204 }
205 else
206 {
207 if(voice == "") continue;
208
209 m_logger->addItem(tr("creating ")+toSpeak,LOGINFO);
210 QApplication::processEvents();
211 m_tts->voice(toSpeak,wavname); // generate wav
212 }
213
214 // todo strip
215 char buffer[255];
216
217 wavtrim((char*)qPrintable(wavname),500,buffer,255);
218
219 // encode wav
220 m_enc->encode(wavname,encodedname);
221 // remove the wav file
222 QFile::remove(wavname);
223 // remember the mp3 file for later removing
224 mp3files << encodedname;
225 // remember that we have done something
226 emptyfile = false;
227
228 }
229 genlang.close();
230
231 if(emptyfile)
232 {
233 m_logger->addItem(tr("The downloaded file was empty!"),LOGERROR);
234 m_logger->abort();
235 return;
236 }
237
238 //make voicefile
239 FILE* ids2 = fopen(filename.toUtf8(), "r");
240 if (ids2 == NULL)
241 {
242 m_logger->addItem("Error opening downloaded file",LOGERROR);
243 m_logger->abort();
244 return;
245 }
246
247 FILE* output = fopen(QString(m_mountpoint + "/.rockbox/langs/" + m_lang + ".voice").toUtf8(), "wb");
248 if (output == NULL)
249 {
250 m_logger->addItem("Error opening output file",LOGERROR);
251 return;
252 }
253
254 voicefont(ids2,m_targetid,(char*)(const char*)m_path.toUtf8(), output);
255
256 //remove .mp3 files
257 for(int i=0;i< mp3files.size(); i++)
258 {
259 QFile::remove(mp3files.at(i));
260 }
261
262 m_logger->setProgressMax(100);
263 m_logger->setProgressValue(100);
264 m_logger->addItem("successfully created.",LOGOK);
265 m_logger->abort();
266}
267
268void VoiceFileCreator::updateDataReadProgress(int read, int total)
269{
270 m_logger->setProgressMax(total);
271 m_logger->setProgressValue(read);
272 //qDebug() << "progress:" << read << "/" << total;
273
274}
275
diff --git a/rbutil/rbutilqt/voicefile.h b/rbutil/rbutilqt/voicefile.h
new file mode 100644
index 0000000000..b82f0373c7
--- /dev/null
+++ b/rbutil/rbutilqt/voicefile.h
@@ -0,0 +1,84 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: voicefile.h 15932 2007-12-15 13:13:57Z domonoky $
11 *
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.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20
21#ifndef VOICEFILE_H
22#define VOICEFILE_H
23
24#include <QtGui>
25#include "progressloggerinterface.h"
26
27#include "encoders.h"
28#include "tts.h"
29#include "httpget.h"
30
31extern "C"
32{
33 #include "wavtrim.h"
34 #include "voicefont.h"
35}
36
37class VoiceFileCreator :public QObject
38{
39 Q_OBJECT
40public:
41 VoiceFileCreator(QObject* parent=0);
42
43 //start creation
44 bool createVoiceFile(ProgressloggerInterface* logger);
45
46 // set infos
47 void setUserSettings(QSettings* setting) { userSettings = setting;}
48 void setDeviceSettings(QSettings* setting) { deviceSettings = setting;}
49
50 void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
51 void setTargetId(int id){m_targetid = id;}
52 void setLang(QString name){m_lang =name;}
53 void setProxy(QUrl proxy){m_proxy = proxy;}
54
55private slots:
56 void abort();
57 void downloadRequestFinished(int id, bool error);
58 void downloadDone(bool error);
59 void updateDataReadProgress(int read, int total);
60
61private:
62
63 // ptr to encoder, tts and settings
64 TTSBase* m_tts;
65 EncBase* m_enc;
66 QSettings *userSettings;
67 QSettings *deviceSettings;
68
69 HttpGet *getter;
70
71 QUrl m_proxy; //proxy
72 QString filename; //the temporary file
73
74 QString m_mountpoint; //mountpoint of the device
75 QString m_path; //path where the wav and mp3 files are stored to
76 int m_targetid; //the target id
77 QString m_lang; // the language which will be spoken
78
79 ProgressloggerInterface* m_logger;
80
81 bool m_abort;
82};
83
84#endif