mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
rbutil: rework and rename the "dont overwrite talkfiles" option so it really generates only new Talkfiles.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23162 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e3bd45ef81
commit
11bd80cd38
4 changed files with 21 additions and 8 deletions
|
|
@ -140,6 +140,13 @@ bool TalkFileCreator::createTalkList(QDir startDir)
|
||||||
// insert into List
|
// insert into List
|
||||||
if(!dir.dirName().isEmpty() && m_talkFolders)
|
if(!dir.dirName().isEmpty() && m_talkFolders)
|
||||||
{
|
{
|
||||||
|
// check if we should ignore it
|
||||||
|
if(m_generateOnlyNew && QFileInfo(dir.path() + "/_dirname.talk").exists())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//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::hash(entry.toSpeak.toUtf8(),
|
||||||
|
|
@ -150,7 +157,7 @@ bool TalkFileCreator::createTalkList(QDir startDir)
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -171,6 +178,12 @@ bool TalkFileCreator::createTalkList(QDir startDir)
|
||||||
if(match)
|
if(match)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// check if we should ignore it
|
||||||
|
if(m_generateOnlyNew && QFileInfo(fileInf.path() + "/" + fileInf.fileName() + ".talk").exists())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//generate entry
|
//generate entry
|
||||||
TalkGenerator::TalkEntry entry;
|
TalkGenerator::TalkEntry entry;
|
||||||
if(m_stripExtensions)
|
if(m_stripExtensions)
|
||||||
|
|
@ -223,7 +236,7 @@ bool TalkFileCreator::copyTalkFiles(QString* errString)
|
||||||
continue; // this file was skipped in one of the previous steps
|
continue; // this file was skipped in one of the previous steps
|
||||||
}
|
}
|
||||||
// remove target if it exists, and if we should overwrite it
|
// remove target if it exists, and if we should overwrite it
|
||||||
if(m_overwriteTalk && QFile::exists(m_talkList[i].target))
|
if(QFile::exists(m_talkList[i].target))
|
||||||
QFile::remove(m_talkList[i].target);
|
QFile::remove(m_talkList[i].target);
|
||||||
|
|
||||||
// copying
|
// copying
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public:
|
||||||
void setDir(QDir dir){m_dir = dir; }
|
void setDir(QDir dir){m_dir = dir; }
|
||||||
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
|
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
|
||||||
|
|
||||||
void setOverwriteTalk(bool ov) {m_overwriteTalk = ov;}
|
void setGenerateOnlyNew(bool ov) {m_generateOnlyNew = ov;}
|
||||||
void setRecursive(bool ov) {m_recursive = ov;}
|
void setRecursive(bool ov) {m_recursive = ov;}
|
||||||
void setStripExtensions(bool ov) {m_stripExtensions = ov;}
|
void setStripExtensions(bool ov) {m_stripExtensions = ov;}
|
||||||
void setTalkFolders(bool ov) {m_talkFolders = ov;}
|
void setTalkFolders(bool ov) {m_talkFolders = ov;}
|
||||||
|
|
@ -67,7 +67,7 @@ private:
|
||||||
QDir m_dir;
|
QDir m_dir;
|
||||||
QString m_mountpoint;
|
QString m_mountpoint;
|
||||||
|
|
||||||
bool m_overwriteTalk;
|
bool m_generateOnlyNew;
|
||||||
bool m_recursive;
|
bool m_recursive;
|
||||||
bool m_stripExtensions;
|
bool m_stripExtensions;
|
||||||
bool m_talkFolders;
|
bool m_talkFolders;
|
||||||
|
|
|
||||||
|
|
@ -216,9 +216,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QCheckBox" name="OverwriteTalk">
|
<widget class="QCheckBox" name="GenerateOnlyNew">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Overwrite Talkfiles</string>
|
<string>Create only new Talkfiles</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
|
||||||
connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
|
connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
|
||||||
|
|
||||||
ui.recursive->setChecked(true);
|
ui.recursive->setChecked(true);
|
||||||
ui.OverwriteTalk->setChecked(true);
|
ui.GenerateOnlyNew->setChecked(true);
|
||||||
ui.StripExtensions->setChecked(true);
|
ui.StripExtensions->setChecked(true);
|
||||||
|
|
||||||
updateSettings();
|
updateSettings();
|
||||||
|
|
@ -103,7 +103,7 @@ void InstallTalkWindow::accept()
|
||||||
talkcreator->setDir(QDir(folderToTalk));
|
talkcreator->setDir(QDir(folderToTalk));
|
||||||
talkcreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
talkcreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
||||||
|
|
||||||
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
|
talkcreator->setGenerateOnlyNew(ui.GenerateOnlyNew->isChecked());
|
||||||
talkcreator->setRecursive(ui.recursive->isChecked());
|
talkcreator->setRecursive(ui.recursive->isChecked());
|
||||||
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
|
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
|
||||||
talkcreator->setTalkFolders(ui.talkFolders->isChecked());
|
talkcreator->setTalkFolders(ui.talkFolders->isChecked());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue