1
0
Fork 0
forked from len0rd/rockbox

Completely rework the talk files window: move settings to configuration dialog and add configuration presets. Remove some old cruft from talkfile handling and rely on values from rbutil.ini. Autodetection of executables is missing.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14495 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2007-08-28 23:10:42 +00:00
parent f2bf042edf
commit c03102b346
12 changed files with 408 additions and 382 deletions

View file

@ -68,6 +68,10 @@ Config::Config(QWidget *parent) : QDialog(parent)
connect(ui.buttonAutodetect,SIGNAL(clicked()),this,SLOT(autodetect())); connect(ui.buttonAutodetect,SIGNAL(clicked()),this,SLOT(autodetect()));
connect(ui.buttonCacheBrowse, SIGNAL(clicked()), this, SLOT(browseCache())); connect(ui.buttonCacheBrowse, SIGNAL(clicked()), this, SLOT(browseCache()));
connect(ui.buttonCacheClear, SIGNAL(clicked()), this, SLOT(cacheClear())); connect(ui.buttonCacheClear, SIGNAL(clicked()), this, SLOT(cacheClear()));
connect(ui.browseTts, SIGNAL(clicked()), this, SLOT(browseTts()));
connect(ui.comboEncoder, SIGNAL(currentIndexChanged(int)), this, SLOT(updateEncOpts(int)));
connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsOpts(int)));
} }
@ -119,6 +123,19 @@ void Config::accept()
userSettings->setValue("defaults/cachedisable", ui.cacheDisable->isChecked()); userSettings->setValue("defaults/cachedisable", ui.cacheDisable->isChecked());
userSettings->setValue("defaults/offline", ui.cacheOfflineMode->isChecked()); userSettings->setValue("defaults/offline", ui.cacheOfflineMode->isChecked());
// tts settings
if(QFileInfo(ui.ttsExecutable->text()).isExecutable())
userSettings->setValue("ttsbin", ui.ttsExecutable->text());
userSettings->setValue("ttsopts", ui.ttsOptions->text());
if(QFileInfo(ui.encoderExecutable->text()).isExecutable())
userSettings->setValue("encbin", ui.encoderExecutable->text());
userSettings->setValue("ttsopts", ui.ttsOptions->text());
QString preset;
preset = ui.comboEncoder->itemData(ui.comboEncoder->currentIndex(), Qt::UserRole).toString();
userSettings->setValue("encpreset", preset);
preset = ui.comboTts->itemData(ui.comboTts->currentIndex(), Qt::UserRole).toString();
userSettings->setValue("ttspreset", preset);
// sync settings // sync settings
userSettings->sync(); userSettings->sync();
this->close(); this->close();
@ -186,6 +203,7 @@ void Config::setUserSettings(QSettings *user)
} }
ui.cacheSize->setText(tr("Current cache size is %1 kiB.") ui.cacheSize->setText(tr("Current cache size is %1 kiB.")
.arg(sz/1024)); .arg(sz/1024));
} }
@ -262,6 +280,58 @@ void Config::setDevices(QSettings *dev)
ui.treeDevices->insertTopLevelItems(0, items); ui.treeDevices->insertTopLevelItems(0, items);
if(w3 != 0) if(w3 != 0)
ui.treeDevices->setCurrentItem(w3); // hilight old selection ui.treeDevices->setCurrentItem(w3); // hilight old selection
// tts / encoder tab
QStringList keys;
devices->beginGroup("encoders");
keys = devices->allKeys();
for(int i=0; i < keys.size();i++)
ui.comboEncoder->addItem(devices->value(keys.at(i), "null").toString(),
keys.at(i));
devices->endGroup();
devices->beginGroup("tts");
keys = devices->allKeys();
for(int i=0; i < keys.size();i++)
ui.comboTts->addItem(devices->value(keys.at(i), "null").toString(), keys.at(i));
devices->endGroup();
int index;
index = ui.comboTts->findData(userSettings->value("ttspreset").toString(),
Qt::UserRole, Qt::MatchExactly);
ui.comboTts->setCurrentIndex(index);
updateTtsOpts(index);
ui.ttsExecutable->setText(userSettings->value("ttsbin").toString());
index = ui.comboEncoder->findData(userSettings->value("encpreset").toString(),
Qt::UserRole, Qt::MatchExactly);
ui.comboEncoder->setCurrentIndex(index);
updateEncOpts(index);
ui.encoderExecutable->setText(userSettings->value("encbin").toString());
}
void Config::updateEncOpts(int index)
{
qDebug() << "updateEncOpts()";
QString c = ui.comboEncoder->itemData(index, Qt::UserRole).toString();
devices->beginGroup(c);
ui.encoderOptions->setText(devices->value("options").toString());
ui.encoderOptions->setEnabled(devices->value("edit").toBool());
devices->endGroup();
}
void Config::updateTtsOpts(int index)
{
QString c = ui.comboTts->itemData(index, Qt::UserRole).toString();
devices->beginGroup(c);
qDebug() << devices->value("edit").toBool();
ui.ttsOptions->setText(devices->value("options").toString());
ui.ttsOptions->setEnabled(devices->value("edit").toBool());
devices->endGroup();
} }
@ -466,3 +536,25 @@ void Config::cacheClear()
qDebug() << "removed:" << f; qDebug() << "removed:" << f;
} }
} }
void Config::browseTts()
{
BrowseDirtree browser(this);
browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
if(QFileInfo(ui.ttsExecutable->text()).isDir())
{
QDir d(ui.ttsExecutable->text());
browser.setDir(d);
}
if(browser.exec() == QDialog::Accepted)
{
qDebug() << browser.getSelected();
QString exe = browser.getSelected();
if(!QFileInfo(exe).isExecutable())
return;
ui.ttsExecutable->setText(exe);
}
}

View file

@ -63,6 +63,9 @@ class Config : public QDialog
void setMountpoint(QString); void setMountpoint(QString);
void setCache(QString); void setCache(QString);
void cacheClear(void); void cacheClear(void);
void browseTts(void);
void updateTtsOpts(int);
void updateEncOpts(int);
}; };
#endif #endif

View file

@ -6,7 +6,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>500</width> <width>500</width>
<height>400</height> <height>435</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@ -20,39 +20,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="buttonOk" >
<property name="text" >
<string>&amp;Ok</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QPushButton" name="buttonCancel" >
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3" > <item row="1" column="0" colspan="3" >
<widget class="QTabWidget" name="tabConfiguration" > <widget class="QTabWidget" name="tabConfiguration" >
<property name="currentIndex" > <property name="currentIndex" >
@ -319,7 +286,7 @@
<string>&amp;Browse</string> <string>&amp;Browse</string>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/icons/system-search.png</iconset> <iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -384,6 +351,178 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabTts" >
<attribute name="title" >
<string>&amp;TTS &amp;&amp; Encoder</string>
</attribute>
<attribute name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/icons/audio-input-microphone.png</iconset>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>TTS Engine</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="labelTts" >
<property name="text" >
<string>&amp;Select TTS profile</string>
</property>
<property name="buddy" >
<cstring>comboTts</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="comboTts" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="labelTtsExecutable" >
<property name="text" >
<string>TTS executable</string>
</property>
<property name="buddy" >
<cstring>ttsExecutable</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="ttsExecutable" />
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="browseTts" >
<property name="text" >
<string>&amp;Browse</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="labelTtsOptions" >
<property name="text" >
<string>TTS Options</string>
</property>
<property name="buddy" >
<cstring>ttsOptions</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QLineEdit" name="ttsOptions" />
</item>
</layout>
</widget>
</item>
<item rowspan="2" row="1" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<string>Encoder Engine</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="labelEncoder" >
<property name="text" >
<string>Select &amp;encoder profile</string>
</property>
<property name="buddy" >
<cstring>comboEncoder</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="comboEncoder" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="labelEncoderExecutable" >
<property name="text" >
<string>Encoder executable</string>
</property>
<property name="buddy" >
<cstring>encoderExecutable</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="encoderExecutable" />
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="browseEncoder" >
<property name="text" >
<string>B&amp;rowse</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="labelEncoderOptions" >
<property name="text" >
<string>Encoder options</string>
</property>
<property name="buddy" >
<cstring>encoderOptions</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QLineEdit" name="encoderOptions" />
</item>
</layout>
</widget>
</item>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="buttonOk" >
<property name="text" >
<string>&amp;Ok</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QPushButton" name="buttonCancel" >
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

View file

@ -8,15 +8,15 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>681</width> <width>600</width>
<height>516</height> <height>450</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
<string>Install Talk Files</string> <string>Install Talk Files</string>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item rowspan="5" row="0" column="0" > <item rowspan="6" row="0" column="0" >
<widget class="QLabel" name="label" > <widget class="QLabel" name="label" >
<property name="text" > <property name="text" >
<string/> <string/>
@ -29,17 +29,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="5" > <item row="0" column="1" colspan="3" >
<widget class="QLabel" name="label_2" > <widget class="QLabel" name="label_2" >
<property name="text" > <property name="text" >
<string>Select the Folder to generate Talkfiles for.</string> <string>Select the Folder to generate Talkfiles for.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="4" > <item row="1" column="1" colspan="2" >
<widget class="QLineEdit" name="lineTalkFolder" /> <widget class="QLineEdit" name="lineTalkFolder" />
</item> </item>
<item row="1" column="5" > <item row="1" column="3" >
<widget class="QPushButton" name="buttonBrowse" > <widget class="QPushButton" name="buttonBrowse" >
<property name="text" > <property name="text" >
<string>&amp;Browse</string> <string>&amp;Browse</string>
@ -49,134 +49,74 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" colspan="5" > <item row="2" column="1" colspan="3" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>TTS Engine</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Select a TTS Engine</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QComboBox" name="TTScbx" />
</item>
<item row="2" column="0" colspan="2" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Select the TTS executable in your Filesystem</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLineEdit" name="TTSpath" />
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="buttonBrowseTTS" >
<property name="text" >
<string>Browse</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>TTS Options</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2" >
<widget class="QLineEdit" name="TTSOptions" />
</item>
</layout>
</widget>
</item>
<item row="3" column="1" colspan="5" >
<widget class="QGroupBox" name="groupBox_2" > <widget class="QGroupBox" name="groupBox_2" >
<property name="title" > <property name="title" >
<string>Encoder Engine</string> <string>Generation settings</string>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item row="0" column="0" colspan="2" > <item row="0" column="0" >
<widget class="QLabel" name="label_5" > <widget class="QLabel" name="labelEncProfile" >
<property name="text" > <property name="text" >
<string>Select an Encoder</string> <string>Encoder profile:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2" > <item row="1" column="0" >
<widget class="QComboBox" name="Encodercbx" /> <widget class="QLabel" name="labelTtsProfile" >
</item>
<item row="2" column="0" colspan="2" >
<widget class="QLabel" name="label_6" >
<property name="text" > <property name="text" >
<string>Select the Encoder executable in your Filesystem</string> <string>TTS profile:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" >
<widget class="QLineEdit" name="Encoderpath" />
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="buttonBrowseEncoder" >
<property name="text" >
<string>Browse</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Encoder Options</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2" >
<widget class="QLineEdit" name="EncoderOptions" />
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="1" > <item row="3" column="1" colspan="3" >
<widget class="QCheckBox" name="OverwriteWav" > <widget class="QGroupBox" name="groupBox" >
<property name="text" > <property name="title" >
<string>Overwrite Wavefiles</string> <string>Generation options</string>
</property> </property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="OverwriteWav" >
<property name="text" >
<string>Overwrite Wavefiles</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="RemoveWav" >
<property name="text" >
<string>Remove Wavefiles</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="recursive" >
<property name="text" >
<string>Run recursive</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="StripExtensions" >
<property name="text" >
<string>Strip Extensions</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QCheckBox" name="OverwriteTalk" >
<property name="text" >
<string>Overwrite Talkfiles</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="4" column="2" > <item row="4" column="2" >
<widget class="QCheckBox" name="RemoveWav" >
<property name="text" >
<string>Remove Wavefiles</string>
</property>
</widget>
</item>
<item row="4" column="3" colspan="2" >
<widget class="QCheckBox" name="recursive" >
<property name="text" >
<string>Run recursive</string>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QCheckBox" name="OverwriteTalk" >
<property name="text" >
<string>Overwrite Talkfiles</string>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QCheckBox" name="StripExtensions" >
<property name="text" >
<string>Strip Extensions</string>
</property>
</widget>
</item>
<item row="5" column="4" >
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -184,12 +124,12 @@
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>20</width> <width>20</width>
<height>111</height> <height>40</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="6" column="1" colspan="3" > <item row="5" column="1" >
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -202,7 +142,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="6" column="4" colspan="2" > <item row="5" column="2" colspan="2" >
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<item> <item>
<widget class="QPushButton" name="buttonOk" > <widget class="QPushButton" name="buttonOk" >

View file

@ -28,19 +28,12 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
talkcreator = new TalkFileCreator(this); talkcreator = new TalkFileCreator(this);
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder())); connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
connect(ui.buttonBrowseTTS, SIGNAL(clicked()), this, SLOT(browseTTS()));
connect(ui.buttonBrowseEncoder, SIGNAL(clicked()), this, SLOT(browseEncoder()));
connect(ui.Encodercbx,SIGNAL(currentIndexChanged(int)),this,SLOT(setEncoderOptions(int)));
connect(ui.TTScbx,SIGNAL(currentIndexChanged(int)),this,SLOT(setTTSOptions(int)));
ui.OverwriteWav->setChecked(true); ui.OverwriteWav->setChecked(true);
ui.RemoveWav->setChecked(true); ui.RemoveWav->setChecked(true);
ui.recursive->setChecked(true); ui.recursive->setChecked(true);
ui.OverwriteTalk->setChecked(true); ui.OverwriteTalk->setChecked(true);
ui.StripExtensions->setChecked(true); ui.StripExtensions->setChecked(true);
} }
void InstallTalkWindow::browseFolder() void InstallTalkWindow::browseFolder()
@ -67,87 +60,9 @@ void InstallTalkWindow::browseFolder()
void InstallTalkWindow::setTalkFolder(QString folder) void InstallTalkWindow::setTalkFolder(QString folder)
{ {
ui.lineTalkFolder->clear(); ui.lineTalkFolder->setText(folder);
ui.lineTalkFolder->insert(folder);
} }
void InstallTalkWindow::browseTTS()
{
BrowseDirtree browser(this);
browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
if(QFileInfo(ui.TTSpath->text()).isDir())
{
QDir d(ui.TTSpath->text());
browser.setDir(d);
}
else
{
QDir d("/media");
browser.setDir(d);
}
if(browser.exec() == QDialog::Accepted)
{
qDebug() << browser.getSelected();
setTTSExec(browser.getSelected());
}
}
void InstallTalkWindow::setTTSExec(QString path)
{
ui.TTSpath->clear();
ui.TTSpath->insert(path);
}
void InstallTalkWindow::browseEncoder()
{
BrowseDirtree browser(this);
browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
if(QFileInfo(ui.Encoderpath->text()).isDir())
{
QDir d(ui.Encoderpath->text());
browser.setDir(d);
}
else
{
QDir d("/media");
browser.setDir(d);
}
if(browser.exec() == QDialog::Accepted)
{
qDebug() << browser.getSelected();
setEncoderExec(browser.getSelected());
}
}
void InstallTalkWindow::setEncoderExec(QString path)
{
ui.Encoderpath->clear();
ui.Encoderpath->insert(path);
}
void InstallTalkWindow::setEncoderOptions(int index)
{
QString options = talkcreator->getEncOpts(ui.Encodercbx->itemText(index));
setEncoderOptions(options);
}
void InstallTalkWindow::setEncoderOptions(QString options)
{
ui.EncoderOptions->clear();
ui.EncoderOptions->insert(options);
}
void InstallTalkWindow::setTTSOptions(QString options)
{
ui.TTSOptions->clear();
ui.TTSOptions->insert(options);
}
void InstallTalkWindow::setTTSOptions(int index)
{
QString options = talkcreator->getTTsOpts(ui.TTScbx->itemText(index));
setEncoderOptions(options);
}
void InstallTalkWindow::accept() void InstallTalkWindow::accept()
{ {
@ -155,8 +70,8 @@ void InstallTalkWindow::accept()
logger->show(); logger->show();
QString folderToTalk = ui.lineTalkFolder->text(); QString folderToTalk = ui.lineTalkFolder->text();
QString pathEncoder = ui.Encoderpath->text(); QString pathEncoder = userSettings->value("encbin").toString();
QString pathTTS = ui.TTSpath->text(); QString pathTTS = userSettings->value("ttsbin").toString();
if(!QFileInfo(folderToTalk).isDir()) if(!QFileInfo(folderToTalk).isDir())
{ {
@ -165,33 +80,40 @@ void InstallTalkWindow::accept()
return; return;
} }
if(!QFileInfo(pathEncoder).exists()) if(!QFileInfo(pathEncoder).isExecutable())
{ {
logger->addItem(tr("Path to Encoder is wrong!"),LOGERROR); logger->addItem(tr("Path to Encoder is wrong!"),LOGERROR);
logger->abort(); logger->abort();
return; return;
} }
if(!QFileInfo(pathTTS).exists()) if(!QFileInfo(pathTTS).isExecutable())
{ {
logger->addItem(tr("Path to TTS is wrong!"),LOGERROR); logger->addItem(tr("Path to TTS is wrong!"),LOGERROR);
logger->abort(); logger->abort();
return; return;
} }
userSettings->setValue("defaults/folderToTalk",folderToTalk); userSettings->setValue("last_talked_folder", folderToTalk);
userSettings->setValue("defaults/pathEncoder",pathEncoder);
userSettings->setValue("defaults/pathTTS",pathTTS);
userSettings->sync(); userSettings->sync();
talkcreator->setDir(folderToTalk); talkcreator->setDir(folderToTalk);
talkcreator->setTTSexe(pathTTS); talkcreator->setTTSexe(pathTTS);
talkcreator->setEncexe(pathEncoder); talkcreator->setEncexe(pathEncoder);
talkcreator->setEncOpts(ui.EncoderOptions->text()); talkcreator->setEncOpts(userSettings->value("encopts").toString());
talkcreator->setTTsOpts(ui.TTSOptions->text()); talkcreator->setTTsOpts(userSettings->value("ttsopts").toString());
talkcreator->setTTsType(ui.TTScbx->currentText());
talkcreator->setEncType(ui.Encodercbx->currentText()); devices->beginGroup(userSettings->value("ttspreset").toString());
talkcreator->setTTsType(devices->value("tts").toString());
talkcreator->setTTsOpts(devices->value("options").toString());
talkcreator->setTTsTemplate(devices->value("template").toString());
devices->endGroup();
devices->beginGroup(userSettings->value("encpreset").toString());
talkcreator->setEncType(devices->value("encoder").toString());
talkcreator->setEncOpts(devices->value("options").toString());
talkcreator->setEncTemplate(devices->value("template").toString());
devices->endGroup();
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked()); talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked()); talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked());
@ -200,7 +122,7 @@ void InstallTalkWindow::accept()
talkcreator->setStripExtensions(ui.StripExtensions->isChecked()); talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
talkcreator->createTalkFiles(logger); talkcreator->createTalkFiles(logger);
connect(logger,SIGNAL(closed()),this,SLOT(close())); connect(logger,SIGNAL(closed()),this,SLOT(close()));
} }
@ -208,64 +130,21 @@ void InstallTalkWindow::setDeviceSettings(QSettings *dev)
{ {
devices = dev; devices = dev;
qDebug() << "Install::setDeviceSettings:" << devices; qDebug() << "Install::setDeviceSettings:" << devices;
QStringList encoders;
QStringList encodersOpts;
QStringList encodersTemplates;
QStringList tts;
QStringList ttsOpts;
QStringList ttsTemplates;
devices->beginGroup("encoders"); QString profile;
QStringList keys = devices->allKeys();
qDebug() << keys;
for(int i=0; i < keys.size();i++)
{
encoders << devices->value(keys.at(i),"null").toString();
}
qDebug() << encoders;
devices->endGroup();
for(int i=0; i < encoders.size();i++)
{
devices->beginGroup(encoders.at(i));
encodersOpts << devices->value("options","null").toString();
encodersTemplates << devices->value("template","null").toString();
devices->endGroup();
}
qDebug() << encodersOpts;
qDebug() << encodersTemplates;
profile = userSettings->value("ttspreset").toString();
devices->beginGroup("tts"); devices->beginGroup("tts");
keys = devices->allKeys(); ui.labelTtsProfile->setText(tr("TTS Profile: <b>%1</b>")
qDebug() << keys; .arg(devices->value(profile, tr("Invalid TTS profile!")).toString()));
for(int i=0; i < keys.size();i++) qDebug() << profile;
{ devices->endGroup();
tts << devices->value(keys.at(i),"null").toString(); profile = userSettings->value("encpreset").toString();
} devices->beginGroup("encoders");
qDebug() << tts; ui.labelEncProfile->setText(tr("Encoder Profile: <b>%1</b>")
.arg(devices->value(profile, tr("Invalid encoder profile!")).toString()));
qDebug() << profile;
devices->endGroup(); devices->endGroup();
for(int i= 0; i < tts.size();i++)
{
devices->beginGroup(tts.at(i));
ttsOpts << devices->value("options","null").toString();
ttsTemplates << devices->value("template","null").toString();
devices->endGroup();
}
qDebug() << ttsOpts;
qDebug() << ttsTemplates;
talkcreator->setSupportedEnc(encoders);
talkcreator->setSupportedEncOptions(encodersOpts);
talkcreator->setSupportedEncTemplates(encodersTemplates);
talkcreator->setSupportedTTS(tts);
talkcreator->setSupportedTTSOptions(ttsOpts);
talkcreator->setSupportedTTSTemplates(ttsTemplates);
ui.Encodercbx->insertItems(0,talkcreator->getSupportedEnc());
ui.TTScbx->insertItems(0,talkcreator->getSupportedTTS());
} }
@ -277,7 +156,6 @@ void InstallTalkWindow::setUserSettings(QSettings *user)
talkcreator->setMountPoint(userSettings->value("defaults/mountpoint").toString()); talkcreator->setMountPoint(userSettings->value("defaults/mountpoint").toString());
setTalkFolder(userSettings->value("defaults/folderToTalk").toString()); setTalkFolder(userSettings->value("last_talked_folder").toString());
setEncoderExec(userSettings->value("defaults/pathEncoder").toString());
setTTSExec(userSettings->value("defaults/pathTTS").toString());
} }

View file

@ -32,7 +32,7 @@ class InstallTalkWindow : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
InstallTalkWindow(QWidget *parent = 0); InstallTalkWindow(QWidget *parent = 0);
void setUserSettings(QSettings*); void setUserSettings(QSettings*);
void setDeviceSettings(QSettings*); void setDeviceSettings(QSettings*);
@ -40,21 +40,11 @@ class InstallTalkWindow : public QDialog
void accept(void); void accept(void);
private slots: private slots:
void browseFolder(void); void browseFolder(void);
void browseTTS(void); void setTalkFolder(QString folder);
void browseEncoder(void);
void setTalkFolder(QString folder);
void setTTSExec(QString path);
void setEncoderExec(QString path);
void setEncoderOptions(int index);
void setTTSOptions(int index);
void setEncoderOptions(QString options);
void setTTSOptions(QString options);
private: private:
TalkFileCreator* talkcreator; TalkFileCreator* talkcreator;
Ui::InstallTalkFrm ui; Ui::InstallTalkFrm ui;
ProgressLoggerGui* logger; ProgressLoggerGui* logger;
QSettings *devices; QSettings *devices;
@ -62,5 +52,4 @@ class InstallTalkWindow : public QDialog
}; };
#endif #endif

View file

@ -47,7 +47,7 @@ public:
void setUnzip(bool i) { m_unzip = i; } void setUnzip(bool i) { m_unzip = i; }
void setTarget(QString t) { m_target = t; } void setTarget(QString t) { m_target = t; }
void setCache(QDir c) { m_cache = c; }; void setCache(QDir c) { m_cache = c; };
void setCache(QString c) { m_cache = QDir(c); qDebug() << "!!!set cache:" << m_cache;} void setCache(QString c) { m_cache = QDir(c);}
signals: signals:
void done(bool error); void done(bool error);

View file

@ -342,21 +342,47 @@ manualname=
brand=Sandisk brand=Sandisk
[encoders] [encoders]
encoder01 = lame encpreset01 = "Lame (default)"
encpreset02 = "Lame (user-adjusted)"
[tts] [encpreset01]
tts01 = espeak encoder = lame
tts02 = flite
[lame]
options = "" options = ""
template = "\"%exe\" %options \"%input\" \"%output\"" template = "\"%exe\" %options \"%input\" \"%output\""
edit = false
[espeak]
[encpreset02]
encoder = lame
options = ""
template = "\"%exe\" %options \"%input\" \"%output\""
edit = true
[tts]
ttspreset01 = "espeak (default)"
ttspreset02 = "espeak (user-adjusted)"
ttspreset03 = "flite (default)"
ttspreset04 = "flite (user-adjusted)"
[ttspreset01]
tts = "espeak"
options = "" options = ""
template = "\"%exe\" %options -w \"%wavfile\" \"%text\"" template = "\"%exe\" %options -w \"%wavfile\" \"%text\""
edit = false
[flite] [ttspreset02]
tts = "espeak"
options = ""
template = "\"%exe\" %options -w \"%wavfile\" \"%text\""
edit = true
[ttspreset03]
tts = "flite"
options = "" options = ""
template = "\"%exe\" %options -o \"%wavfile\" \"%text\"" template = "\"%exe\" %options -o \"%wavfile\" \"%text\""
edit = false
[ttspreset04]
tts = "flite"
options = ""
template = "\"%exe\" %options -o \"%wavfile\" \"%text\""
edit = true

View file

@ -4,6 +4,7 @@
<file>gpl-2.0.html</file> <file>gpl-2.0.html</file>
</qresource> </qresource>
<qresource prefix="/icons" > <qresource prefix="/icons" >
<file>icons/audio-input-microphone.png</file>
<file>icons/bootloader_btn.png</file> <file>icons/bootloader_btn.png</file>
<file>icons/dialog-error.png</file> <file>icons/dialog-error.png</file>
<file>icons/dialog-information.png</file> <file>icons/dialog-information.png</file>

View file

@ -24,19 +24,6 @@ TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent)
} }
void TalkFileCreator::setTTsType(QString tts)
{
m_curTTS = tts;
int index = m_supportedTTS.indexOf(m_curTTS);
m_curTTSTemplate = m_supportedTTSTemplates.at(index);
}
void TalkFileCreator::setEncType(QString enc)
{
m_curEnc = enc;
int index = m_supportedEnc.indexOf(m_curEnc);
m_curEncTemplate = m_supportedEncTemplates.at(index);
}
bool TalkFileCreator::initEncoder() bool TalkFileCreator::initEncoder()
{ {
@ -203,17 +190,4 @@ bool TalkFileCreator::encode(QString input,QString output)
} }
QString TalkFileCreator::getTTsOpts(QString ttsname)
{
int index = m_supportedTTS.indexOf(ttsname);
return m_supportedTTSOpts.at(index);
}
QString TalkFileCreator::getEncOpts(QString encname)
{
int index = m_supportedEnc.indexOf(encname);
return m_supportedEncOpts.at(index);
}

View file

@ -35,23 +35,13 @@ public:
void setTTSexe(QString exe){m_TTSexec=exe;} void setTTSexe(QString exe){m_TTSexec=exe;}
void setEncexe(QString exe){m_EncExec=exe;} void setEncexe(QString exe){m_EncExec=exe;}
void setSupportedTTS(QStringList list) {m_supportedTTS=list;} void setTTsType(QString tts) { m_curTTS = tts; }
void setSupportedTTSOptions(QStringList list) {m_supportedTTSOpts=list;}
void setSupportedTTSTemplates(QStringList list) {m_supportedTTSTemplates=list;}
QStringList getSupportedTTS(){return m_supportedTTS;}
void setTTsType(QString tts);
QString getTTsOpts(QString ttsname);
void setTTsOpts(QString opts) {m_TTSOpts=opts;} void setTTsOpts(QString opts) {m_TTSOpts=opts;}
void setTTsTemplate(QString t) { m_curTTSTemplate = t; }
void setSupportedEnc(QStringList list) {m_supportedEnc=list;}
void setSupportedEncOptions(QStringList list) {m_supportedEncOpts=list;}
void setSupportedEncTemplates(QStringList list) {m_supportedEncTemplates=list;}
QStringList getSupportedEnc(){return m_supportedEnc;} void setEncType(QString enc) { m_curEnc = enc; }
void setEncType(QString enc);
QString getEncOpts(QString encname);
void setEncOpts(QString opts) {m_EncOpts=opts;} void setEncOpts(QString opts) {m_EncOpts=opts;}
void setEncTemplate(QString t) { m_curEncTemplate = t; }
void setDir(QString dir){m_dir = dir; } void setDir(QString dir){m_dir = dir; }
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
@ -78,17 +68,11 @@ private:
QString m_mountpoint; QString m_mountpoint;
QString m_curTTS; QString m_curTTS;
QString m_TTSexec; QString m_TTSexec;
QStringList m_supportedTTS;
QStringList m_supportedTTSOpts;
QStringList m_supportedTTSTemplates;
QString m_TTSOpts; QString m_TTSOpts;
QString m_curTTSTemplate; QString m_curTTSTemplate;
QString m_curEnc; QString m_curEnc;
QString m_EncExec; QString m_EncExec;
QStringList m_supportedEnc;
QStringList m_supportedEncOpts;
QStringList m_supportedEncTemplates;
QString m_EncOpts; QString m_EncOpts;
QString m_curEncTemplate; QString m_curEncTemplate;