diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-11-03 11:08:18 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-11-04 23:32:52 +0100 |
commit | 4d2ce949b3b41f8bf0af446fa20205ddd229e579 (patch) | |
tree | 01fa19471d9831b296bea5d7049f765e38b30bbb /rbutil/rbutilqt/base/talkgenerator.cpp | |
parent | 335ec75d60bba82f23fc47b20f9390e0cba9c9c5 (diff) | |
download | rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.tar.gz rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.zip |
Use cutelogger for Rockbox Utility internal trace.
Change tracing from qDebug() to use cutelogger, which is available under the
LGPL2.1. This allows to automatically add filename and line number to the log,
and also provides multiple log levels.
Change-Id: I5dbdaf902ba54ea99f07ae10a07467c52fdac910
Diffstat (limited to 'rbutil/rbutilqt/base/talkgenerator.cpp')
-rw-r--r-- | rbutil/rbutilqt/base/talkgenerator.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/rbutil/rbutilqt/base/talkgenerator.cpp b/rbutil/rbutilqt/base/talkgenerator.cpp index a2ab578ade..32686c78c2 100644 --- a/rbutil/rbutilqt/base/talkgenerator.cpp +++ b/rbutil/rbutilqt/base/talkgenerator.cpp | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "rbsettings.h" | 20 | #include "rbsettings.h" |
21 | #include "systeminfo.h" | 21 | #include "systeminfo.h" |
22 | #include "wavtrim.h" | 22 | #include "wavtrim.h" |
23 | #include "Logger.h" | ||
23 | 24 | ||
24 | TalkGenerator::TalkGenerator(QObject* parent): QObject(parent) | 25 | TalkGenerator::TalkGenerator(QObject* parent): QObject(parent) |
25 | { | 26 | { |
@@ -39,7 +40,7 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt | |||
39 | m_tts = TTSBase::getTTS(this, RbSettings::value(RbSettings::Tts).toString()); | 40 | m_tts = TTSBase::getTTS(this, RbSettings::value(RbSettings::Tts).toString()); |
40 | if(!m_tts) | 41 | if(!m_tts) |
41 | { | 42 | { |
42 | qDebug() << "[TalkGenerator] getting the TTS object failed!"; | 43 | LOG_ERROR() << "getting the TTS object failed!"; |
43 | emit logItem(tr("Init of TTS engine failed"), LOGERROR); | 44 | emit logItem(tr("Init of TTS engine failed"), LOGERROR); |
44 | emit done(true); | 45 | emit done(true); |
45 | return eERROR; | 46 | return eERROR; |
@@ -131,7 +132,7 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri | |||
131 | duplicates.append(list->at(i).wavfilename); | 132 | duplicates.append(list->at(i).wavfilename); |
132 | else | 133 | else |
133 | { | 134 | { |
134 | qDebug() << "[TalkGenerator] duplicate skipped"; | 135 | LOG_INFO() << "duplicate skipped"; |
135 | (*list)[i].voiced = true; | 136 | (*list)[i].voiced = true; |
136 | emit logProgress(++m_progress,progressMax); | 137 | emit logProgress(++m_progress,progressMax); |
137 | continue; | 138 | continue; |
@@ -152,7 +153,7 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri | |||
152 | 153 | ||
153 | // voice entry | 154 | // voice entry |
154 | QString error; | 155 | QString error; |
155 | qDebug() << "[TalkGenerator] voicing: " << list->at(i).toSpeak | 156 | LOG_INFO() << "voicing: " << list->at(i).toSpeak |
156 | << "to" << list->at(i).wavfilename; | 157 | << "to" << list->at(i).wavfilename; |
157 | TTSStatus status = m_tts->voice(list->at(i).toSpeak,list->at(i).wavfilename, &error); | 158 | TTSStatus status = m_tts->voice(list->at(i).toSpeak,list->at(i).wavfilename, &error); |
158 | if(status == Warning) | 159 | if(status == Warning) |
@@ -177,8 +178,8 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri | |||
177 | if(wavtrim(list->at(i).wavfilename.toLocal8Bit().data(), | 178 | if(wavtrim(list->at(i).wavfilename.toLocal8Bit().data(), |
178 | wavtrimth, buffer, 255)) | 179 | wavtrimth, buffer, 255)) |
179 | { | 180 | { |
180 | qDebug() << "[TalkGenerator] wavtrim returned error on" | 181 | LOG_ERROR() << "wavtrim returned error on" |
181 | << list->at(i).wavfilename; | 182 | << list->at(i).wavfilename; |
182 | return eERROR; | 183 | return eERROR; |
183 | } | 184 | } |
184 | } | 185 | } |
@@ -214,8 +215,8 @@ TalkGenerator::Status TalkGenerator::encodeList(QList<TalkEntry>* list) | |||
214 | //skip non-voiced entrys | 215 | //skip non-voiced entrys |
215 | if(list->at(i).voiced == false) | 216 | if(list->at(i).voiced == false) |
216 | { | 217 | { |
217 | qDebug() << "[TalkGenerator] non voiced entry detected:" | 218 | LOG_WARNING() << "non voiced entry detected:" |
218 | << list->at(i).toSpeak; | 219 | << list->at(i).toSpeak; |
219 | emit logProgress(++m_progress,progressMax); | 220 | emit logProgress(++m_progress,progressMax); |
220 | continue; | 221 | continue; |
221 | } | 222 | } |
@@ -224,15 +225,15 @@ TalkGenerator::Status TalkGenerator::encodeList(QList<TalkEntry>* list) | |||
224 | duplicates.append(list->at(i).talkfilename); | 225 | duplicates.append(list->at(i).talkfilename); |
225 | else | 226 | else |
226 | { | 227 | { |
227 | qDebug() << "[TalkGenerator] duplicate skipped"; | 228 | LOG_INFO() << "duplicate skipped"; |
228 | (*list)[i].encoded = true; | 229 | (*list)[i].encoded = true; |
229 | emit logProgress(++m_progress,progressMax); | 230 | emit logProgress(++m_progress,progressMax); |
230 | continue; | 231 | continue; |
231 | } | 232 | } |
232 | 233 | ||
233 | //encode entry | 234 | //encode entry |
234 | qDebug() << "[TalkGenerator] encoding " << list->at(i).wavfilename | 235 | LOG_INFO() << "encoding " << list->at(i).wavfilename |
235 | << "to" << list->at(i).talkfilename; | 236 | << "to" << list->at(i).talkfilename; |
236 | if(!m_enc->encode(list->at(i).wavfilename,list->at(i).talkfilename)) | 237 | if(!m_enc->encode(list->at(i).wavfilename,list->at(i).talkfilename)) |
237 | { | 238 | { |
238 | emit logItem(tr("Encoding of %1 failed").arg( | 239 | emit logItem(tr("Encoding of %1 failed").arg( |
@@ -268,7 +269,7 @@ QString TalkGenerator::correctString(QString s) | |||
268 | } | 269 | } |
269 | 270 | ||
270 | if(corrected != s) | 271 | if(corrected != s) |
271 | qDebug() << "[VoiceFileCreator] corrected string" << s << "to" << corrected; | 272 | LOG_INFO() << "corrected string" << s << "to" << corrected; |
272 | 273 | ||
273 | return corrected; | 274 | return corrected; |
274 | m_abort = true; | 275 | m_abort = true; |
@@ -287,7 +288,7 @@ void TalkGenerator::setLang(QString name) | |||
287 | TTSBase* tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString()); | 288 | TTSBase* tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString()); |
288 | if(!tts) | 289 | if(!tts) |
289 | { | 290 | { |
290 | qDebug() << "[TalkGenerator] getting the TTS object failed!"; | 291 | LOG_ERROR() << "getting the TTS object failed!"; |
291 | return; | 292 | return; |
292 | } | 293 | } |
293 | QString vendor = tts->voiceVendor(); | 294 | QString vendor = tts->voiceVendor(); |
@@ -295,8 +296,8 @@ void TalkGenerator::setLang(QString name) | |||
295 | 296 | ||
296 | if(m_lang.isEmpty()) | 297 | if(m_lang.isEmpty()) |
297 | m_lang = "english"; | 298 | m_lang = "english"; |
298 | qDebug() << "[TalkGenerator] building string corrections list for" | 299 | LOG_INFO() << "building string corrections list for" |
299 | << m_lang << engine << vendor; | 300 | << m_lang << engine << vendor; |
300 | QTextStream stream(&correctionsFile); | 301 | QTextStream stream(&correctionsFile); |
301 | while(!stream.atEnd()) { | 302 | while(!stream.atEnd()) { |
302 | QString line = stream.readLine(); | 303 | QString line = stream.readLine(); |