summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/talkfile.cpp
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2008-05-27 20:02:25 +0000
committerDominik Wenger <domonoky@googlemail.com>2008-05-27 20:02:25 +0000
commitae4b677736032176459f7adbb65c5386cfc089fb (patch)
tree91d7998b2118eb0368ba383f9507709cfff385c9 /rbutil/rbutilqt/talkfile.cpp
parent819a39a22eb33fda4f3605258f3ca1416590b405 (diff)
downloadrockbox-ae4b677736032176459f7adbb65c5386cfc089fb.tar.gz
rockbox-ae4b677736032176459f7adbb65c5386cfc089fb.tar.bz2
rockbox-ae4b677736032176459f7adbb65c5386cfc089fb.zip
rbutil: improve talkfile generation. remove the options to keep and overwrite the wavfiles.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17637 a1c6a512-1295-4272-9138-f99709370657
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)
QString toSpeak;
QString filename;
QString wavfilename;
+ QString filepath;
QString path = fileInf.filePath();
qDebug() << path;
- if( path.endsWith("..") || path.endsWith(".talk") )
+ if( path.endsWith("..") || path.endsWith(".") || path.endsWith(".talk") )
{
it.next();
continue;
@@ -102,13 +103,12 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
it.next();
continue;
}
- int index1 = path.lastIndexOf("/");
- int index2 = path.lastIndexOf("/",index1-1);
-
- toSpeak = path.mid(index2+1,(index1-index2)-1);
-
- filename = path.left(index1) + "/_dirname.talk";
- qDebug() << "toSpeak: " << toSpeak << "filename: " << filename;
+
+ toSpeak = fileInf.fileName();
+
+ filepath = fileInf.filePath() + "/";
+ filename = "_dirname.talk";
+ qDebug() << "toSpeak: " << toSpeak << "filename: " << filename << " path: " <<filepath;
}
else // if it is a file
{
@@ -118,15 +118,21 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
it.next();
continue;
}
+
+ // create toSpeak string
if(m_stripExtensions)
toSpeak = fileInf.baseName();
else
toSpeak = fileInf.fileName();
- filename = fileInf.absoluteFilePath() + ".talk";
+ // create filename and path
+ filepath = fileInf.absolutePath();
+ filename = fileInf.fileName() + ".talk";
+
}
- wavfilename = filename + ".wav";
+
+ wavfilename = QDir::tempPath()+ "/"+ filename + ".wav";
- QFileInfo filenameInf(filename);
+ QFileInfo filenameInf(filepath+filename);
QFileInfo wavfilenameInf(wavfilename);
//! the actual generation of the .talk files
@@ -147,7 +153,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
QCoreApplication::processEvents();
}
m_logger->addItem(tr("Encoding of %1").arg(toSpeak),LOGINFO);
- if(!m_enc->encode(wavfilename,filename))
+ if(!m_enc->encode(wavfilename,filepath+filename))
{
m_logger->addItem(tr("Encoding of %1 failed").arg(wavfilename),LOGERROR);
m_logger->abort();
@@ -171,7 +177,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
installlog.setValue(wavfilename.remove(0,m_mountpoint.length()),now);
//! add the .talk file to the install log
- installlog.setValue(filename.remove(0,m_mountpoint.length()),now);
+ installlog.setValue(QString(filepath+filename).remove(0,m_mountpoint.length()),now);
it.next();
}