コード例 #1
0
ファイル: warningsservice.cpp プロジェクト: Artiom-M/xpiks
    void WarningsService::startService() {
        m_WarningsWorker = new WarningsCheckingWorker(&m_WarningsSettingsModel);

        QThread *thread = new QThread();
        m_WarningsWorker->moveToThread(thread);

        QObject::connect(thread, SIGNAL(started()), m_WarningsWorker, SLOT(process()));
        QObject::connect(m_WarningsWorker, SIGNAL(stopped()), thread, SLOT(quit()));

        QObject::connect(m_WarningsWorker, SIGNAL(stopped()), m_WarningsWorker, SLOT(deleteLater()));
        QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));

        QObject::connect(m_WarningsWorker, SIGNAL(destroyed(QObject *)),
                         this, SLOT(workerDestoyed(QObject *)));

        QObject::connect(m_WarningsWorker, SIGNAL(stopped()),
                         this, SLOT(workerStopped()));

#ifdef INTEGRATION_TESTS
        QObject::connect(m_WarningsWorker, SIGNAL(queueIsEmpty()),
                         this, SIGNAL(queueIsEmpty()));
#endif

        LOG_INFO << "Starting worker";

        thread->start();
    }
コード例 #2
0
ファイル: NfcManager.cpp プロジェクト: jwoolcox/NfcTool
void NfcManager::startEventProcessing() {
	qDebug() << "XXXX starting event processing...";
	_future = new QFuture<void>;
	_watcher = new QFutureWatcher<void>;
	*_future = QtConcurrent::run(_workerInstance, &NfcWorker::startEventLoop);
	_watcher->setFuture(*_future);
	QObject::connect(_watcher, SIGNAL(finished()), this, SLOT(workerStopped()));
	QObject::connect(_workerInstance, SIGNAL(message(QVariant)), this, SLOT(message(QVariant)), Qt::QueuedConnection);
	QObject::connect(_workerInstance, SIGNAL(clearMessages()), this, SLOT(clearMessages()), Qt::QueuedConnection);
	qDebug() << "XXXX startEventProcessing - event loop started";
}
コード例 #3
0
ファイル: NfcManager.cpp プロジェクト: git4ric/testproject
void NfcManager::startEventProcessing() {
	qDebug() << "XXXX starting event processing...";
	_future = new QFuture<void>;
	_watcher = new QFutureWatcher<void>;
	_workerInstance = NfcWorker::getInstance();
	if(mode_type == READ){
		*_future = QtConcurrent::run(_workerInstance, &NfcWorker::startReadEventLoop);
	}
	if(mode_type == WRITE){
		*_future = QtConcurrent::run(_workerInstance, &NfcWorker::startWriteEventLoop);
	}
	_watcher->setFuture(*_future);
	QObject::connect(_watcher, SIGNAL(finished()), this, SLOT(workerStopped()));
	qDebug() << "XXXX startEventProcessing - event loop started";
}