jovie: replace KProcess with QProcess

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-06-26 18:49:11 +03:00
parent 5b149fadc9
commit 54d2587bbe
4 changed files with 15 additions and 19 deletions

View file

@ -218,10 +218,10 @@ bool XmlTransformerProc::asyncConvert(const QString& inputText, TalkerCode* talk
m_outFilename = outFile.fileName(); m_outFilename = outFile.fileName();
/// Spawn an xsltproc process to apply our stylesheet to input file. /// Spawn an xsltproc process to apply our stylesheet to input file.
m_xsltProc = new KProcess; m_xsltProc = new QProcess;
m_xsltProc->setOutputChannelMode(KProcess::SeparateChannels); m_xsltProc->setProcessChannelMode(QProcess::SeparateChannels);
*m_xsltProc << m_xsltprocPath; const QStringList xsltProcArgs = QStringList()
*m_xsltProc << QLatin1String("-o") << m_outFilename << QLatin1String("--novalid") << QLatin1String("-o") << m_outFilename << QLatin1String("--novalid")
<< m_xsltFilePath << m_inFilename; << m_xsltFilePath << m_inFilename;
// Warning: This won't compile under KDE 3.2. See FreeTTS::argsToStringList(). // Warning: This won't compile under KDE 3.2. See FreeTTS::argsToStringList().
// kDebug() << "SSMLConvert::transform: executing command: " << // kDebug() << "SSMLConvert::transform: executing command: " <<
@ -234,10 +234,10 @@ bool XmlTransformerProc::asyncConvert(const QString& inputText, TalkerCode* talk
this, SLOT(slotReceivedStdout())); this, SLOT(slotReceivedStdout()));
connect(m_xsltProc, SIGNAL(readyReadStandardError()), connect(m_xsltProc, SIGNAL(readyReadStandardError()),
this, SLOT(slotReceivedStderr())); this, SLOT(slotReceivedStderr()));
m_xsltProc->start(); m_xsltProc->start(m_xsltprocPath, xsltProcArgs);
if (!m_xsltProc->waitForStarted()) if (!m_xsltProc->waitForStarted())
{ {
kDebug() << "XmlTransformerProc::convert: Error starting xsltproc"; kWarning() << "XmlTransformerProc::convert: Error starting xsltproc";
m_state = fsIdle; m_state = fsIdle;
return false; return false;
} }

View file

@ -27,9 +27,7 @@
// Qt includes. // Qt includes.
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QProcess>
// KDE includes.
#include <kprocess.h>
// KTTS includes. // KTTS includes.
#include "filterproc.h" #include "filterproc.h"
@ -168,7 +166,7 @@ private:
// Processing state. // Processing state.
int m_state; int m_state;
// xsltproc process. // xsltproc process.
KProcess* m_xsltProc; QProcess* m_xsltProc;
// Input and Output filenames. // Input and Output filenames.
QString m_inFilename; QString m_inFilename;
QString m_outFilename; QString m_outFilename;

View file

@ -37,9 +37,7 @@
// KTTSD includes. // KTTSD includes.
#include <config-jovie.h> #include <config-jovie.h>
#ifdef OPENTTS_FOUND #if defined(SPEECHD_FOUND)
#include <opentts/libopentts.h>
#elif defined(SPEECHD_FOUND)
#include <libspeechd.h> #include <libspeechd.h>
#endif #endif

View file

@ -229,9 +229,9 @@ bool SSMLConvert::transform(const QString &text, const QString &xsltFilename) {
m_outFilename = outFile.fileName(); m_outFilename = outFile.fileName();
/// Spawn an xsltproc process to apply our stylesheet to our SSML file. /// Spawn an xsltproc process to apply our stylesheet to our SSML file.
QStringList args;
m_xsltProc = new QProcess; m_xsltProc = new QProcess;
args << QLatin1String( "-o" ) << m_outFilename << QLatin1String( "--novalid" ) QStringList xsltProcArgs= QStringList()
<< QLatin1String( "-o" ) << m_outFilename << QLatin1String( "--novalid" )
<< m_xsltFilename << m_inFilename; << m_xsltFilename << m_inFilename;
// Warning: This won't compile under KDE 3.2. See FreeTTS::argsToStringList(). // Warning: This won't compile under KDE 3.2. See FreeTTS::argsToStringList().
// kDebug() << "SSMLConvert::transform: executing command: " << // kDebug() << "SSMLConvert::transform: executing command: " <<
@ -239,10 +239,10 @@ bool SSMLConvert::transform(const QString &text, const QString &xsltFilename) {
connect(m_xsltProc, SIGNAL(finished(int,QProcess::ExitStatus)), connect(m_xsltProc, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(slotProcessExited())); this, SLOT(slotProcessExited()));
m_xsltProc->start(QLatin1String("xsltproc"), args); m_xsltProc->start(QLatin1String("xsltproc"), xsltProcArgs);
if (m_xsltProc->state() != QProcess::Running && m_xsltProc->state() != QProcess::Starting) if (!m_xsltProc->waitForStarted())
{ {
kDebug() << "SSMLConvert::transform: Error starting xsltproc"; kWarning() << "SSMLConvert::transform: Error starting xsltproc";
return false; return false;
} }
m_state = tsTransforming; m_state = tsTransforming;