diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-05-25 23:01:45 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-05-27 22:57:17 +0200 |
commit | 112b80b0c2f0ea27f16c23699867554f66c31938 (patch) | |
tree | 6eed521372191133fc1fb696a081448a6ac1b2e3 | |
parent | ad3ecfcf8cb6b37f48a2aeaf24c408907c927bb4 (diff) | |
download | rockbox-112b80b0c2f0ea27f16c23699867554f66c31938.tar.gz rockbox-112b80b0c2f0ea27f16c23699867554f66c31938.zip |
VoiceCreator: Factor out creation to separate function.
Change-Id: I83d1a08745acc88aa673d07e469a0a854ef97050
-rw-r--r-- | rbutil/rbutilqt/base/voicefile.cpp | 19 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/voicefile.h | 7 |
2 files changed, 16 insertions, 10 deletions
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp index 095f63d38b..bbb703bc3d 100644 --- a/rbutil/rbutilqt/base/voicefile.cpp +++ b/rbutil/rbutilqt/base/voicefile.cpp | |||
@@ -73,7 +73,7 @@ bool VoiceFileCreator::createVoiceFile() | |||
73 | //download the correct genlang output | 73 | //download the correct genlang output |
74 | QTemporaryFile *downloadFile = new QTemporaryFile(this); | 74 | QTemporaryFile *downloadFile = new QTemporaryFile(this); |
75 | downloadFile->open(); | 75 | downloadFile->open(); |
76 | filename = downloadFile->fileName(); | 76 | m_filename = downloadFile->fileName(); |
77 | downloadFile->close(); | 77 | downloadFile->close(); |
78 | // get the real file. | 78 | // get the real file. |
79 | getter = new HttpGet(this); | 79 | getter = new HttpGet(this); |
@@ -100,8 +100,8 @@ void VoiceFileCreator::downloadDone(bool error) | |||
100 | emit done(true); | 100 | emit done(true); |
101 | return; | 101 | return; |
102 | } | 102 | } |
103 | 103 | ||
104 | if(getter->isCached()) | 104 | if(getter->isCached()) |
105 | emit logItem(tr("Cached file used."), LOGINFO); | 105 | emit logItem(tr("Cached file used."), LOGINFO); |
106 | if(error) | 106 | if(error) |
107 | { | 107 | { |
@@ -109,13 +109,18 @@ void VoiceFileCreator::downloadDone(bool error) | |||
109 | emit done(true); | 109 | emit done(true); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | else | 112 | else |
113 | emit logItem(tr("Download finished."),LOGINFO); | 113 | emit logItem(tr("Download finished."),LOGINFO); |
114 | 114 | ||
115 | QCoreApplication::processEvents(); | 115 | QCoreApplication::processEvents(); |
116 | create(); | ||
117 | } | ||
118 | |||
116 | 119 | ||
120 | void VoiceFileCreator::create(void) | ||
121 | { | ||
117 | //open downloaded file | 122 | //open downloaded file |
118 | QFile genlang(filename); | 123 | QFile genlang(m_filename); |
119 | if(!genlang.open(QIODevice::ReadOnly)) | 124 | if(!genlang.open(QIODevice::ReadOnly)) |
120 | { | 125 | { |
121 | emit logItem(tr("failed to open downloaded file"),LOGERROR); | 126 | emit logItem(tr("failed to open downloaded file"),LOGERROR); |
@@ -206,7 +211,7 @@ void VoiceFileCreator::downloadDone(bool error) | |||
206 | 211 | ||
207 | //make voicefile | 212 | //make voicefile |
208 | emit logItem(tr("Creating voicefiles..."),LOGINFO); | 213 | emit logItem(tr("Creating voicefiles..."),LOGINFO); |
209 | FILE* ids2 = fopen(filename.toLocal8Bit(), "r"); | 214 | FILE* ids2 = fopen(m_filename.toLocal8Bit(), "r"); |
210 | if (ids2 == NULL) | 215 | if (ids2 == NULL) |
211 | { | 216 | { |
212 | cleanup(); | 217 | cleanup(); |
diff --git a/rbutil/rbutilqt/base/voicefile.h b/rbutil/rbutilqt/base/voicefile.h index 82698bfbde..f3f6c7a930 100644 --- a/rbutil/rbutilqt/base/voicefile.h +++ b/rbutil/rbutilqt/base/voicefile.h | |||
@@ -41,10 +41,10 @@ public: | |||
41 | void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } | 41 | void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } |
42 | void setLang(QString name) { m_lang = name; } | 42 | void setLang(QString name) { m_lang = name; } |
43 | void setWavtrimThreshold(int th){m_wavtrimThreshold = th;} | 43 | void setWavtrimThreshold(int th){m_wavtrimThreshold = th;} |
44 | 44 | ||
45 | public slots: | 45 | public slots: |
46 | void abort(); | 46 | void abort(); |
47 | 47 | ||
48 | signals: | 48 | signals: |
49 | void done(bool); | 49 | void done(bool); |
50 | void aborted(); | 50 | void aborted(); |
@@ -56,10 +56,11 @@ private slots: | |||
56 | 56 | ||
57 | private: | 57 | private: |
58 | 58 | ||
59 | void create(void); | ||
59 | void cleanup(); | 60 | void cleanup(); |
60 | 61 | ||
61 | HttpGet *getter; | 62 | HttpGet *getter; |
62 | QString filename; //the temporary file | 63 | QString m_filename; //the temporary file |
63 | QString m_mountpoint; //mountpoint of the device | 64 | QString m_mountpoint; //mountpoint of the device |
64 | QString m_path; //path where the wav and mp3 files are stored to | 65 | QString m_path; //path where the wav and mp3 files are stored to |
65 | int m_targetid; //the target id | 66 | int m_targetid; //the target id |