summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-05-25 23:01:45 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-05-27 22:57:17 +0200
commit112b80b0c2f0ea27f16c23699867554f66c31938 (patch)
tree6eed521372191133fc1fb696a081448a6ac1b2e3
parentad3ecfcf8cb6b37f48a2aeaf24c408907c927bb4 (diff)
downloadrockbox-112b80b0c2f0ea27f16c23699867554f66c31938.zip
rockbox-112b80b0c2f0ea27f16c23699867554f66c31938.tar.gz
rockbox-112b80b0c2f0ea27f16c23699867554f66c31938.tar.bz2
rockbox-112b80b0c2f0ea27f16c23699867554f66c31938.tar.xz
VoiceCreator: Factor out creation to separate function.
Change-Id: I83d1a08745acc88aa673d07e469a0a854ef97050
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp19
-rw-r--r--rbutil/rbutilqt/base/voicefile.h7
2 files changed, 16 insertions, 10 deletions
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp
index 095f63d..bbb703b 100644
--- a/rbutil/rbutilqt/base/voicefile.cpp
+++ b/rbutil/rbutilqt/base/voicefile.cpp
@@ -73,7 +73,7 @@ bool VoiceFileCreator::createVoiceFile()
//download the correct genlang output
QTemporaryFile *downloadFile = new QTemporaryFile(this);
downloadFile->open();
- filename = downloadFile->fileName();
+ m_filename = downloadFile->fileName();
downloadFile->close();
// get the real file.
getter = new HttpGet(this);
@@ -100,8 +100,8 @@ void VoiceFileCreator::downloadDone(bool error)
emit done(true);
return;
}
-
- if(getter->isCached())
+
+ if(getter->isCached())
emit logItem(tr("Cached file used."), LOGINFO);
if(error)
{
@@ -109,13 +109,18 @@ void VoiceFileCreator::downloadDone(bool error)
emit done(true);
return;
}
- else
+ else
emit logItem(tr("Download finished."),LOGINFO);
-
+
QCoreApplication::processEvents();
+ create();
+}
+
+void VoiceFileCreator::create(void)
+{
//open downloaded file
- QFile genlang(filename);
+ QFile genlang(m_filename);
if(!genlang.open(QIODevice::ReadOnly))
{
emit logItem(tr("failed to open downloaded file"),LOGERROR);
@@ -206,7 +211,7 @@ void VoiceFileCreator::downloadDone(bool error)
//make voicefile
emit logItem(tr("Creating voicefiles..."),LOGINFO);
- FILE* ids2 = fopen(filename.toLocal8Bit(), "r");
+ FILE* ids2 = fopen(m_filename.toLocal8Bit(), "r");
if (ids2 == NULL)
{
cleanup();
diff --git a/rbutil/rbutilqt/base/voicefile.h b/rbutil/rbutilqt/base/voicefile.h
index 82698bf..f3f6c7a 100644
--- a/rbutil/rbutilqt/base/voicefile.h
+++ b/rbutil/rbutilqt/base/voicefile.h
@@ -41,10 +41,10 @@ public:
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
void setLang(QString name) { m_lang = name; }
void setWavtrimThreshold(int th){m_wavtrimThreshold = th;}
-
+
public slots:
void abort();
-
+
signals:
void done(bool);
void aborted();
@@ -56,10 +56,11 @@ private slots:
private:
+ void create(void);
void cleanup();
HttpGet *getter;
- QString filename; //the temporary file
+ QString m_filename; //the temporary file
QString m_mountpoint; //mountpoint of the device
QString m_path; //path where the wav and mp3 files are stored to
int m_targetid; //the target id