summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/installtalkwindow.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-28 23:10:42 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-28 23:10:42 +0000
commitc03102b34616f81f35cc2ea17af2942fd009d291 (patch)
treeb6a61535c9e63e9a982b9dc5493f0d27c86f2788 /rbutil/rbutilqt/installtalkwindow.cpp
parentf2bf042edfef57e499b4d18694acca92d435d447 (diff)
downloadrockbox-c03102b34616f81f35cc2ea17af2942fd009d291.tar.gz
rockbox-c03102b34616f81f35cc2ea17af2942fd009d291.tar.bz2
rockbox-c03102b34616f81f35cc2ea17af2942fd009d291.zip
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
Diffstat (limited to 'rbutil/rbutilqt/installtalkwindow.cpp')
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp192
1 files changed, 35 insertions, 157 deletions
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index d52d7788ce..cc2def6ab1 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -28,19 +28,12 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
talkcreator = new TalkFileCreator(this);
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.RemoveWav->setChecked(true);
ui.recursive->setChecked(true);
ui.OverwriteTalk->setChecked(true);
ui.StripExtensions->setChecked(true);
-
-
}
void InstallTalkWindow::browseFolder()
@@ -67,87 +60,9 @@ void InstallTalkWindow::browseFolder()
void InstallTalkWindow::setTalkFolder(QString folder)
{
- ui.lineTalkFolder->clear();
- ui.lineTalkFolder->insert(folder);
+ ui.lineTalkFolder->setText(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()
{
@@ -155,8 +70,8 @@ void InstallTalkWindow::accept()
logger->show();
QString folderToTalk = ui.lineTalkFolder->text();
- QString pathEncoder = ui.Encoderpath->text();
- QString pathTTS = ui.TTSpath->text();
+ QString pathEncoder = userSettings->value("encbin").toString();
+ QString pathTTS = userSettings->value("ttsbin").toString();
if(!QFileInfo(folderToTalk).isDir())
{
@@ -165,33 +80,40 @@ void InstallTalkWindow::accept()
return;
}
- if(!QFileInfo(pathEncoder).exists())
+ if(!QFileInfo(pathEncoder).isExecutable())
{
logger->addItem(tr("Path to Encoder is wrong!"),LOGERROR);
logger->abort();
return;
}
- if(!QFileInfo(pathTTS).exists())
+ if(!QFileInfo(pathTTS).isExecutable())
{
logger->addItem(tr("Path to TTS is wrong!"),LOGERROR);
logger->abort();
return;
}
- userSettings->setValue("defaults/folderToTalk",folderToTalk);
- userSettings->setValue("defaults/pathEncoder",pathEncoder);
- userSettings->setValue("defaults/pathTTS",pathTTS);
+ userSettings->setValue("last_talked_folder", folderToTalk);
userSettings->sync();
-
+
talkcreator->setDir(folderToTalk);
talkcreator->setTTSexe(pathTTS);
talkcreator->setEncexe(pathEncoder);
- talkcreator->setEncOpts(ui.EncoderOptions->text());
- talkcreator->setTTsOpts(ui.TTSOptions->text());
- talkcreator->setTTsType(ui.TTScbx->currentText());
- talkcreator->setEncType(ui.Encodercbx->currentText());
+ talkcreator->setEncOpts(userSettings->value("encopts").toString());
+ talkcreator->setTTsOpts(userSettings->value("ttsopts").toString());
+
+ 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->setOverwriteWav(ui.OverwriteWav->isChecked());
@@ -200,7 +122,7 @@ void InstallTalkWindow::accept()
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
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;
qDebug() << "Install::setDeviceSettings:" << devices;
-
- QStringList encoders;
- QStringList encodersOpts;
- QStringList encodersTemplates;
-
- QStringList tts;
- QStringList ttsOpts;
- QStringList ttsTemplates;
- devices->beginGroup("encoders");
- 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;
+ QString profile;
+ profile = userSettings->value("ttspreset").toString();
devices->beginGroup("tts");
- keys = devices->allKeys();
- qDebug() << keys;
- for(int i=0; i < keys.size();i++)
- {
- tts << devices->value(keys.at(i),"null").toString();
- }
- qDebug() << tts;
+ ui.labelTtsProfile->setText(tr("TTS Profile: <b>%1</b>")
+ .arg(devices->value(profile, tr("Invalid TTS profile!")).toString()));
+ qDebug() << profile;
+ devices->endGroup();
+ profile = userSettings->value("encpreset").toString();
+ devices->beginGroup("encoders");
+ ui.labelEncProfile->setText(tr("Encoder Profile: <b>%1</b>")
+ .arg(devices->value(profile, tr("Invalid encoder profile!")).toString()));
+ qDebug() << profile;
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());
- setTalkFolder(userSettings->value("defaults/folderToTalk").toString());
- setEncoderExec(userSettings->value("defaults/pathEncoder").toString());
- setTTSExec(userSettings->value("defaults/pathTTS").toString());
+ setTalkFolder(userSettings->value("last_talked_folder").toString());
+
}