ProcessReporter::~ProcessReporter() { disconnect(mProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); disconnect(mProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); disconnect(mProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus))); disconnect(mProcess, SIGNAL(readyRead()), this, SLOT(processReadyRead())); }
void ProcessThread::processFile() { m_aborted = false; bool bSuccess = true; qDebug("Process thread %s has started.", m_jobId.toString().toLatin1().constData()); emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), tr("Starting..."), ProgressModel::JobRunning); handleMessage(QString().sprintf("LameXP v%u.%02u (Build #%u), compiled on %s at %s", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(), lamexp_version_time())); handleMessage("\n-------------------------------\n"); //Generate output file name QString outFileName = generateOutFileName(); if(outFileName.isEmpty()) { emit processStateChanged(m_jobId, tr("Not found!"), ProgressModel::JobFailed); emit processStateFinished(m_jobId, outFileName, false); return; } //Do we need to take care of downsampling the input? if(m_encoder->requiresDownsample()) { insertDownsampleFilter(); } //Do we need Stereo downmix? if(m_encoder->requiresDownmix()) { insertDownmixFilter(); } QString sourceFile = m_audioFile.filePath(); //Decode source file if(!m_filters.isEmpty() || !m_encoder->isFormatSupported(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion())) { m_currentStep = DecodingStep; AbstractDecoder *decoder = DecoderRegistry::lookup(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion()); if(decoder) { QString tempFile = generateTempFileName(); connect(decoder, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection); connect(decoder, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection); bSuccess = decoder->decode(sourceFile, tempFile, &m_aborted); LAMEXP_DELETE(decoder); if(bSuccess) { sourceFile = tempFile; handleMessage("\n-------------------------------\n"); } } else {
void QueueLocal::runProgram(int jobId) { if (!m_process) { m_process = new QProcess(this); connect(m_process, SIGNAL(started()), this, SLOT(jobStarted())); connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(jobFinished(int,QProcess::ExitStatus))); connect(m_process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); }
ProcessReporter::ProcessReporter(QProcess* process, QString name) : mName(name) { CX_ASSERT(process); mProcess = process; connect(mProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState))); connect(mProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); connect(mProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus))); connect(mProcess, SIGNAL(readyRead()), this, SLOT(processReadyRead())); }
//============================================================================= // Creates QProcess object and starts the processes off then calls //============================================================================= bool PuttyWidget::startPuttyProcess(QString puttyPath, QString session, QString username, QString password, QString protocol, QString port) { FUNC_DEBUG; try { if (!puttyPath.isEmpty() && !session.isEmpty() && !username.isEmpty() && !password.isEmpty()) { procPutty = new QProcess(this); connect(procPutty,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(processStateChanged(QProcess::ProcessState))); this->setWindowTitle(session); this->sessionName = session; QStringList args; args << "-load" << session; args << "-l" << username; if (protocol == "ssh") { args << "-pw" << password; } args << "-P" << port; //return true; for (int i = 0; i < args.size(); i++) { DEBUG << QString("arugments: %1").arg((args.at(i))); } procPutty->start(puttyPath, args); if (procPutty->waitForStarted(4000)) { Thread::msleep(msecs); if (!addProcToWidget()) { procPutty->kill(); return false; } } else { procPutty->kill(); return false; } } else { return false; } } catch (std::exception &e) { DEBUG << "exception " << e.what(); return false; } return true; }
/*! * \internal */ void WebSocket::makeConnections(const QTcpSocket *pTcpSocket) { //pass through signals connect(pTcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError))); connect(pTcpSocket, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)), this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *))); connect(pTcpSocket, SIGNAL(readChannelFinished()), this, SIGNAL(readChannelFinished())); //connect(pTcpSocket, SIGNAL(aboutToClose()), this, SIGNAL(aboutToClose())); //connect(pTcpSocket, SIGNAL(bytesWritten(qint64)), this, SIGNAL(bytesWritten(qint64))); //catch signals connect(pTcpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(processStateChanged(QAbstractSocket::SocketState))); connect(pTcpSocket, SIGNAL(readyRead()), this, SLOT(processData())); connect(&m_dataProcessor, SIGNAL(controlFrameReceived(WebSocketProtocol::OpCode, QByteArray)), this, SLOT(processControlFrame(WebSocketProtocol::OpCode, QByteArray))); connect(&m_dataProcessor, SIGNAL(textFrameReceived(QString,bool)), this, SIGNAL(textFrameReceived(QString,bool))); connect(&m_dataProcessor, SIGNAL(binaryFrameReceived(QByteArray,bool)), this, SIGNAL(binaryFrameReceived(QByteArray,bool))); connect(&m_dataProcessor, SIGNAL(binaryMessageReceived(QByteArray)), this, SIGNAL(binaryMessageReceived(QByteArray))); connect(&m_dataProcessor, SIGNAL(textMessageReceived(QString)), this, SIGNAL(textMessageReceived(QString))); connect(&m_dataProcessor, SIGNAL(errorEncountered(WebSocketProtocol::CloseCode,QString)), this, SLOT(close(WebSocketProtocol::CloseCode,QString))); }