summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2008-05-27 20:02:25 +0000
committerDominik Wenger <domonoky@googlemail.com>2008-05-27 20:02:25 +0000
commitae4b677736032176459f7adbb65c5386cfc089fb (patch)
tree91d7998b2118eb0368ba383f9507709cfff385c9
parent819a39a22eb33fda4f3605258f3ca1416590b405 (diff)
downloadrockbox-ae4b677736032176459f7adbb65c5386cfc089fb.tar.gz
rockbox-ae4b677736032176459f7adbb65c5386cfc089fb.zip
rbutil: improve talkfile generation. remove the options to keep and overwrite the wavfiles.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17637 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/encoders.cpp2
-rw-r--r--rbutil/rbutilqt/installtalkfrm.ui58
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp8
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp2
-rw-r--r--rbutil/rbutilqt/talkfile.cpp32
5 files changed, 47 insertions, 55 deletions
diff --git a/rbutil/rbutilqt/encoders.cpp b/rbutil/rbutilqt/encoders.cpp
index f9ce05479a..6532a0c65b 100644
--- a/rbutil/rbutilqt/encoders.cpp
+++ b/rbutil/rbutilqt/encoders.cpp
@@ -182,7 +182,7 @@ bool EncRbSpeex::start()
182 182
183bool EncRbSpeex::encode(QString input,QString output) 183bool EncRbSpeex::encode(QString input,QString output)
184{ 184{
185 //qDebug() << "encoding 185 qDebug() << "encoding " << input << " to "<< output;
186 char errstr[512]; 186 char errstr[512];
187 187
188 FILE *fin,*fout; 188 FILE *fin,*fout;
diff --git a/rbutil/rbutilqt/installtalkfrm.ui b/rbutil/rbutilqt/installtalkfrm.ui
index 5a899f8c74..9e183e15a9 100644
--- a/rbutil/rbutilqt/installtalkfrm.ui
+++ b/rbutil/rbutilqt/installtalkfrm.ui
@@ -15,7 +15,7 @@
15 <property name="windowTitle" > 15 <property name="windowTitle" >
16 <string>Install Talk Files</string> 16 <string>Install Talk Files</string>
17 </property> 17 </property>
18 <layout class="QGridLayout" > 18 <layout class="QGridLayout" name="gridLayout_2" >
19 <item rowspan="6" row="0" column="0" > 19 <item rowspan="6" row="0" column="0" >
20 <widget class="QLabel" name="label" > 20 <widget class="QLabel" name="label" >
21 <property name="text" > 21 <property name="text" >
@@ -45,7 +45,8 @@
45 <string>&amp;Browse</string> 45 <string>&amp;Browse</string>
46 </property> 46 </property>
47 <property name="icon" > 47 <property name="icon" >
48 <iconset resource="rbutilqt.qrc" >:/icons/system-search.png</iconset> 48 <iconset resource="rbutilqt.qrc" >
49 <normaloff>:/icons/system-search.png</normaloff>:/icons/system-search.png</iconset>
49 </property> 50 </property>
50 </widget> 51 </widget>
51 </item> 52 </item>
@@ -87,7 +88,7 @@
87 <property name="orientation" > 88 <property name="orientation" >
88 <enum>Qt::Horizontal</enum> 89 <enum>Qt::Horizontal</enum>
89 </property> 90 </property>
90 <property name="sizeHint" > 91 <property name="sizeHint" stdset="0" >
91 <size> 92 <size>
92 <width>40</width> 93 <width>40</width>
93 <height>20</height> 94 <height>20</height>
@@ -103,28 +104,8 @@
103 <property name="title" > 104 <property name="title" >
104 <string>Generation options</string> 105 <string>Generation options</string>
105 </property> 106 </property>
106 <layout class="QGridLayout" > 107 <layout class="QGridLayout" name="gridLayout" >
107 <item row="2" column="0" > 108 <item row="2" column="0" colspan="2" >
108 <widget class="QCheckBox" name="OverwriteWav" >
109 <property name="text" >
110 <string>Overwrite Wavefiles</string>
111 </property>
112 <property name="checked" >
113 <bool>true</bool>
114 </property>
115 </widget>
116 </item>
117 <item row="3" column="0" >
118 <widget class="QCheckBox" name="RemoveWav" >
119 <property name="text" >
120 <string>Remove Wavefiles</string>
121 </property>
122 <property name="checked" >
123 <bool>true</bool>
124 </property>
125 </widget>
126 </item>
127 <item row="4" column="0" >
128 <widget class="QCheckBox" name="recursive" > 109 <widget class="QCheckBox" name="recursive" >
129 <property name="text" > 110 <property name="text" >
130 <string>Run recursive</string> 111 <string>Run recursive</string>
@@ -134,7 +115,7 @@
134 </property> 115 </property>
135 </widget> 116 </widget>
136 </item> 117 </item>
137 <item row="5" column="0" > 118 <item row="3" column="0" colspan="2" >
138 <widget class="QCheckBox" name="StripExtensions" > 119 <widget class="QCheckBox" name="StripExtensions" >
139 <property name="text" > 120 <property name="text" >
140 <string>Strip Extensions</string> 121 <string>Strip Extensions</string>
@@ -144,7 +125,7 @@
144 </property> 125 </property>
145 </widget> 126 </widget>
146 </item> 127 </item>
147 <item row="6" column="0" > 128 <item row="4" column="0" colspan="2" >
148 <widget class="QCheckBox" name="OverwriteTalk" > 129 <widget class="QCheckBox" name="OverwriteTalk" >
149 <property name="text" > 130 <property name="text" >
150 <string>Overwrite Talkfiles</string> 131 <string>Overwrite Talkfiles</string>
@@ -154,7 +135,7 @@
154 </property> 135 </property>
155 </widget> 136 </widget>
156 </item> 137 </item>
157 <item row="1" column="0" > 138 <item row="1" column="0" colspan="2" >
158 <widget class="QCheckBox" name="talkFolders" > 139 <widget class="QCheckBox" name="talkFolders" >
159 <property name="text" > 140 <property name="text" >
160 <string>Generate .talk files for Folders</string> 141 <string>Generate .talk files for Folders</string>
@@ -164,7 +145,7 @@
164 </property> 145 </property>
165 </widget> 146 </widget>
166 </item> 147 </item>
167 <item row="0" column="0" > 148 <item row="0" column="0" colspan="2" >
168 <widget class="QCheckBox" name="talkFiles" > 149 <widget class="QCheckBox" name="talkFiles" >
169 <property name="text" > 150 <property name="text" >
170 <string>Generate .talk files for Files</string> 151 <string>Generate .talk files for Files</string>
@@ -178,6 +159,13 @@
178 </widget> 159 </widget>
179 </item> 160 </item>
180 </layout> 161 </layout>
162 <zorder>recursive</zorder>
163 <zorder>StripExtensions</zorder>
164 <zorder>OverwriteTalk</zorder>
165 <zorder>talkFolders</zorder>
166 <zorder>talkFiles</zorder>
167 <zorder>label_3</zorder>
168 <zorder>fileFilter</zorder>
181 </widget> 169 </widget>
182 </item> 170 </item>
183 <item row="4" column="2" > 171 <item row="4" column="2" >
@@ -185,7 +173,7 @@
185 <property name="orientation" > 173 <property name="orientation" >
186 <enum>Qt::Vertical</enum> 174 <enum>Qt::Vertical</enum>
187 </property> 175 </property>
188 <property name="sizeHint" > 176 <property name="sizeHint" stdset="0" >
189 <size> 177 <size>
190 <width>20</width> 178 <width>20</width>
191 <height>40</height> 179 <height>40</height>
@@ -198,7 +186,7 @@
198 <property name="orientation" > 186 <property name="orientation" >
199 <enum>Qt::Horizontal</enum> 187 <enum>Qt::Horizontal</enum>
200 </property> 188 </property>
201 <property name="sizeHint" > 189 <property name="sizeHint" stdset="0" >
202 <size> 190 <size>
203 <width>40</width> 191 <width>40</width>
204 <height>20</height> 192 <height>20</height>
@@ -214,7 +202,8 @@
214 <string>&amp;Install</string> 202 <string>&amp;Install</string>
215 </property> 203 </property>
216 <property name="icon" > 204 <property name="icon" >
217 <iconset resource="rbutilqt.qrc" >:/icons/go-next.png</iconset> 205 <iconset resource="rbutilqt.qrc" >
206 <normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset>
218 </property> 207 </property>
219 </widget> 208 </widget>
220 </item> 209 </item>
@@ -224,7 +213,8 @@
224 <string>&amp;Cancel</string> 213 <string>&amp;Cancel</string>
225 </property> 214 </property>
226 <property name="icon" > 215 <property name="icon" >
227 <iconset resource="rbutilqt.qrc" >:/icons/process-stop.png</iconset> 216 <iconset resource="rbutilqt.qrc" >
217 <normaloff>:/icons/process-stop.png</normaloff>:/icons/process-stop.png</iconset>
228 </property> 218 </property>
229 </widget> 219 </widget>
230 </item> 220 </item>
@@ -238,8 +228,6 @@
238 <tabstop>change</tabstop> 228 <tabstop>change</tabstop>
239 <tabstop>talkFiles</tabstop> 229 <tabstop>talkFiles</tabstop>
240 <tabstop>talkFolders</tabstop> 230 <tabstop>talkFolders</tabstop>
241 <tabstop>OverwriteWav</tabstop>
242 <tabstop>RemoveWav</tabstop>
243 <tabstop>recursive</tabstop> 231 <tabstop>recursive</tabstop>
244 <tabstop>StripExtensions</tabstop> 232 <tabstop>StripExtensions</tabstop>
245 <tabstop>OverwriteTalk</tabstop> 233 <tabstop>OverwriteTalk</tabstop>
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index 1246d53876..16b3b83f21 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -31,8 +31,6 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
31 connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder())); 31 connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
32 connect(ui.change,SIGNAL(clicked()),this,SLOT(change())); 32 connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
33 33
34 ui.OverwriteWav->setChecked(true);
35 ui.RemoveWav->setChecked(true);
36 ui.recursive->setChecked(true); 34 ui.recursive->setChecked(true);
37 ui.OverwriteTalk->setChecked(true); 35 ui.OverwriteTalk->setChecked(true);
38 ui.StripExtensions->setChecked(true); 36 ui.StripExtensions->setChecked(true);
@@ -99,13 +97,13 @@ void InstallTalkWindow::accept()
99 talkcreator->setMountPoint(settings->mountpoint()); 97 talkcreator->setMountPoint(settings->mountpoint());
100 98
101 talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked()); 99 talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
102 talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked()); 100 talkcreator->setOverwriteWav(true);
103 talkcreator->setRemoveWav(ui.RemoveWav->isChecked()); 101 talkcreator->setRemoveWav(true);
104 talkcreator->setRecursive(ui.recursive->isChecked()); 102 talkcreator->setRecursive(ui.recursive->isChecked());
105 talkcreator->setStripExtensions(ui.StripExtensions->isChecked()); 103 talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
106 talkcreator->setTalkFolders(ui.talkFolders->isChecked()); 104 talkcreator->setTalkFolders(ui.talkFolders->isChecked());
107 talkcreator->setTalkFiles(ui.talkFiles->isChecked()); 105 talkcreator->setTalkFiles(ui.talkFiles->isChecked());
108 106
109 talkcreator->createTalkFiles(logger); 107 talkcreator->createTalkFiles(logger);
110} 108}
111 109
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 510feb4743..c1523cb92e 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -172,7 +172,7 @@ void RbUtilQt::downloadDone(bool error)
172 QMessageBox::critical(this, tr("Configuration error"), 172 QMessageBox::critical(this, tr("Configuration error"),
173 tr("Your configuration is invalid. This is most likely due " 173 tr("Your configuration is invalid. This is most likely due "
174 "to a new installation of Rockbox Utility or a changed device " 174 "to a new installation of Rockbox Utility or a changed device "
175 "path. The configuation dialog will now open to allow you " 175 "path. The configuration dialog will now open to allow you "
176 "correcting the problem.")); 176 "correcting the problem."));
177 configDialog(); 177 configDialog();
178 } 178 }
diff --git a/rbutil/rbutilqt/talkfile.cpp b/rbutil/rbutilqt/talkfile.cpp
index 7e5b6a2a0c..37a584e28c 100644
--- a/rbutil/rbutilqt/talkfile.cpp
+++ b/rbutil/rbutilqt/talkfile.cpp
@@ -83,11 +83,12 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
83 QString toSpeak; 83 QString toSpeak;
84 QString filename; 84 QString filename;
85 QString wavfilename; 85 QString wavfilename;
86 QString filepath;
86 87
87 QString path = fileInf.filePath(); 88 QString path = fileInf.filePath();
88 qDebug() << path; 89 qDebug() << path;
89 90
90 if( path.endsWith("..") || path.endsWith(".talk") ) 91 if( path.endsWith("..") || path.endsWith(".") || path.endsWith(".talk") )
91 { 92 {
92 it.next(); 93 it.next();
93 continue; 94 continue;
@@ -102,13 +103,12 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
102 it.next(); 103 it.next();
103 continue; 104 continue;
104 } 105 }
105 int index1 = path.lastIndexOf("/"); 106
106 int index2 = path.lastIndexOf("/",index1-1); 107 toSpeak = fileInf.fileName();
107 108
108 toSpeak = path.mid(index2+1,(index1-index2)-1); 109 filepath = fileInf.filePath() + "/";
109 110 filename = "_dirname.talk";
110 filename = path.left(index1) + "/_dirname.talk"; 111 qDebug() << "toSpeak: " << toSpeak << "filename: " << filename << " path: " <<filepath;
111 qDebug() << "toSpeak: " << toSpeak << "filename: " << filename;
112 } 112 }
113 else // if it is a file 113 else // if it is a file
114 { 114 {
@@ -118,15 +118,21 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
118 it.next(); 118 it.next();
119 continue; 119 continue;
120 } 120 }
121
122 // create toSpeak string
121 if(m_stripExtensions) 123 if(m_stripExtensions)
122 toSpeak = fileInf.baseName(); 124 toSpeak = fileInf.baseName();
123 else 125 else
124 toSpeak = fileInf.fileName(); 126 toSpeak = fileInf.fileName();
125 filename = fileInf.absoluteFilePath() + ".talk"; 127 // create filename and path
128 filepath = fileInf.absolutePath();
129 filename = fileInf.fileName() + ".talk";
130
126 } 131 }
127 wavfilename = filename + ".wav"; 132
133 wavfilename = QDir::tempPath()+ "/"+ filename + ".wav";
128 134
129 QFileInfo filenameInf(filename); 135 QFileInfo filenameInf(filepath+filename);
130 QFileInfo wavfilenameInf(wavfilename); 136 QFileInfo wavfilenameInf(wavfilename);
131 137
132 //! the actual generation of the .talk files 138 //! the actual generation of the .talk files
@@ -147,7 +153,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
147 QCoreApplication::processEvents(); 153 QCoreApplication::processEvents();
148 } 154 }
149 m_logger->addItem(tr("Encoding of %1").arg(toSpeak),LOGINFO); 155 m_logger->addItem(tr("Encoding of %1").arg(toSpeak),LOGINFO);
150 if(!m_enc->encode(wavfilename,filename)) 156 if(!m_enc->encode(wavfilename,filepath+filename))
151 { 157 {
152 m_logger->addItem(tr("Encoding of %1 failed").arg(wavfilename),LOGERROR); 158 m_logger->addItem(tr("Encoding of %1 failed").arg(wavfilename),LOGERROR);
153 m_logger->abort(); 159 m_logger->abort();
@@ -171,7 +177,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
171 installlog.setValue(wavfilename.remove(0,m_mountpoint.length()),now); 177 installlog.setValue(wavfilename.remove(0,m_mountpoint.length()),now);
172 178
173 //! add the .talk file to the install log 179 //! add the .talk file to the install log
174 installlog.setValue(filename.remove(0,m_mountpoint.length()),now); 180 installlog.setValue(QString(filepath+filename).remove(0,m_mountpoint.length()),now);
175 it.next(); 181 it.next();
176 } 182 }
177 183