1
0
Fork 0
forked from len0rd/rockbox

rbutil: QString::split() changed with Qt 5.14.

Avoid a deprecated warning, and make it compile with Qt6, which removes
the old version.

Change-Id: Iaad10660a0c8bda9d7aa52ee250489ed135bd8a8
This commit is contained in:
Dominik Riebeling 2020-07-27 22:31:26 +02:00
parent d5820ff779
commit cd352d9052
4 changed files with 30 additions and 2 deletions

View file

@ -295,7 +295,11 @@ QString TTSFestival::getVoiceInfo(QString voice)
Qt::CaseInsensitive, QRegExp::Wildcard));
LOG_INFO() << "voiceInfo w/o descr:" << response;
response = response.remove(')');
#if QT_VERSION >= 0x050e00
QStringList responseLines = response.split('(', Qt::SkipEmptyParts);
#else
QStringList responseLines = response.split('(', QString::SkipEmptyParts);
#endif
responseLines.removeAt(0); // the voice name itself
QString description;

View file

@ -204,7 +204,11 @@ QStringList TTSSapi::getVoiceList(QString language)
if(dataRaw.startsWith("Error")) {
LOG_INFO() << "Error:" << dataRaw;
}
result = dataRaw.split(";",QString::SkipEmptyParts);
#if QT_VERSION >= 0x050e00
result = dataRaw.split(";", Qt::SkipEmptyParts);
#else
result = dataRaw.split(";", QString::SkipEmptyParts);
#endif
if(result.size() > 0)
{
result.sort();

View file

@ -93,7 +93,11 @@ QString Utils::resolvePathCase(QString path)
{
int start;
QString realpath;
#if QT_VERSION >= 0x050e00
QStringList elems = path.split("/", Qt::SkipEmptyParts);
#else
QStringList elems = path.split("/", QString::SkipEmptyParts);
#endif
if(path.isEmpty())
return QString();
@ -280,9 +284,17 @@ QString Utils::findExecutable(QString name)
QString exepath;
//try autodetect tts
#if defined(Q_OS_LINUX) || defined(Q_OS_MACX) || defined(Q_OS_OPENBSD)
#if QT_VERSION >= 0x050e00
QStringList path = QString(getenv("PATH")).split(":", Qt::SkipEmptyParts);
#else
QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
#endif
#elif defined(Q_OS_WIN)
#if QT_VERSION >= 0x050e00
QStringList path = QString(getenv("PATH")).split(";", Qt::SkipEmptyParts);
#else
QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
#endif
#endif
LOG_INFO() << "system path:" << path;
for(int i = 0; i < path.size(); i++)
@ -290,7 +302,11 @@ QString Utils::findExecutable(QString name)
QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + name;
#if defined(Q_OS_WIN)
executable += ".exe";
#if QT_VERSION >= 0x050e00
QStringList ex = executable.split("\"", Qt::SkipEmptyParts);
#else
QStringList ex = executable.split("\"", QString::SkipEmptyParts);
#endif
executable = ex.join("");
#endif
if(QFileInfo(executable).isExecutable())

View file

@ -111,7 +111,11 @@ void InstallTalkWindow::accept()
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
talkcreator->setTalkFolders(ui.talkFolders->isChecked());
talkcreator->setTalkFiles(ui.talkFiles->isChecked());
talkcreator->setIgnoreFiles(ui.ignoreFiles->text().split(",",QString::SkipEmptyParts));
#if QT_VERSION >= 0x050e00
talkcreator->setIgnoreFiles(ui.ignoreFiles->text().split(",", Qt::SkipEmptyParts));
#else
talkcreator->setIgnoreFiles(ui.ignoreFiles->text().split(",", QString::SkipEmptyParts));
#endif
connect(talkcreator, SIGNAL(done(bool)), logger, SLOT(setFinished()));
connect(talkcreator, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));