本文整理汇总了C++中QProcess::closeReadChannel方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcess::closeReadChannel方法的具体用法?C++ QProcess::closeReadChannel怎么用?C++ QProcess::closeReadChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProcess
的用法示例。
在下文中一共展示了QProcess::closeReadChannel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: voice
TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
{
qDebug() << "[Festival] Voicing " << text << "->" << wavfile;
QString path = RbSettings::subValue("festival-client",
RbSettings::TtsPath).toString();
QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp"
" --output \"%2\" --prolog \"%3\" - ").arg(path).arg(wavfile).arg(prologPath);
qDebug() << "[Festival] Client cmd: " << cmd;
QProcess clientProcess;
clientProcess.start(cmd);
clientProcess.write(QString("%1.\n").arg(text).toAscii());
clientProcess.waitForBytesWritten();
clientProcess.closeWriteChannel();
clientProcess.waitForReadyRead();
QString response = clientProcess.readAll();
response = response.trimmed();
if(!response.contains("Utterance"))
{
qDebug() << "[Festival] Could not voice string: " << response;
*errStr = tr("engine could not voice string");
return Warning;
/* do not stop the voicing process because of a single string
TODO: needs proper settings */
}
clientProcess.closeReadChannel(QProcess::StandardError);
clientProcess.closeReadChannel(QProcess::StandardOutput);
clientProcess.terminate();
clientProcess.kill();
return NoError;
}
示例2: startServer
void ServerManager::startServer(int id) const
{
QStringList args = QCoreApplication::arguments();
args.removeFirst();
if (id < 0) {
id = startCounter;
}
TWebApplication::MultiProcessingModule mpm = Tf::app()->multiProcessingModule();
if (mpm == TWebApplication::Hybrid || mpm == TWebApplication::Thread) {
if (id < maxServers) {
args.prepend(QString::number(id));
args.prepend("-i"); // give ID for app server
}
}
if (listeningSocket > 0) {
args.prepend(QString::number(listeningSocket));
args.prepend("-s");
}
QProcess *tfserver = new QProcess;
serversStatus.insert(tfserver, id);
connect(tfserver, SIGNAL(started()), this, SLOT(updateServerStatus()));
connect(tfserver, SIGNAL(error(QProcess::ProcessError)), this, SLOT(errorDetect(QProcess::ProcessError)));
connect(tfserver, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(serverFinish(int, QProcess::ExitStatus)));
connect(tfserver, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); // For error notification
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
// Sets LD_LIBRARY_PATH environment variable
QString ldpath = "."; // means the lib dir
QString sysldpath = QProcess::systemEnvironment().filter("LD_LIBRARY_PATH=", Qt::CaseSensitive).value(0).mid(16);
if (!sysldpath.isEmpty()) {
ldpath += ":";
ldpath += sysldpath;
}
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", ldpath);
tSystemDebug("export %s=%s", "LD_LIBRARY_PATH", qPrintable(ldpath));
QString preload = Tf::appSettings()->value(Tf::LDPreload).toString();
if (!preload.isEmpty()) {
env.insert("LD_PRELOAD", preload);
tSystemDebug("export %s=%s", "LD_PRELOAD", qPrintable(preload));
}
tfserver->setProcessEnvironment(env);
#endif
// Executes treefrog server
tfserver->start(TFSERVER_CMD, args, QIODevice::ReadOnly);
tfserver->closeReadChannel(QProcess::StandardOutput);
tfserver->closeWriteChannel();
tSystemDebug("tfserver started");
++startCounter;
}
示例3: closeReadChannel
void QProcessProto::closeReadChannel(QProcess::ProcessChannel channel)
{
QProcess *item = qscriptvalue_cast<QProcess*>(thisObject());
if (item)
item->closeReadChannel(channel);
}
示例4: launch
void US_Win::launch( int index )
{
static const int trig_secs=3600;
index -= P_CONFIG;
QString pname = p[ index ].name;
// At each launch, check for notices if last check was over 24 hours ago
if ( ln_time.secsTo( QDateTime::currentDateTime() ) > trig_secs )
notice_check();
if ( p[ index ].maxRunCount <= p[ index ].currentRunCount &&
p[ index ].maxRunCount > 0 )
{
if ( p[ index ].index == P_CONFIG )
{
QMessageBox::information( this,
tr( "Already Running" ),
tr( "The configuration program is already running.\n"
"Click on the task bar item named UltraScan "
"Configuration to continue." ) );
}
else
{
QMessageBox::warning( this,
tr( "Error" ),
pname + tr( " is already running." ) );
}
return;
}
statusBar()->showMessage(
tr( "Loading " ) + p[ index ].runningMsg + "..." );
QProcess* process = new QProcess( 0 );
process->closeReadChannel( QProcess::StandardOutput );
process->closeReadChannel( QProcess::StandardError );
connect ( process, SIGNAL( finished ( int, QProcess::ExitStatus ) ),
this , SLOT ( terminated( int, QProcess::ExitStatus ) ) );
#ifndef Q_OS_MAC
process->start( pname );
#else
QString procbin = US_Settings::appBaseDir() + "/bin/" + pname;
QString procapp = procbin + ".app";
if ( !QFile( procapp ).exists() )
procapp = procbin;
process->start( "open", QStringList(procapp) );
#endif
if ( ! process->waitForStarted( 10000 ) ) // 10 second timeout
{
QMessageBox::information( this,
tr( "Error" ),
tr( "There was a problem creating a subprocess\nfor " ) + pname );
}
else
{
p[ index ].currentRunCount++;
procData* pr = new procData;
pr->proc = process;
pr->name = pname;
pr->index = index;
procs << pr;
}
statusBar()->showMessage(
tr( "Loaded " ) + p[ index ].runningMsg + "..." );
}