mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
Talkfile: show folder to talk.
Currently it's not possible to pass multiple folders for talking. Show the folder to talk to give a useful feedback when calling it multiple times. Change-Id: I0f3d1014ee3867cc81122e485fc36353ec0f55ff
This commit is contained in:
parent
0850c1cba2
commit
da08e5059a
1 changed files with 29 additions and 21 deletions
|
|
@ -32,7 +32,8 @@ bool TalkFileCreator::createTalkFiles()
|
||||||
m_abort = false;
|
m_abort = false;
|
||||||
QString errStr;
|
QString errStr;
|
||||||
|
|
||||||
emit logItem(tr("Starting Talk file generation"),LOGINFO);
|
emit logItem(tr("Starting Talk file generation for folder %1")
|
||||||
|
.arg(m_dir.dirName()), LOGINFO);
|
||||||
emit logProgress(0,0);
|
emit logProgress(0,0);
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
|
|
@ -54,14 +55,14 @@ bool TalkFileCreator::createTalkFiles()
|
||||||
connect(&generator,SIGNAL(logItem(QString,int)),this,SIGNAL(logItem(QString,int)));
|
connect(&generator,SIGNAL(logItem(QString,int)),this,SIGNAL(logItem(QString,int)));
|
||||||
connect(&generator,SIGNAL(logProgress(int,int)),this,SIGNAL(logProgress(int,int)));
|
connect(&generator,SIGNAL(logProgress(int,int)),this,SIGNAL(logProgress(int,int)));
|
||||||
connect(this,SIGNAL(aborted()),&generator,SLOT(abort()));
|
connect(this,SIGNAL(aborted()),&generator,SLOT(abort()));
|
||||||
|
|
||||||
if(generator.process(&m_talkList) == TalkGenerator::eERROR)
|
if(generator.process(&m_talkList) == TalkGenerator::eERROR)
|
||||||
{
|
{
|
||||||
doAbort();
|
doAbort();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copying talk files
|
// Copying talk files
|
||||||
emit logItem(tr("Copying Talkfiles..."),LOGINFO);
|
emit logItem(tr("Copying Talkfiles..."),LOGINFO);
|
||||||
if(copyTalkFiles(&errStr) == false)
|
if(copyTalkFiles(&errStr) == false)
|
||||||
|
|
@ -78,7 +79,7 @@ bool TalkFileCreator::createTalkFiles()
|
||||||
emit logItem(tr("Finished creating Talk files"),LOGOK);
|
emit logItem(tr("Finished creating Talk files"),LOGOK);
|
||||||
emit logProgress(1,1);
|
emit logProgress(1,1);
|
||||||
emit done(false);
|
emit done(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,7 +117,7 @@ bool TalkFileCreator::createTalkList(QDir startDir)
|
||||||
flags = QDirIterator::Subdirectories;
|
flags = QDirIterator::Subdirectories;
|
||||||
|
|
||||||
QDirIterator it(startDir,flags);
|
QDirIterator it(startDir,flags);
|
||||||
|
|
||||||
//create temp directory
|
//create temp directory
|
||||||
QDir tempDir(QDir::tempPath()+ "/talkfiles/");
|
QDir tempDir(QDir::tempPath()+ "/talkfiles/");
|
||||||
if(!tempDir.exists())
|
if(!tempDir.exists())
|
||||||
|
|
@ -130,7 +131,7 @@ bool TalkFileCreator::createTalkList(QDir startDir)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo fileInf = it.fileInfo();
|
QFileInfo fileInf = it.fileInfo();
|
||||||
|
|
||||||
// its a dir
|
// its a dir
|
||||||
|
|
@ -146,19 +147,22 @@ bool TalkFileCreator::createTalkList(QDir startDir)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//generate entry
|
//generate entry
|
||||||
TalkGenerator::TalkEntry entry;
|
TalkGenerator::TalkEntry entry;
|
||||||
entry.toSpeak = dir.dirName();
|
entry.toSpeak = dir.dirName();
|
||||||
entry.wavfilename = QDir::tempPath()+ "/talkfiles/" + QCryptographicHash::hash(entry.toSpeak.toUtf8(),
|
entry.wavfilename = QDir::tempPath() + "/talkfiles/"
|
||||||
QCryptographicHash::Md5).toHex() + ".wav";
|
+ QCryptographicHash::hash(entry.toSpeak.toUtf8(),
|
||||||
entry.talkfilename = QDir::tempPath()+ "/talkfiles/" + QCryptographicHash::hash(entry.toSpeak.toUtf8(),
|
QCryptographicHash::Md5).toHex() + ".wav";
|
||||||
QCryptographicHash::Md5).toHex() + ".talk";
|
entry.talkfilename = QDir::tempPath() + "/talkfiles/"
|
||||||
|
+ QCryptographicHash::hash(entry.toSpeak.toUtf8(),
|
||||||
|
QCryptographicHash::Md5).toHex() + ".talk";
|
||||||
entry.target = dir.path() + "/_dirname.talk";
|
entry.target = dir.path() + "/_dirname.talk";
|
||||||
entry.voiced = false;
|
entry.voiced = false;
|
||||||
entry.encoded = false;
|
entry.encoded = false;
|
||||||
qDebug() << "toSpeak: " << entry.toSpeak << " target: " << entry.target << " intermediates: " <<
|
qDebug() << "toSpeak:" << entry.toSpeak
|
||||||
entry.wavfilename << entry.talkfilename;
|
<< "target:" << entry.target
|
||||||
|
<< "intermediates:" << entry.wavfilename << entry.talkfilename;
|
||||||
m_talkList.append(entry);
|
m_talkList.append(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -178,27 +182,31 @@ bool TalkFileCreator::createTalkList(QDir startDir)
|
||||||
}
|
}
|
||||||
if(match)
|
if(match)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check if we should ignore it
|
// check if we should ignore it
|
||||||
if(m_generateOnlyNew && QFileInfo(fileInf.path() + "/" + fileInf.fileName() + ".talk").exists())
|
if(m_generateOnlyNew && QFileInfo(fileInf.path() + "/" + fileInf.fileName() + ".talk").exists())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//generate entry
|
//generate entry
|
||||||
TalkGenerator::TalkEntry entry;
|
TalkGenerator::TalkEntry entry;
|
||||||
if(m_stripExtensions)
|
if(m_stripExtensions)
|
||||||
entry.toSpeak = stripExtension(fileInf.fileName());
|
entry.toSpeak = stripExtension(fileInf.fileName());
|
||||||
else
|
else
|
||||||
entry.toSpeak = fileInf.fileName();
|
entry.toSpeak = fileInf.fileName();
|
||||||
entry.wavfilename = QDir::tempPath()+ "/talkfiles/" + QCryptographicHash::hash(entry.toSpeak.toUtf8(),
|
entry.wavfilename = QDir::tempPath() + "/talkfiles/"
|
||||||
QCryptographicHash::Md5).toHex() + ".wav";
|
+ QCryptographicHash::hash(entry.toSpeak.toUtf8(),
|
||||||
entry.talkfilename = QDir::tempPath()+ "/talkfiles/" + QCryptographicHash::hash(entry.toSpeak.toUtf8(),
|
QCryptographicHash::Md5).toHex() + ".wav";
|
||||||
QCryptographicHash::Md5).toHex() + ".talk";
|
entry.talkfilename = QDir::tempPath() + "/talkfiles/"
|
||||||
|
+ QCryptographicHash::hash(entry.toSpeak.toUtf8(),
|
||||||
|
QCryptographicHash::Md5).toHex() + ".talk";
|
||||||
entry.target = fileInf.path() + "/" + fileInf.fileName() + ".talk";
|
entry.target = fileInf.path() + "/" + fileInf.fileName() + ".talk";
|
||||||
entry.voiced = false;
|
entry.voiced = false;
|
||||||
entry.encoded = false;
|
entry.encoded = false;
|
||||||
qDebug() << "toSpeak: " << entry.toSpeak << " target: " << entry.target << " intermediates: " <<
|
qDebug() << "toSpeak:" << entry.toSpeak
|
||||||
|
<< "target:" << entry.target
|
||||||
|
<< "intermediates:" <<
|
||||||
entry.wavfilename << entry.talkfilename;
|
entry.wavfilename << entry.talkfilename;
|
||||||
m_talkList.append(entry);
|
m_talkList.append(entry);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue