summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-13 23:01:57 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-13 23:01:57 +0200
commitda08e5059a50556d14315d6a5e850a218303992b (patch)
tree97b0bd9746402eb603f6b434d3152acd6d3ef631
parent0850c1cba24048a9c4214d6be4b2663de7e8732d (diff)
downloadrockbox-da08e5059a50556d14315d6a5e850a218303992b.tar.gz
rockbox-da08e5059a50556d14315d6a5e850a218303992b.zip
Talkfile: show folder to talk.
Currently it's not possible to pass multiple folders for talking. Show the folder to talk to give a useful feedback when calling it multiple times. Change-Id: I0f3d1014ee3867cc81122e485fc36353ec0f55ff
-rw-r--r--rbutil/rbutilqt/base/talkfile.cpp50
1 files changed, 29 insertions, 21 deletions
diff --git a/rbutil/rbutilqt/base/talkfile.cpp b/rbutil/rbutilqt/base/talkfile.cpp
index 7b5b804452..d7d0e5be75 100644
--- a/rbutil/rbutilqt/base/talkfile.cpp
+++ b/rbutil/rbutilqt/base/talkfile.cpp
@@ -32,7 +32,8 @@ bool TalkFileCreator::createTalkFiles()
32 m_abort = false; 32 m_abort = false;
33 QString errStr; 33 QString errStr;
34 34
35 emit logItem(tr("Starting Talk file generation"),LOGINFO); 35 emit logItem(tr("Starting Talk file generation for folder %1")
36 .arg(m_dir.dirName()), LOGINFO);
36 emit logProgress(0,0); 37 emit logProgress(0,0);
37 QCoreApplication::processEvents(); 38 QCoreApplication::processEvents();
38 39
@@ -54,14 +55,14 @@ bool TalkFileCreator::createTalkFiles()
54 connect(&generator,SIGNAL(logItem(QString,int)),this,SIGNAL(logItem(QString,int))); 55 connect(&generator,SIGNAL(logItem(QString,int)),this,SIGNAL(logItem(QString,int)));
55 connect(&generator,SIGNAL(logProgress(int,int)),this,SIGNAL(logProgress(int,int))); 56 connect(&generator,SIGNAL(logProgress(int,int)),this,SIGNAL(logProgress(int,int)));
56 connect(this,SIGNAL(aborted()),&generator,SLOT(abort())); 57 connect(this,SIGNAL(aborted()),&generator,SLOT(abort()));
57 58
58 if(generator.process(&m_talkList) == TalkGenerator::eERROR) 59 if(generator.process(&m_talkList) == TalkGenerator::eERROR)
59 { 60 {
60 doAbort(); 61 doAbort();
61 return false; 62 return false;
62 } 63 }
63 } 64 }
64 65
65 // Copying talk files 66 // Copying talk files
66 emit logItem(tr("Copying Talkfiles..."),LOGINFO); 67 emit logItem(tr("Copying Talkfiles..."),LOGINFO);
67 if(copyTalkFiles(&errStr) == false) 68 if(copyTalkFiles(&errStr) == false)
@@ -78,7 +79,7 @@ bool TalkFileCreator::createTalkFiles()
78 emit logItem(tr("Finished creating Talk files"),LOGOK); 79 emit logItem(tr("Finished creating Talk files"),LOGOK);
79 emit logProgress(1,1); 80 emit logProgress(1,1);
80 emit done(false); 81 emit done(false);
81 82
82 return true; 83 return true;
83} 84}
84 85
@@ -116,7 +117,7 @@ bool TalkFileCreator::createTalkList(QDir startDir)
116 flags = QDirIterator::Subdirectories; 117 flags = QDirIterator::Subdirectories;
117 118
118 QDirIterator it(startDir,flags); 119 QDirIterator it(startDir,flags);
119 120
120 //create temp directory 121 //create temp directory
121 QDir tempDir(QDir::tempPath()+ "/talkfiles/"); 122 QDir tempDir(QDir::tempPath()+ "/talkfiles/");
122 if(!tempDir.exists()) 123 if(!tempDir.exists())
@@ -130,7 +131,7 @@ bool TalkFileCreator::createTalkList(QDir startDir)
130 { 131 {
131 return false; 132 return false;
132 } 133 }
133 134
134 QFileInfo fileInf = it.fileInfo(); 135 QFileInfo fileInf = it.fileInfo();
135 136
136 // its a dir 137 // its a dir
@@ -146,19 +147,22 @@ bool TalkFileCreator::createTalkList(QDir startDir)
146 { 147 {
147 continue; 148 continue;
148 } 149 }
149 150
150 //generate entry 151 //generate entry
151 TalkGenerator::TalkEntry entry; 152 TalkGenerator::TalkEntry entry;
152 entry.toSpeak = dir.dirName(); 153 entry.toSpeak = dir.dirName();
153 entry.wavfilename = QDir::tempPath()+ "/talkfiles/" + QCryptographicHash::hash(entry.toSpeak.toUtf8(), 154 entry.wavfilename = QDir::tempPath() + "/talkfiles/"
154 QCryptographicHash::Md5).toHex() + ".wav"; 155 + QCryptographicHash::hash(entry.toSpeak.toUtf8(),
155 entry.talkfilename = QDir::tempPath()+ "/talkfiles/" + QCryptographicHash::hash(entry.toSpeak.toUtf8(), 156 QCryptographicHash::Md5).toHex() + ".wav";
156 QCryptographicHash::Md5).toHex() + ".talk"; 157 entry.talkfilename = QDir::tempPath() + "/talkfiles/"
158 + QCryptographicHash::hash(entry.toSpeak.toUtf8(),
159 QCryptographicHash::Md5).toHex() + ".talk";
157 entry.target = dir.path() + "/_dirname.talk"; 160 entry.target = dir.path() + "/_dirname.talk";
158 entry.voiced = false; 161 entry.voiced = false;
159 entry.encoded = false; 162 entry.encoded = false;
160 qDebug() << "toSpeak: " << entry.toSpeak << " target: " << entry.target << " intermediates: " << 163 qDebug() << "toSpeak:" << entry.toSpeak
161 entry.wavfilename << entry.talkfilename; 164 << "target:" << entry.target
165 << "intermediates:" << entry.wavfilename << entry.talkfilename;
162 m_talkList.append(entry); 166 m_talkList.append(entry);
163 } 167 }
164 } 168 }
@@ -178,27 +182,31 @@ bool TalkFileCreator::createTalkList(QDir startDir)
178 } 182 }
179 if(match) 183 if(match)
180 continue; 184 continue;
181 185
182 // check if we should ignore it 186 // check if we should ignore it
183 if(m_generateOnlyNew && QFileInfo(fileInf.path() + "/" + fileInf.fileName() + ".talk").exists()) 187 if(m_generateOnlyNew && QFileInfo(fileInf.path() + "/" + fileInf.fileName() + ".talk").exists())
184 { 188 {
185 continue; 189 continue;
186 } 190 }
187 191
188 //generate entry 192 //generate entry
189 TalkGenerator::TalkEntry entry; 193 TalkGenerator::TalkEntry entry;
190 if(m_stripExtensions) 194 if(m_stripExtensions)
191 entry.toSpeak = stripExtension(fileInf.fileName()); 195 entry.toSpeak = stripExtension(fileInf.fileName());
192 else 196 else
193 entry.toSpeak = fileInf.fileName(); 197 entry.toSpeak = fileInf.fileName();
194 entry.wavfilename = QDir::tempPath()+ "/talkfiles/" + QCryptographicHash::hash(entry.toSpeak.toUtf8(), 198 entry.wavfilename = QDir::tempPath() + "/talkfiles/"
195 QCryptographicHash::Md5).toHex() + ".wav"; 199 + QCryptographicHash::hash(entry.toSpeak.toUtf8(),
196 entry.talkfilename = QDir::tempPath()+ "/talkfiles/" + QCryptographicHash::hash(entry.toSpeak.toUtf8(), 200 QCryptographicHash::Md5).toHex() + ".wav";
197 QCryptographicHash::Md5).toHex() + ".talk"; 201 entry.talkfilename = QDir::tempPath() + "/talkfiles/"
202 + QCryptographicHash::hash(entry.toSpeak.toUtf8(),
203 QCryptographicHash::Md5).toHex() + ".talk";
198 entry.target = fileInf.path() + "/" + fileInf.fileName() + ".talk"; 204 entry.target = fileInf.path() + "/" + fileInf.fileName() + ".talk";
199 entry.voiced = false; 205 entry.voiced = false;
200 entry.encoded = false; 206 entry.encoded = false;
201 qDebug() << "toSpeak: " << entry.toSpeak << " target: " << entry.target << " intermediates: " << 207 qDebug() << "toSpeak:" << entry.toSpeak
208 << "target:" << entry.target
209 << "intermediates:" <<
202 entry.wavfilename << entry.talkfilename; 210 entry.wavfilename << entry.talkfilename;
203 m_talkList.append(entry); 211 m_talkList.append(entry);
204 } 212 }