mirror of
https://github.com/opentx/opentx.git
synced 2025-07-17 13:25:20 +03:00
Fixes #1903
Conflicts: companion/src/modeledit/customfunctions.cpp companion/src/modeledit/customfunctions.h
This commit is contained in:
parent
65ff9dcefa
commit
f608985a54
4 changed files with 76 additions and 32 deletions
|
@ -1023,3 +1023,29 @@ QString generateProcessUniqueTempFileName(const QString & fileName)
|
|||
sanitizedFileName.remove('/');
|
||||
return QDir::tempPath() + QString("/%1-").arg(QCoreApplication::applicationPid()) + sanitizedFileName;
|
||||
}
|
||||
|
||||
QString getSoundsPath(const GeneralSettings &generalSettings)
|
||||
{
|
||||
QString path = g.profile[g.id()].sdPath() + "/SOUNDS/";
|
||||
QString lang = generalSettings.ttsLanguage;
|
||||
if (lang.isEmpty())
|
||||
lang = "en";
|
||||
path.append(lang);
|
||||
return path;
|
||||
}
|
||||
|
||||
QSet<QString> getFilesSet(const QString &path, const QStringList &filter, int maxLen)
|
||||
{
|
||||
QSet<QString> result;
|
||||
QDir dir(path);
|
||||
if (dir.exists()) {
|
||||
foreach (QString filename, dir.entryList(filter, QDir::Files)) {
|
||||
QFileInfo file(filename);
|
||||
QString name = file.completeBaseName();
|
||||
if (name.length() <= maxLen) {
|
||||
result.insert(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue