summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-29 10:09:17 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-29 10:09:17 +0000
commitce2142ec5b8252803f81d0a8c8e7c710252cd613 (patch)
treed8c92069125c4dbac6d6de178651c29d0a973b64 /rbutil
parent177716c2f9d2347b67fe763642a6aa2db27860bd (diff)
downloadrockbox-ce2142ec5b8252803f81d0a8c8e7c710252cd613.tar.gz
rockbox-ce2142ec5b8252803f81d0a8c8e7c710252cd613.zip
Auto-detect binary in TTS / encoder setting dialog by searching $PATH. Only linux for now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14505 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/configure.cpp46
1 files changed, 44 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index b1f778b586..62a34d90a5 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -316,22 +316,64 @@ void Config::setDevices(QSettings *dev)
void Config::updateEncOpts(int index)
{
qDebug() << "updateEncOpts()";
+ QString encoder;
+ bool edit;
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());
+ edit = devices->value("edit").toBool();
+ ui.encoderOptions->setEnabled(edit);
+ encoder = devices->value("encoder").toString();
devices->endGroup();
+
+ // try to autodetect encoder
+#if defined(Q_OS_LINUX)
+ QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
+ qDebug() << path;
+ ui.encoderExecutable->setEnabled(true);
+ for(int i = 0; i < path.size(); i++) {
+ QString executable = path.at(i) + "/" + encoder;
+ if(QFileInfo(executable).isExecutable()) {
+ qDebug() << "found:" << executable;
+ ui.encoderExecutable->setText(executable);
+ // disallow changing the detected path if non-customizable profile
+ if(!edit)
+ ui.encoderExecutable->setEnabled(false);
+ break;
+ }
+ }
+#endif
}
void Config::updateTtsOpts(int index)
{
+ bool edit;
+ QString e;
QString c = ui.comboTts->itemData(index, Qt::UserRole).toString();
devices->beginGroup(c);
- qDebug() << devices->value("edit").toBool();
+ edit = devices->value("edit").toBool();
ui.ttsOptions->setText(devices->value("options").toString());
ui.ttsOptions->setEnabled(devices->value("edit").toBool());
+ e = devices->value("tts").toString();
devices->endGroup();
+
+#if defined(Q_OS_LINUX)
+ QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
+ qDebug() << path;
+ ui.ttsExecutable->setEnabled(true);
+ for(int i = 0; i < path.size(); i++) {
+ QString executable = path.at(i) + "/" + e;
+ if(QFileInfo(executable).isExecutable()) {
+ qDebug() << "found:" << executable;
+ ui.ttsExecutable->setText(executable);
+ // disallow changing the detected path if non-customizable profile
+ if(!edit)
+ ui.ttsExecutable->setEnabled(false);
+ break;
+ }
+ }
+#endif
}