summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2007-08-05 16:17:35 +0000
committerDominik Wenger <domonoky@googlemail.com>2007-08-05 16:17:35 +0000
commite70f7f4ca857e9e88a6e076360b6c9c235d7739b (patch)
treec5528e6abc91f74ac14192f9f2844f856588fdc0
parent1d9f693658fda6e76d6c473fce8aa42b07f1b898 (diff)
downloadrockbox-e70f7f4ca857e9e88a6e076360b6c9c235d7739b.tar.gz
rockbox-e70f7f4ca857e9e88a6e076360b6c9c235d7739b.zip
rbutilQt: added Talkfile creation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14197 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/installbl.cpp33
-rw-r--r--rbutil/rbutilqt/installtalkfrm.ui268
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp264
-rw-r--r--rbutil/rbutilqt/installtalkwindow.h66
-rw-r--r--rbutil/rbutilqt/rbutil.ini18
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp14
-rw-r--r--rbutil/rbutilqt/rbutilqt.h1
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro7
-rw-r--r--rbutil/rbutilqt/rbutilqt.qrc1
-rw-r--r--rbutil/rbutilqt/rbutilqtfrm.ui35
-rw-r--r--rbutil/rbutilqt/talkfile.cpp212
-rw-r--r--rbutil/rbutilqt/talkfile.h105
12 files changed, 1001 insertions, 23 deletions
diff --git a/rbutil/rbutilqt/installbl.cpp b/rbutil/rbutilqt/installbl.cpp
index 627fa961b6..9d9dba4760 100644
--- a/rbutil/rbutilqt/installbl.cpp
+++ b/rbutil/rbutilqt/installbl.cpp
@@ -152,27 +152,26 @@ void InstallBl::done(bool error)
152void InstallBl::setDeviceSettings(QSettings *dev) 152void InstallBl::setDeviceSettings(QSettings *dev)
153{ 153{
154 devices = dev; 154 devices = dev;
155
156 if(userSettings->value("defaults/platform").toString() == "h100" ||
157 userSettings->value("defaults/platform").toString() == "h120" ||
158 userSettings->value("defaults/platform").toString() == "h300")
159 {
160 ui.buttonBrowseOF->show();
161 ui.lineOriginalFirmware->show();
162 ui.label_3->show();
163 needextrafile = true;
164 }
165 else
166 {
167 ui.buttonBrowseOF->hide();
168 ui.lineOriginalFirmware->hide();
169 ui.label_3->hide();
170 needextrafile = false;
171 }
172 qDebug() << "Install::setDeviceSettings:" << devices; 155 qDebug() << "Install::setDeviceSettings:" << devices;
173} 156}
174 157
175void InstallBl::setUserSettings(QSettings *user) 158void InstallBl::setUserSettings(QSettings *user)
176{ 159{
177 userSettings = user; 160 userSettings = user;
161 if(userSettings->value("defaults/platform").toString() == "h100" ||
162 userSettings->value("defaults/platform").toString() == "h120" ||
163 userSettings->value("defaults/platform").toString() == "h300")
164 {
165 ui.buttonBrowseOF->show();
166 ui.lineOriginalFirmware->show();
167 ui.label_3->show();
168 needextrafile = true;
169 }
170 else
171 {
172 ui.buttonBrowseOF->hide();
173 ui.lineOriginalFirmware->hide();
174 ui.label_3->hide();
175 needextrafile = false;
176 }
178} 177}
diff --git a/rbutil/rbutilqt/installtalkfrm.ui b/rbutil/rbutilqt/installtalkfrm.ui
new file mode 100644
index 0000000000..d43326dd6e
--- /dev/null
+++ b/rbutil/rbutilqt/installtalkfrm.ui
@@ -0,0 +1,268 @@
1<ui version="4.0" >
2 <class>InstallTalkFrm</class>
3 <widget class="QDialog" name="InstallTalkFrm" >
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>681</width>
12 <height>516</height>
13 </rect>
14 </property>
15 <property name="windowTitle" >
16 <string>Install Talk Files</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="5" >
33 <widget class="QLabel" name="label_2" >
34 <property name="text" >
35 <string>Select the Folder to generate Talkfiles for.</string>
36 </property>
37 </widget>
38 </item>
39 <item row="1" column="1" colspan="4" >
40 <widget class="QLineEdit" name="lineTalkFolder" />
41 </item>
42 <item row="1" column="5" >
43 <widget class="QPushButton" name="buttonBrowse" >
44 <property name="text" >
45 <string>&amp;Browse</string>
46 </property>
47 <property name="icon" >
48 <iconset resource="rbutilqt.qrc" >:/icons/icons/system-search.png</iconset>
49 </property>
50 </widget>
51 </item>
52 <item row="2" column="1" colspan="5" >
53 <widget class="QGroupBox" name="groupBox" >
54 <property name="title" >
55 <string>TTS Engine</string>
56 </property>
57 <layout class="QGridLayout" >
58 <item row="0" column="0" colspan="2" >
59 <widget class="QLabel" name="label_3" >
60 <property name="text" >
61 <string>Select a TTS Engine</string>
62 </property>
63 </widget>
64 </item>
65 <item row="1" column="0" colspan="2" >
66 <widget class="QComboBox" name="TTScbx" />
67 </item>
68 <item row="2" column="0" colspan="2" >
69 <widget class="QLabel" name="label_4" >
70 <property name="text" >
71 <string>Select the TTS executable in your Filesystem</string>
72 </property>
73 </widget>
74 </item>
75 <item row="3" column="0" >
76 <widget class="QLineEdit" name="TTSpath" />
77 </item>
78 <item row="3" column="1" >
79 <widget class="QPushButton" name="buttonBrowseTTS" >
80 <property name="text" >
81 <string>Browse</string>
82 </property>
83 </widget>
84 </item>
85 <item row="4" column="0" >
86 <widget class="QLabel" name="label_7" >
87 <property name="text" >
88 <string>TTS Options</string>
89 </property>
90 </widget>
91 </item>
92 <item row="5" column="0" colspan="2" >
93 <widget class="QLineEdit" name="TTSOptions" />
94 </item>
95 </layout>
96 </widget>
97 </item>
98 <item row="3" column="1" colspan="5" >
99 <widget class="QGroupBox" name="groupBox_2" >
100 <property name="title" >
101 <string>Encoder Engine</string>
102 </property>
103 <layout class="QGridLayout" >
104 <item row="0" column="0" colspan="2" >
105 <widget class="QLabel" name="label_5" >
106 <property name="text" >
107 <string>Select an Encoder</string>
108 </property>
109 </widget>
110 </item>
111 <item row="1" column="0" colspan="2" >
112 <widget class="QComboBox" name="Encodercbx" />
113 </item>
114 <item row="2" column="0" colspan="2" >
115 <widget class="QLabel" name="label_6" >
116 <property name="text" >
117 <string>Select the Encoder executable in your Filesystem</string>
118 </property>
119 </widget>
120 </item>
121 <item row="3" column="0" >
122 <widget class="QLineEdit" name="Encoderpath" />
123 </item>
124 <item row="3" column="1" >
125 <widget class="QPushButton" name="buttonBrowseEncoder" >
126 <property name="text" >
127 <string>Browse</string>
128 </property>
129 </widget>
130 </item>
131 <item row="4" column="0" >
132 <widget class="QLabel" name="label_8" >
133 <property name="text" >
134 <string>Encoder Options</string>
135 </property>
136 </widget>
137 </item>
138 <item row="5" column="0" colspan="2" >
139 <widget class="QLineEdit" name="EncoderOptions" />
140 </item>
141 </layout>
142 </widget>
143 </item>
144 <item row="4" column="1" >
145 <widget class="QCheckBox" name="OverwriteWav" >
146 <property name="text" >
147 <string>Overwrite Wavefiles</string>
148 </property>
149 </widget>
150 </item>
151 <item row="4" column="2" >
152 <widget class="QCheckBox" name="RemoveWav" >
153 <property name="text" >
154 <string>Remove Wavefiles</string>
155 </property>
156 </widget>
157 </item>
158 <item row="4" column="3" colspan="2" >
159 <widget class="QCheckBox" name="recursive" >
160 <property name="text" >
161 <string>Run recursive</string>
162 </property>
163 </widget>
164 </item>
165 <item row="5" column="1" >
166 <widget class="QCheckBox" name="OverwriteTalk" >
167 <property name="text" >
168 <string>Overwrite Talkfiles</string>
169 </property>
170 </widget>
171 </item>
172 <item row="5" column="2" >
173 <widget class="QCheckBox" name="StripExtensions" >
174 <property name="text" >
175 <string>Strip Extensions</string>
176 </property>
177 </widget>
178 </item>
179 <item row="5" column="4" >
180 <spacer>
181 <property name="orientation" >
182 <enum>Qt::Vertical</enum>
183 </property>
184 <property name="sizeHint" >
185 <size>
186 <width>20</width>
187 <height>111</height>
188 </size>
189 </property>
190 </spacer>
191 </item>
192 <item row="6" column="1" colspan="3" >
193 <spacer>
194 <property name="orientation" >
195 <enum>Qt::Horizontal</enum>
196 </property>
197 <property name="sizeHint" >
198 <size>
199 <width>40</width>
200 <height>20</height>
201 </size>
202 </property>
203 </spacer>
204 </item>
205 <item row="6" column="4" colspan="2" >
206 <layout class="QHBoxLayout" >
207 <item>
208 <widget class="QPushButton" name="buttonOk" >
209 <property name="text" >
210 <string>&amp;Ok</string>
211 </property>
212 <property name="icon" >
213 <iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset>
214 </property>
215 </widget>
216 </item>
217 <item>
218 <widget class="QPushButton" name="buttonCancel" >
219 <property name="text" >
220 <string>&amp;Cancel</string>
221 </property>
222 <property name="icon" >
223 <iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset>
224 </property>
225 </widget>
226 </item>
227 </layout>
228 </item>
229 </layout>
230 </widget>
231 <resources>
232 <include location="rbutilqt.qrc" />
233 </resources>
234 <connections>
235 <connection>
236 <sender>buttonOk</sender>
237 <signal>clicked()</signal>
238 <receiver>InstallTalkFrm</receiver>
239 <slot>accept()</slot>
240 <hints>
241 <hint type="sourcelabel" >
242 <x>472</x>
243 <y>418</y>
244 </hint>
245 <hint type="destinationlabel" >
246 <x>382</x>
247 <y>328</y>
248 </hint>
249 </hints>
250 </connection>
251 <connection>
252 <sender>buttonCancel</sender>
253 <signal>clicked()</signal>
254 <receiver>InstallTalkFrm</receiver>
255 <slot>reject()</slot>
256 <hints>
257 <hint type="sourcelabel" >
258 <x>561</x>
259 <y>428</y>
260 </hint>
261 <hint type="destinationlabel" >
262 <x>522</x>
263 <y>332</y>
264 </hint>
265 </hints>
266 </connection>
267 </connections>
268</ui>
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
new file mode 100644
index 0000000000..4d1cdb1491
--- /dev/null
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -0,0 +1,264 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Riebeling
10 * $Id: installtalkwindow.cpp 14151 2007-08-02 22:27:51Z bluebrother $
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 "installtalkwindow.h"
21#include "ui_installtalkfrm.h"
22
23InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
24{
25 ui.setupUi(this);
26 talkcreator = new TalkFileCreator(this);
27
28 connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
29 connect(ui.buttonBrowseTTS, SIGNAL(clicked()), this, SLOT(browseTTS()));
30 connect(ui.buttonBrowseEncoder, SIGNAL(clicked()), this, SLOT(browseEncoder()));
31
32 connect(ui.Encodercbx,SIGNAL(currentIndexChanged(int)),this,SLOT(setEncoderOptions(int)));
33 connect(ui.TTScbx,SIGNAL(currentIndexChanged(int)),this,SLOT(setTTSOptions(int)));
34
35 ui.OverwriteWav->setChecked(true);
36 ui.RemoveWav->setChecked(true);
37 ui.recursive->setChecked(true);
38 ui.OverwriteTalk->setChecked(true);
39 ui.StripExtensions->setChecked(true);
40
41
42}
43
44void InstallTalkWindow::browseFolder()
45{
46 QFileDialog browser(this);
47 if(QFileInfo(ui.lineTalkFolder->text()).isDir())
48 browser.setDirectory(ui.lineTalkFolder->text());
49 else
50 browser.setDirectory("/media");
51 browser.setReadOnly(true);
52 browser.setFileMode(QFileDialog::DirectoryOnly);
53 browser.setAcceptMode(QFileDialog::AcceptOpen);
54 if(browser.exec()) {
55 qDebug() << browser.directory();
56 QStringList files = browser.selectedFiles();
57 setTalkFolder(files.at(0));
58 }
59}
60
61void InstallTalkWindow::setTalkFolder(QString folder)
62{
63 ui.lineTalkFolder->clear();
64 ui.lineTalkFolder->insert(folder);
65}
66
67void InstallTalkWindow::browseTTS()
68{
69 QFileDialog browser(this);
70 if(QFileInfo(ui.TTSpath->text()).isDir())
71 browser.setDirectory(ui.TTSpath->text());
72 else
73 browser.setDirectory("/media");
74 browser.setReadOnly(true);
75 browser.setFileMode(QFileDialog::ExistingFile);
76 browser.setAcceptMode(QFileDialog::AcceptOpen);
77 if(browser.exec()) {
78 qDebug() << browser.directory();
79 QStringList files = browser.selectedFiles();
80 setTTSExec(files.at(0));
81 }
82}
83
84void InstallTalkWindow::setTTSExec(QString path)
85{
86 ui.TTSpath->clear();
87 ui.TTSpath->insert(path);
88}
89
90void InstallTalkWindow::browseEncoder()
91{
92 QFileDialog browser(this);
93 if(QFileInfo(ui.Encoderpath->text()).isDir())
94 browser.setDirectory(ui.Encoderpath->text());
95 else
96 browser.setDirectory("/media");
97 browser.setReadOnly(true);
98 browser.setFileMode(QFileDialog::ExistingFile);
99 browser.setAcceptMode(QFileDialog::AcceptOpen);
100 if(browser.exec()) {
101 qDebug() << browser.directory();
102 QStringList files = browser.selectedFiles();
103 setEncoderExec(files.at(0));
104 }
105}
106
107void InstallTalkWindow::setEncoderExec(QString path)
108{
109 ui.Encoderpath->clear();
110 ui.Encoderpath->insert(path);
111}
112
113void InstallTalkWindow::setEncoderOptions(int index)
114{
115 QString options = talkcreator->getEncOpts(ui.Encodercbx->itemText(index));
116 setEncoderOptions(options);
117}
118void InstallTalkWindow::setEncoderOptions(QString options)
119{
120 ui.EncoderOptions->clear();
121 ui.EncoderOptions->insert(options);
122}
123void InstallTalkWindow::setTTSOptions(QString options)
124{
125 ui.TTSOptions->clear();
126 ui.TTSOptions->insert(options);
127}
128void InstallTalkWindow::setTTSOptions(int index)
129{
130 QString options = talkcreator->getTTsOpts(ui.TTScbx->itemText(index));
131 setEncoderOptions(options);
132}
133
134void InstallTalkWindow::accept()
135{
136 logger = new ProgressLoggerGui(this);
137 logger->show();
138
139 QString folderToTalk = ui.lineTalkFolder->text();
140 QString pathEncoder = ui.Encoderpath->text();
141 QString pathTTS = ui.TTSpath->text();
142
143 if(!QFileInfo(folderToTalk).isDir())
144 {
145 logger->addItem(tr("The Folder to Talk is wrong!"),LOGERROR);
146 logger->abort();
147 return;
148 }
149
150 if(!QFileInfo(pathEncoder).exists())
151 {
152 logger->addItem(tr("Path to Encoder is wrong!"),LOGERROR);
153 logger->abort();
154 return;
155 }
156
157 if(!QFileInfo(pathTTS).exists())
158 {
159 logger->addItem(tr("Path to TTS is wrong!"),LOGERROR);
160 logger->abort();
161 return;
162 }
163
164 userSettings->setValue("defaults/folderToTalk",folderToTalk);
165 userSettings->setValue("defaults/pathEncoder",pathEncoder);
166 userSettings->setValue("defaults/pathTTS",pathTTS);
167
168 userSettings->sync();
169
170 talkcreator->setDir(folderToTalk);
171 talkcreator->setTTSexe(pathTTS);
172 talkcreator->setEncexe(pathEncoder);
173 talkcreator->setEncOpts(ui.EncoderOptions->text());
174 talkcreator->setTTsOpts(ui.TTSOptions->text());
175 talkcreator->setTTsType(ui.TTScbx->currentText());
176 talkcreator->setEncType(ui.Encodercbx->currentText());
177
178 talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
179 talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked());
180 talkcreator->setRemoveWav(ui.RemoveWav->isChecked());
181 talkcreator->setRecursive(ui.recursive->isChecked());
182 talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
183
184 talkcreator->createTalkFiles(logger);
185}
186
187
188void InstallTalkWindow::setDeviceSettings(QSettings *dev)
189{
190 devices = dev;
191 qDebug() << "Install::setDeviceSettings:" << devices;
192
193 QStringList encoders;
194 QStringList encodersOpts;
195 QStringList encodersTemplates;
196
197 QStringList tts;
198 QStringList ttsOpts;
199 QStringList ttsTemplates;
200
201 devices->beginGroup("encoders");
202 QStringList keys = devices->allKeys();
203 qDebug() << keys;
204 for(int i=0; i < keys.size();i++)
205 {
206 encoders << devices->value(keys.at(i),"null").toString();
207 }
208 qDebug() << encoders;
209 devices->endGroup();
210 for(int i=0; i < encoders.size();i++)
211 {
212 devices->beginGroup(encoders.at(i));
213 encodersOpts << devices->value("options","null").toString();
214 encodersTemplates << devices->value("template","null").toString();
215 devices->endGroup();
216 }
217 qDebug() << encodersOpts;
218 qDebug() << encodersTemplates;
219
220 devices->beginGroup("tts");
221 keys = devices->allKeys();
222 qDebug() << keys;
223 for(int i=0; i < keys.size();i++)
224 {
225 tts << devices->value(keys.at(i),"null").toString();
226 }
227 qDebug() << tts;
228 devices->endGroup();
229 for(int i= 0; i < tts.size();i++)
230 {
231 devices->beginGroup(tts.at(i));
232 ttsOpts << devices->value("options","null").toString();
233 ttsTemplates << devices->value("template","null").toString();
234 devices->endGroup();
235 }
236 qDebug() << ttsOpts;
237 qDebug() << ttsTemplates;
238
239 talkcreator->setSupportedEnc(encoders);
240 talkcreator->setSupportedEncOptions(encodersOpts);
241 talkcreator->setSupportedEncTemplates(encodersTemplates);
242
243 talkcreator->setSupportedTTS(tts);
244 talkcreator->setSupportedTTSOptions(ttsOpts);
245 talkcreator->setSupportedTTSTemplates(ttsTemplates);
246
247 ui.Encodercbx->insertItems(0,talkcreator->getSupportedEnc());
248 ui.TTScbx->insertItems(0,talkcreator->getSupportedTTS());
249
250}
251
252
253
254
255void InstallTalkWindow::setUserSettings(QSettings *user)
256{
257 userSettings = user;
258
259
260
261 setTalkFolder(userSettings->value("defaults/folderToTalk").toString());
262 setEncoderExec(userSettings->value("defaults/pathEncoder").toString());
263 setTTSExec(userSettings->value("defaults/pathTTS").toString());
264}
diff --git a/rbutil/rbutilqt/installtalkwindow.h b/rbutil/rbutilqt/installtalkwindow.h
new file mode 100644
index 0000000000..1962d36a52
--- /dev/null
+++ b/rbutil/rbutilqt/installtalkwindow.h
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: installtalkwindow.h 14151 2007-08-02 22:27:51Z 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 INSTALLTALKWINDOW_H
21#define INSTALLTALKWINDOW_H
22
23#include <QtGui>
24
25#include <QSettings>
26
27#include "ui_installtalkfrm.h"
28#include "progressloggergui.h"
29#include "talkfile.h"
30
31class InstallTalkWindow : public QDialog
32{
33 Q_OBJECT
34 public:
35 InstallTalkWindow(QWidget *parent = 0);
36 void setUserSettings(QSettings*);
37 void setDeviceSettings(QSettings*);
38
39 public slots:
40 void accept(void);
41
42 private slots:
43 void browseFolder(void);
44 void browseTTS(void);
45 void browseEncoder(void);
46
47 void setTalkFolder(QString folder);
48 void setTTSExec(QString path);
49 void setEncoderExec(QString path);
50
51 void setEncoderOptions(int index);
52 void setTTSOptions(int index);
53 void setEncoderOptions(QString options);
54 void setTTSOptions(QString options);
55
56 private:
57 TalkFileCreator* talkcreator;
58 Ui::InstallTalkFrm ui;
59 ProgressLoggerGui* logger;
60 QSettings *devices;
61 QSettings *userSettings;
62
63};
64
65
66#endif
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini
index c3d962952a..4052ef45e5 100644
--- a/rbutil/rbutilqt/rbutil.ini
+++ b/rbutil/rbutilqt/rbutil.ini
@@ -337,3 +337,21 @@ resolution=176x220x16
337manualname= 337manualname=
338brand=Sandisk 338brand=Sandisk
339 339
340[encoders]
341encoder01 = lame
342
343[tts]
344tts01 = espeak
345tts02 = flite
346
347[lame]
348options = ""
349template = "\"%exe\" %options \"%input\" \"%output\""
350
351[espeak]
352options = ""
353template = "\"%exe\" %options -w \"%wavfile\" \"%text\""
354
355[flite]
356options = ""
357template = "\"%exe\" %options -o \"%wavfile\" \"%text\"" \ No newline at end of file
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 5fcfc39d18..8cacdfc78b 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 "installbl.h" 28#include "installbl.h"
29#include "installtalkwindow.h"
29#include "httpget.h" 30#include "httpget.h"
30#include "installbootloader.h" 31#include "installbootloader.h"
31 32
@@ -78,7 +79,9 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
78 connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBl())); 79 connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBl()));
79 connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFonts())); 80 connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFonts()));
80 connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoom())); 81 connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoom()));
81 82 connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
83
84
82 // disable unimplemented stuff 85 // disable unimplemented stuff
83 ui.buttonThemes->setEnabled(false); 86 ui.buttonThemes->setEnabled(false);
84 ui.buttonSmall->setEnabled(false); 87 ui.buttonSmall->setEnabled(false);
@@ -345,3 +348,12 @@ void RbUtilQt::installDoom()
345 348
346} 349}
347 350
351
352void RbUtilQt::createTalkFiles(void)
353{
354 InstallTalkWindow *installWindow = new InstallTalkWindow(this);
355 installWindow->setUserSettings(userSettings);
356 installWindow->setDeviceSettings(devices);
357 installWindow->show();
358
359}
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h
index 50bca0b4fa..e23188a136 100644
--- a/rbutil/rbutilqt/rbutilqt.h
+++ b/rbutil/rbutilqt/rbutilqt.h
@@ -59,6 +59,7 @@ class RbUtilQt : public QMainWindow
59 void installBl(void); 59 void installBl(void);
60 void installFonts(void); 60 void installFonts(void);
61 void installDoom(void); 61 void installDoom(void);
62 void createTalkFiles(void);
62 void downloadDone(bool); 63 void downloadDone(bool);
63 void downloadDone(int, bool); 64 void downloadDone(int, bool);
64 void downloadInfo(void); 65 void downloadInfo(void);
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index 217451cf1b..56d471df65 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -9,6 +9,8 @@ SOURCES += rbutilqt.cpp \
9 installbootloader.cpp \ 9 installbootloader.cpp \
10 installbl.cpp \ 10 installbl.cpp \
11 progressloggergui.cpp \ 11 progressloggergui.cpp \
12 installtalkwindow.cpp \
13 talkfile.cpp \
12 ../ipodpatcher/ipodpatcher.c \ 14 ../ipodpatcher/ipodpatcher.c \
13 ../sansapatcher/sansapatcher.c \ 15 ../sansapatcher/sansapatcher.c \
14 irivertools/irivertools.cpp \ 16 irivertools/irivertools.cpp \
@@ -29,6 +31,8 @@ HEADERS += rbutilqt.h \
29 installzip.h \ 31 installzip.h \
30 installbootloader.h \ 32 installbootloader.h \
31 installbl.h \ 33 installbl.h \
34 installtalkwindow.h \
35 talkfile.h \
32 progressloggerinterface.h \ 36 progressloggerinterface.h \
33 progressloggergui.h \ 37 progressloggergui.h \
34 ../ipodpatcher/ipodpatcher.h \ 38 ../ipodpatcher/ipodpatcher.h \
@@ -55,7 +59,8 @@ FORMS += rbutilqtfrm.ui \
55 installfrm.ui \ 59 installfrm.ui \
56 installprogressfrm.ui \ 60 installprogressfrm.ui \
57 configurefrm.ui \ 61 configurefrm.ui \
58 installbootloaderfrm.ui 62 installbootloaderfrm.ui \
63 installtalkfrm.ui
59 64
60 65
61RESOURCES += rbutilqt.qrc 66RESOURCES += rbutilqt.qrc
diff --git a/rbutil/rbutilqt/rbutilqt.qrc b/rbutil/rbutilqt/rbutilqt.qrc
index e1ba2a2093..3f62c786da 100644
--- a/rbutil/rbutilqt/rbutilqt.qrc
+++ b/rbutil/rbutilqt/rbutilqt.qrc
@@ -21,6 +21,7 @@
21 <file>icons/rembootloader_btn.png</file> 21 <file>icons/rembootloader_btn.png</file>
22 <file>icons/remrb_btn.png</file> 22 <file>icons/remrb_btn.png</file>
23 <file>icons/system-search.png</file> 23 <file>icons/system-search.png</file>
24 <file>icons/talkfile_btn.png</file>
24 <file>icons/themes_btn.png</file> 25 <file>icons/themes_btn.png</file>
25 <file>icons/wizard.xpm</file> 26 <file>icons/wizard.xpm</file>
26 </qresource> 27 </qresource>
diff --git a/rbutil/rbutilqt/rbutilqtfrm.ui b/rbutil/rbutilqt/rbutilqtfrm.ui
index c8135de184..afa3bb0e76 100644
--- a/rbutil/rbutilqt/rbutilqtfrm.ui
+++ b/rbutil/rbutilqt/rbutilqtfrm.ui
@@ -130,7 +130,7 @@ p, li { white-space: pre-wrap; }
130 <item row="2" column="0" > 130 <item row="2" column="0" >
131 <widget class="QTabWidget" name="tabWidget" > 131 <widget class="QTabWidget" name="tabWidget" >
132 <property name="currentIndex" > 132 <property name="currentIndex" >
133 <number>0</number> 133 <number>2</number>
134 </property> 134 </property>
135 <widget class="QWidget" name="quickStart" > 135 <widget class="QWidget" name="quickStart" >
136 <attribute name="title" > 136 <attribute name="title" >
@@ -436,7 +436,7 @@ p, li { white-space: pre-wrap; }
436 </property> 436 </property>
437 </widget> 437 </widget>
438 </item> 438 </item>
439 <item row="3" column="0" > 439 <item row="4" column="0" >
440 <spacer> 440 <spacer>
441 <property name="orientation" > 441 <property name="orientation" >
442 <enum>Qt::Vertical</enum> 442 <enum>Qt::Vertical</enum>
@@ -449,7 +449,7 @@ p, li { white-space: pre-wrap; }
449 </property> 449 </property>
450 </spacer> 450 </spacer>
451 </item> 451 </item>
452 <item row="3" column="1" > 452 <item row="4" column="1" >
453 <spacer> 453 <spacer>
454 <property name="orientation" > 454 <property name="orientation" >
455 <enum>Qt::Vertical</enum> 455 <enum>Qt::Vertical</enum>
@@ -462,6 +462,33 @@ p, li { white-space: pre-wrap; }
462 </property> 462 </property>
463 </spacer> 463 </spacer>
464 </item> 464 </item>
465 <item row="3" column="0" >
466 <widget class="QToolButton" name="buttonTalk" >
467 <property name="text" >
468 <string>Install Talk files</string>
469 </property>
470 <property name="icon" >
471 <iconset resource="rbutilqt.qrc" >:/icons/icons/talkfile_btn.png</iconset>
472 </property>
473 <property name="iconSize" >
474 <size>
475 <width>56</width>
476 <height>46</height>
477 </size>
478 </property>
479 </widget>
480 </item>
481 <item row="3" column="1" >
482 <widget class="QLabel" name="label" >
483 <property name="text" >
484 <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
485p, li { white-space: pre-wrap; }
486&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
487&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;">Create Talk Files&lt;/span>&lt;/p>
488&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;">&lt;span style=" font-weight:400;">Talkfiles are needed to let Rockbox speak File and Foldernames&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
489 </property>
490 </widget>
491 </item>
465 </layout> 492 </layout>
466 </widget> 493 </widget>
467 <widget class="QWidget" name="uninstall" > 494 <widget class="QWidget" name="uninstall" >
@@ -675,7 +702,7 @@ p, li { white-space: pre-wrap; }
675 <x>0</x> 702 <x>0</x>
676 <y>0</y> 703 <y>0</y>
677 <width>600</width> 704 <width>600</width>
678 <height>29</height> 705 <height>21</height>
679 </rect> 706 </rect>
680 </property> 707 </property>
681 <widget class="QMenu" name="menu_File" > 708 <widget class="QMenu" name="menu_File" >
diff --git a/rbutil/rbutilqt/talkfile.cpp b/rbutil/rbutilqt/talkfile.cpp
new file mode 100644
index 0000000000..da532e327c
--- /dev/null
+++ b/rbutil/rbutilqt/talkfile.cpp
@@ -0,0 +1,212 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: talkfile.cpp 14027 2007-07-27 17:42:49Z 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 "talkfile.h"
21
22TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent)
23{
24
25}
26
27void TalkFileCreator::setTTsType(QString tts)
28{
29 m_curTTS = tts;
30 int index = m_supportedTTS.indexOf(m_curTTS);
31 m_curTTSTemplate = m_supportedTTSTemplates.at(index);
32}
33
34void TalkFileCreator::setEncType(QString enc)
35{
36 m_curEnc = enc;
37 int index = m_supportedEnc.indexOf(m_curEnc);
38 m_curEncTemplate = m_supportedEncTemplates.at(index);
39}
40
41bool TalkFileCreator::initEncoder()
42{
43 QFileInfo enc(m_EncExec);
44 if(enc.exists())
45 {
46 return true;
47 }
48 else
49 {
50 return false;
51 }
52}
53
54bool TalkFileCreator::initTTS()
55{
56 QFileInfo tts(m_TTSexec);
57
58 if(tts.exists())
59 {
60 return true;
61 }
62 else
63 {
64 return false;
65 }
66}
67
68bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
69{
70 m_abort = false;
71 m_logger = logger;
72 m_logger->addItem("Starting Talkfile generation",LOGINFO);
73 if(!initTTS())
74 {
75 m_logger->addItem("Init of TTS engine failed",LOGERROR);
76 return false;
77 }
78 if(!initEncoder())
79 {
80 m_logger->addItem("Init of encoder failed",LOGERROR);
81 return false;
82 }
83 QApplication::processEvents();
84
85 connect(logger,SIGNAL(aborted()),this,SLOT(abort()));
86 m_logger->setProgressMax(0);
87 QDirIterator it(m_dir,QDirIterator::Subdirectories);
88 // iterate over all entrys
89 while (it.hasNext())
90 {
91 if(m_abort)
92 {
93 m_logger->addItem("Talkfile creation aborted",LOGERROR);
94 return false;
95 }
96
97 QApplication::processEvents();
98 QFileInfo fileInf = it.fileInfo();
99 QString toSpeak;
100 QString filename;
101 QString wavfilename;
102
103 if(fileInf.fileName() == "." || fileInf.fileName() == ".." || fileInf.suffix() == "talk")
104 {
105 it.next();
106 continue;
107 }
108 if(fileInf.isDir()) // if it is a dir
109 {
110 toSpeak = fileInf.fileName();
111 filename = fileInf.absolutePath() + "/_dirname.talk";
112 }
113 else // if it is a file
114 {
115 if(m_stripExtensions)
116 toSpeak = fileInf.baseName();
117 else
118 toSpeak = fileInf.fileName();
119 filename = fileInf.absoluteFilePath() + ".talk";
120 }
121 wavfilename = filename + ".wav";
122
123 QFileInfo filenameInf(filename);
124 QFileInfo wavfilenameInf(wavfilename);
125
126 if(!filenameInf.exists() || m_overwriteTalk)
127 {
128 if(!wavfilenameInf.exists() || m_overwriteWav)
129 {
130 m_logger->addItem("Voicing of " + toSpeak,LOGINFO);
131 if(!voice(toSpeak,wavfilename))
132 {
133 m_logger->addItem("Voicing of " + toSpeak + " failed",LOGERROR);
134 m_logger->abort();
135 return false;
136 }
137 }
138 m_logger->addItem("Encoding of " + toSpeak,LOGINFO);
139 if(!encode(wavfilename,filename))
140 {
141 m_logger->addItem("Encoding of " + wavfilename + " failed",LOGERROR);
142 m_logger->abort();
143 return false;
144 }
145 }
146
147 if(m_removeWav)
148 {
149 QFile wavfile(wavfilename);
150 wavfile.remove();
151 }
152
153 it.next();
154 }
155
156 m_logger->addItem("Finished creating Talkfiles",LOGOK);
157 m_logger->setProgressMax(1);
158 m_logger->setProgressValue(1);
159 m_logger->abort();
160
161 return true;
162
163}
164
165void TalkFileCreator::abort()
166{
167 m_abort = true;
168}
169
170bool TalkFileCreator::voice(QString text,QString wavfile)
171{
172
173 QString execstring = m_curTTSTemplate;
174
175 execstring.replace("%exe",m_TTSexec);
176 execstring.replace("%options",m_TTSOpts);
177 execstring.replace("%wavfile",wavfile);
178 execstring.replace("%text",text);
179
180 QProcess::execute(execstring);
181 return true;
182
183}
184
185bool TalkFileCreator::encode(QString input,QString output)
186{
187 QString execstring = m_curEncTemplate;
188
189 execstring.replace("%exe",m_EncExec);
190 execstring.replace("%options",m_EncOpts);
191 execstring.replace("%input",input);
192 execstring.replace("%output",output);
193
194 QProcess::execute(execstring);
195 return true;
196
197}
198
199QString TalkFileCreator::getTTsOpts(QString ttsname)
200{
201 int index = m_supportedTTS.indexOf(ttsname);
202
203 return m_supportedTTSOpts.at(index);
204}
205
206QString TalkFileCreator::getEncOpts(QString encname)
207{
208 int index = m_supportedEnc.indexOf(encname);
209
210 return m_supportedEncOpts.at(index);
211}
212
diff --git a/rbutil/rbutilqt/talkfile.h b/rbutil/rbutilqt/talkfile.h
new file mode 100644
index 0000000000..20bf1e5a70
--- /dev/null
+++ b/rbutil/rbutilqt/talkfile.h
@@ -0,0 +1,105 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: talkfile.h 14027 2007-07-27 17:42:49Z 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 TALKFILE_H
22#define TALKFILE_H
23
24#include "progressloggerinterface.h"
25
26class TalkFileCreator :public QObject
27{
28 Q_OBJECT
29
30public:
31 TalkFileCreator(QObject* parent=0);
32
33 bool createTalkFiles(ProgressloggerInterface* logger);
34
35 void setTTSexe(QString exe){m_TTSexec=exe;}
36 void setEncexe(QString exe){m_EncExec=exe;}
37
38 void setSupportedTTS(QStringList list) {m_supportedTTS=list;}
39 void setSupportedTTSOptions(QStringList list) {m_supportedTTSOpts=list;}
40 void setSupportedTTSTemplates(QStringList list) {m_supportedTTSTemplates=list;}
41
42 QStringList getSupportedTTS(){return m_supportedTTS;}
43 void setTTsType(QString tts);
44 QString getTTsOpts(QString ttsname);
45 void setTTsOpts(QString opts) {m_TTSOpts=opts;}
46
47 void setSupportedEnc(QStringList list) {m_supportedEnc=list;}
48 void setSupportedEncOptions(QStringList list) {m_supportedEncOpts=list;}
49 void setSupportedEncTemplates(QStringList list) {m_supportedEncTemplates=list;}
50
51 QStringList getSupportedEnc(){return m_supportedEnc;}
52 void setEncType(QString enc);
53 QString getEncOpts(QString encname);
54 void setEncOpts(QString opts) {m_EncOpts=opts;}
55
56 void setDir(QString dir){m_dir = dir; }
57
58 void setOverwriteTalk(bool ov) {m_overwriteTalk = ov;}
59 void setOverwriteWav(bool ov) {m_overwriteWav = ov;}
60 void setRemoveWav(bool ov) {m_removeWav = ov;}
61 void setRecursive(bool ov) {m_recursive = ov;}
62 void setStripExtensions(bool ov) {m_stripExtensions = ov;}
63
64private slots:
65 void abort();
66
67private:
68
69 bool initTTS();
70 bool stopTTS();
71 bool initEncoder();
72
73 bool encode(QString input,QString output);
74 bool voice(QString text,QString wavfile);
75
76 QString m_dir;
77
78 QString m_curTTS;
79 QString m_TTSexec;
80 QStringList m_supportedTTS;
81 QStringList m_supportedTTSOpts;
82 QStringList m_supportedTTSTemplates;
83 QString m_TTSOpts;
84 QString m_curTTSTemplate;
85
86 QString m_curEnc;
87 QString m_EncExec;
88 QStringList m_supportedEnc;
89 QStringList m_supportedEncOpts;
90 QStringList m_supportedEncTemplates;
91 QString m_EncOpts;
92 QString m_curEncTemplate;
93
94 bool m_overwriteTalk;
95 bool m_overwriteWav;
96 bool m_removeWav;
97 bool m_recursive;
98 bool m_stripExtensions;
99
100 ProgressloggerInterface* m_logger;
101
102 bool m_abort;
103};
104
105#endif