Example #1
0
void KDSoapClientThread::run()
{
    QNetworkAccessManager accessManager;
    // Use own QEventLoop so its slot quit() is executed in this thread
    // (using QThread::exec/quit would try to call QThread::quit() in main thread,
    //  which is blocked on semaphore)
    QEventLoop eventLoop;

    while ( true ) {
        QMutexLocker locker( &m_mutex );
        while (!m_stopThread && m_queue.isEmpty()) {
            m_queueNotEmpty.wait( &m_mutex );
        }
        if (m_stopThread) {
            break;
        }
        KDSoapThreadTaskData* taskData = m_queue.dequeue();
        locker.unlock();

        KDSoapThreadTask task(taskData); // must be created here, so that it's in the right thread
        connect(&task, SIGNAL(taskDone()), &eventLoop, SLOT(quit()));
        connect(&accessManager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
                &task, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*)));
        task.process(accessManager);

        // Process events until the task tells us the handling of that task is finished
        eventLoop.exec();
    }
}
Example #2
0
void KDSoapThreadTask::slotFinished(KDSoapPendingCallWatcher* watcher)
{
    m_data->m_response = watcher->returnMessage();
    m_data->m_responseHeaders = watcher->returnHeaders();
    m_data->m_semaphore.release();
    // Helgrind bug: says this races with main thread. Looks like it's confused by QSharedDataPointer
    //qDebug() << m_data->m_returnArguments.value();
    watcher->deleteLater();

    emit taskDone();
}
void AfterEffectsBurner::slotProcessOutputLine( const QString & line, QProcess::ProcessChannel channel )
{
	bool com = line.contains( mCompleteRE );
	bool framecom = line.contains( mFrameCompleteRE );
#ifdef Q_OS_MAC
	bool fatalMachError = line.contains(QRegExp("failed to name Mach port"));
	if( fatalMachError ) {
		logMessage(line);
		jobErrored("the Host has fatal Mach Errors until AB restarts.");
		mSlave->setStatus("restart");
	}
#endif

	if( framecom ) {
		if( taskStarted() ) {
			bool frameCheckFailure = false;
			if( !mJob.outputPath().endsWith( ".avi" ) && !mJob.outputPath().endsWith( ".mov" ) ) {
				QString framePath = makeFramePath( mJob.outputPath(), mFrame );
				QFileInfo fi( framePath );
				frameCheckFailure = !(fi.exists() && fi.isFile() && fi.size() > 0);
				if( !frameCheckFailure )
					emit fileGenerated(framePath);
				QString log = QString("Frame %1 %2").arg(framePath).arg(frameCheckFailure ? "missing" : "found");
				logMessage(log);
			}

			if( frameCheckFailure ) {
				jobErrored("AE: Got frame complete message, but frame doesn't exist or is zero bytes");
				return;
			}

			logMessage("AE: Completed frame: " + QString::number(mFrame));
			taskDone( mFrame );
			mFrame++;
			if( !com && mFrame <= mFrameEnd )
				taskStart( mFrame );
		}
	}

	if( com ) {
		if( mJob.outputPath().endsWith( ".avi" ) || mJob.outputPath().endsWith( ".mov" ) )
			emit fileGenerated(mJob.outputPath());
		LOG_3("AEB::slotReadOutput emit'ing jobFinished()");
		jobFinished();
		return;
	}

	JobBurner::slotProcessOutputLine( line, channel );
}
Example #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    setupPlot();

    socket = new TCPSocket(this);
    connect(socket, SIGNAL(sendPosition(qreal,qreal,qreal,qreal,qreal)),
            ui->widget, SLOT(paintPosition(qreal,qreal,qreal,qreal,qreal)));

    connect(socket, SIGNAL(sendError(qreal,qreal,qreal,qreal)), this, SLOT(setError(qreal,qreal,qreal,qreal)));
    connect(socket, SIGNAL(sendSpeed(qreal,qreal,qreal,qreal)), this, SLOT(setSpeed(qreal,qreal,qreal,qreal)));
    connect(socket, SIGNAL(taskDone()), this, SLOT(enableButton()));

    time = 0;
}