summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/talkfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/talkfile.cpp')
-rw-r--r--rbutil/rbutilqt/talkfile.cpp32
1 files changed, 19 insertions, 13 deletions
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