mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
make detection of tts / encoder binary by searching the path work on windows too. As MacOS AFAIK works the same was as Linux use the same method here -- hopefully this doesn't break anything.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14509 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
57c2a5fa5a
commit
bc5a7e391c
1 changed files with 25 additions and 13 deletions
|
|
@ -24,9 +24,7 @@
|
||||||
#include "ui_configurefrm.h"
|
#include "ui_configurefrm.h"
|
||||||
#include "browsedirtree.h"
|
#include "browsedirtree.h"
|
||||||
|
|
||||||
#ifdef __linux
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEFAULT_LANG "English (builtin)"
|
#define DEFAULT_LANG "English (builtin)"
|
||||||
|
|
||||||
|
|
@ -316,33 +314,40 @@ void Config::setDevices(QSettings *dev)
|
||||||
void Config::updateEncOpts(int index)
|
void Config::updateEncOpts(int index)
|
||||||
{
|
{
|
||||||
qDebug() << "updateEncOpts()";
|
qDebug() << "updateEncOpts()";
|
||||||
QString encoder;
|
QString e;
|
||||||
bool edit;
|
bool edit;
|
||||||
QString c = ui.comboEncoder->itemData(index, Qt::UserRole).toString();
|
QString c = ui.comboEncoder->itemData(index, Qt::UserRole).toString();
|
||||||
devices->beginGroup(c);
|
devices->beginGroup(c);
|
||||||
ui.encoderOptions->setText(devices->value("options").toString());
|
ui.encoderOptions->setText(devices->value("options").toString());
|
||||||
edit = devices->value("edit").toBool();
|
edit = devices->value("edit").toBool();
|
||||||
ui.encoderOptions->setEnabled(edit);
|
ui.encoderOptions->setEnabled(edit);
|
||||||
encoder = devices->value("encoder").toString();
|
e = devices->value("encoder").toString();
|
||||||
devices->endGroup();
|
devices->endGroup();
|
||||||
|
|
||||||
// try to autodetect encoder
|
// try to autodetect encoder
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MACX)
|
||||||
QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
|
QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
|
QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
qDebug() << path;
|
qDebug() << path;
|
||||||
ui.encoderExecutable->setEnabled(true);
|
ui.encoderExecutable->setEnabled(true);
|
||||||
for(int i = 0; i < path.size(); i++) {
|
for(int i = 0; i < path.size(); i++) {
|
||||||
QString executable = path.at(i) + "/" + encoder;
|
QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + e;
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
executable += ".exe";
|
||||||
|
QStringList ex = executable.split("\"", QString::SkipEmptyParts);
|
||||||
|
executable = ex.join("");
|
||||||
|
#endif
|
||||||
if(QFileInfo(executable).isExecutable()) {
|
if(QFileInfo(executable).isExecutable()) {
|
||||||
qDebug() << "found:" << executable;
|
qDebug() << "found:" << executable;
|
||||||
ui.encoderExecutable->setText(executable);
|
ui.encoderExecutable->setText(QDir::toNativeSeparators(executable));
|
||||||
// disallow changing the detected path if non-customizable profile
|
// disallow changing the detected path if non-customizable profile
|
||||||
if(!edit)
|
if(!edit)
|
||||||
ui.encoderExecutable->setEnabled(false);
|
ui.encoderExecutable->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -358,22 +363,29 @@ void Config::updateTtsOpts(int index)
|
||||||
e = devices->value("tts").toString();
|
e = devices->value("tts").toString();
|
||||||
devices->endGroup();
|
devices->endGroup();
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MACX)
|
||||||
QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
|
QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
|
QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
qDebug() << path;
|
qDebug() << path;
|
||||||
ui.ttsExecutable->setEnabled(true);
|
ui.ttsExecutable->setEnabled(true);
|
||||||
for(int i = 0; i < path.size(); i++) {
|
for(int i = 0; i < path.size(); i++) {
|
||||||
QString executable = path.at(i) + "/" + e;
|
QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + e;
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
executable += ".exe";
|
||||||
|
QStringList ex = executable.split("\"", QString::SkipEmptyParts);
|
||||||
|
executable = ex.join("");
|
||||||
|
#endif
|
||||||
|
qDebug() << executable;
|
||||||
if(QFileInfo(executable).isExecutable()) {
|
if(QFileInfo(executable).isExecutable()) {
|
||||||
qDebug() << "found:" << executable;
|
ui.ttsExecutable->setText(QDir::toNativeSeparators(executable));
|
||||||
ui.ttsExecutable->setText(executable);
|
|
||||||
// disallow changing the detected path if non-customizable profile
|
// disallow changing the detected path if non-customizable profile
|
||||||
if(!edit)
|
if(!edit)
|
||||||
ui.ttsExecutable->setEnabled(false);
|
ui.ttsExecutable->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue