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
This commit is contained in:
Dominik Wenger 2008-05-27 20:02:25 +00:00
parent 819a39a22e
commit ae4b677736
5 changed files with 47 additions and 55 deletions

View file

@ -182,7 +182,7 @@ bool EncRbSpeex::start()
bool EncRbSpeex::encode(QString input,QString output)
{
//qDebug() << "encoding
qDebug() << "encoding " << input << " to "<< output;
char errstr[512];
FILE *fin,*fout;

View file

@ -15,7 +15,7 @@
<property name="windowTitle" >
<string>Install Talk Files</string>
</property>
<layout class="QGridLayout" >
<layout class="QGridLayout" name="gridLayout_2" >
<item rowspan="6" row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
@ -45,7 +45,8 @@
<string>&amp;Browse</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/system-search.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/system-search.png</normaloff>:/icons/system-search.png</iconset>
</property>
</widget>
</item>
@ -87,7 +88,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -103,28 +104,8 @@
<property name="title" >
<string>Generation options</string>
</property>
<layout class="QGridLayout" >
<item row="2" column="0" >
<widget class="QCheckBox" name="OverwriteWav" >
<property name="text" >
<string>Overwrite Wavefiles</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="RemoveWav" >
<property name="text" >
<string>Remove Wavefiles</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" >
<layout class="QGridLayout" name="gridLayout" >
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="recursive" >
<property name="text" >
<string>Run recursive</string>
@ -134,7 +115,7 @@
</property>
</widget>
</item>
<item row="5" column="0" >
<item row="3" column="0" colspan="2" >
<widget class="QCheckBox" name="StripExtensions" >
<property name="text" >
<string>Strip Extensions</string>
@ -144,7 +125,7 @@
</property>
</widget>
</item>
<item row="6" column="0" >
<item row="4" column="0" colspan="2" >
<widget class="QCheckBox" name="OverwriteTalk" >
<property name="text" >
<string>Overwrite Talkfiles</string>
@ -154,7 +135,7 @@
</property>
</widget>
</item>
<item row="1" column="0" >
<item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="talkFolders" >
<property name="text" >
<string>Generate .talk files for Folders</string>
@ -164,7 +145,7 @@
</property>
</widget>
</item>
<item row="0" column="0" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="talkFiles" >
<property name="text" >
<string>Generate .talk files for Files</string>
@ -178,6 +159,13 @@
</widget>
</item>
</layout>
<zorder>recursive</zorder>
<zorder>StripExtensions</zorder>
<zorder>OverwriteTalk</zorder>
<zorder>talkFolders</zorder>
<zorder>talkFiles</zorder>
<zorder>label_3</zorder>
<zorder>fileFilter</zorder>
</widget>
</item>
<item row="4" column="2" >
@ -185,7 +173,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -198,7 +186,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -214,7 +202,8 @@
<string>&amp;Install</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/go-next.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset>
</property>
</widget>
</item>
@ -224,7 +213,8 @@
<string>&amp;Cancel</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/process-stop.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/process-stop.png</normaloff>:/icons/process-stop.png</iconset>
</property>
</widget>
</item>
@ -238,8 +228,6 @@
<tabstop>change</tabstop>
<tabstop>talkFiles</tabstop>
<tabstop>talkFolders</tabstop>
<tabstop>OverwriteWav</tabstop>
<tabstop>RemoveWav</tabstop>
<tabstop>recursive</tabstop>
<tabstop>StripExtensions</tabstop>
<tabstop>OverwriteTalk</tabstop>

View file

@ -31,8 +31,6 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
ui.OverwriteWav->setChecked(true);
ui.RemoveWav->setChecked(true);
ui.recursive->setChecked(true);
ui.OverwriteTalk->setChecked(true);
ui.StripExtensions->setChecked(true);
@ -99,8 +97,8 @@ void InstallTalkWindow::accept()
talkcreator->setMountPoint(settings->mountpoint());
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked());
talkcreator->setRemoveWav(ui.RemoveWav->isChecked());
talkcreator->setOverwriteWav(true);
talkcreator->setRemoveWav(true);
talkcreator->setRecursive(ui.recursive->isChecked());
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
talkcreator->setTalkFolders(ui.talkFolders->isChecked());

View file

@ -172,7 +172,7 @@ void RbUtilQt::downloadDone(bool error)
QMessageBox::critical(this, tr("Configuration error"),
tr("Your configuration is invalid. This is most likely due "
"to a new installation of Rockbox Utility or a changed device "
"path. The configuation dialog will now open to allow you "
"path. The configuration dialog will now open to allow you "
"correcting the problem."));
configDialog();
}

View file

@ -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);
toSpeak = fileInf.fileName();
filename = path.left(index1) + "/_dirname.talk";
qDebug() << "toSpeak: " << toSpeak << "filename: " << 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";
}
wavfilename = filename + ".wav";
// create filename and path
filepath = fileInf.absolutePath();
filename = fileInf.fileName() + ".talk";
QFileInfo filenameInf(filename);
}
wavfilename = QDir::tempPath()+ "/"+ filename + ".wav";
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();
}