void Process::initialize(size_t bufSize) // ---------------------------------------------------------------------------- // Initialize the process and streambuf // ---------------------------------------------------------------------------- { num = snum++; // Allocate data to be used by the streambuf char *ptr = new char[bufSize]; setp(ptr, ptr + bufSize); // Set up the stderr/stdout signal mechanism connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); connect(this, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); // Set up debug traces IFTRACE(process) { connect(this, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(debugProcessFinished(int,QProcess::ExitStatus))); connect(this, SIGNAL(error(QProcess::ProcessError)), this, SLOT(debugProcessError(QProcess::ProcessError))); } }
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; }
Compiler::Compiler(QWidget *parent) : Page(parent), m_serial(this) { setupUi(this); QObject::connect(&m_compiler, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); QObject::connect(&m_compiler, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); QObject::connect(&m_compiler, SIGNAL(finished(int, QProcess::ExitStatus)), UserProgram::instance(), SLOT(compileFinished(int, QProcess::ExitStatus))); QObject::connect(&m_serial, SIGNAL(downloadFinished(QString)), this, SLOT(compileFile(QString))); m_serial.start(); }
Compiler::Compiler(QWidget *parent) : QDialog(parent) { setupUi(this); #ifdef QT_ARCH_ARM setWindowState(windowState() | Qt::WindowFullScreen); #endif QObject::connect(&m_compiler, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); QObject::connect(&m_compiler, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); }
MPlayerMediaWidget::MPlayerMediaWidget(QWidget *parent) : AbstractMediaWidget(parent), muted(false), volume(0), aspectRatio(MediaWidget::AspectRatioAuto), deinterlacing(false), timerId(0), videoWidth(0), videoHeight(0), videoAspectRatio(1) { videoWidget = new MPlayerVideoWidget(this); standardError.open(stderr, QIODevice::WriteOnly); connect(&process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError))); connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); process.start(QString("mplayer -idle -osdlevel 0 -quiet -slave -softvol -vf yadif " "-volume 0 -wid %1").arg(videoWidget->winId())); }
UpdateProcess::UpdateProcess(QObject *parent) : QProcess(parent) { _currentCommand = NoCommand; _socksPort = 0; connect(this, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onFinished(int, QProcess::ExitStatus))); setEnvironment(systemEnvironment()); }
Utilities::Process::Process(QObject *parent) : QProcess(parent) { connect( this, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); connect( this, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); }