DSPEngine::DSPEngine(MessageQueue* reportQueue, QObject* parent) : QThread(parent), m_messageQueue(), m_reportQueue(reportQueue), m_state(StNotStarted), m_sampleSource(NULL), m_sampleSinks(), m_sampleRate(0), m_tunerFrequency(1e8), m_dcOffsetCorrection(false), m_iqImbalanceCorrection(false), m_iOffset(0), m_qOffset(0), m_iRange(1 << 16), m_qRange(1 << 16), m_imbalance(65536) { moveToThread(this); }
void ConcurrentRunnerHelper::run() { mutex.lock(); moveToThread(app.thread()); while(runCount > 0 || toProcess.size() > 0) { if(toProcess.size() > 0 && runCount < maxthreads) { finishmutex.lock(); FunctionWorker *worker = toProcess.first(); toProcess.removeFirst(); runCount++; worker->start(); finishmutex.unlock(); } else { cond.wait(&mutex); } } mutex.unlock(); QThread::msleep(100); app.quit(); }
GSelfOwnedThread::GSelfOwnedThread() : QThread( 0 ), d( new GSelfOwnedThreadPrivate() ) { start(); d->m_pMutex.lock(); forever { if( !d->m_bDummy ) { d->m_pWait.wait( &d->m_pMutex ); } else { d->m_pMutex.unlock(); break; } } Q_ASSERT( 0 != d->m_pDummy ); moveToThread( d->m_pDummy->thread() ); }
Simulator::Simulator(const SimulatorSettings& params) : simProcess(NULL), time(NULL), inSocket(NULL), outSocket(NULL), settings(params), updatePeriod(50), simTimeout(2000), autopilotConnectionStatus(false), simConnectionStatus(false), txTimer(NULL), simTimer(NULL), name("") { // move to thread moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread()); connect(this, SIGNAL(myStart()), this, SLOT(onStart()),Qt::QueuedConnection); emit myStart(); }
WriteThread::WriteThread() { deletePartiallyTransferredFiles = true; lastGoodPosition = 0; stopIt = false; isOpen.release(); moveToThread(this); setObjectName(QStringLiteral("write")); this->mkpathTransfer = mkpathTransfer; #ifdef ULTRACOPIER_PLUGIN_DEBUG stat = Idle; #endif numberOfBlock = ULTRACOPIER_PLUGIN_DEFAULT_PARALLEL_NUMBER_OF_BLOCK; buffer = false; putInPause = false; needRemoveTheFile = false; blockSize = ULTRACOPIER_PLUGIN_DEFAULT_BLOCK_SIZE*1024; start(); }
Scheduler::Scheduler() : QronConfigDocumentManager(0), _thread(new QThread()), _alerter(new Alerter), _authenticator(new InMemoryAuthenticator(this)), _usersDatabase(new InMemoryUsersDatabase(this)), _firstConfigurationLoad(true), _startdate(QDateTime::currentDateTime().toMSecsSinceEpoch()), _configdate(LLONG_MIN), _execCount(0), _runningTasksHwm(0), _queuedTasksHwm(0), _accessControlFilesWatcher(new QFileSystemWatcher(this)), _uniformRandomNumberGenerator(_randomDevice()) { _thread->setObjectName("SchedulerThread"); connect(this, &Scheduler::destroyed, _thread, &QThread::quit); connect(_thread, &QThread::finished, _thread, &QThread::deleteLater); _thread->start(); QTimer *timer = new QTimer(this); connect(timer, &QTimer::timeout, this, &Scheduler::periodicChecks); timer->start(PERIODIC_CHECKS_INTERVAL_MS); connect(_accessControlFilesWatcher, &QFileSystemWatcher::fileChanged, this, &Scheduler::reloadAccessControlConfig); moveToThread(_thread); }
void ZTPManager::commonInit(const QHostAddress& groupAddress) { #if QT_VERSION < QT_VERSION_CHECK(5,0,0) QThreadPool::globalInstance()->setMaxThreadCount(QThreadPool::globalInstance()->maxThreadCount()+1); #endif ztpThreadPool = new QThreadPool; ztpThreadPool->setMaxThreadCount(1); if(groupAddress.toIPv4Address()>0xe0000000 && groupAddress.toIPv4Address()<0xf0000000) { _Socketlistener.joinMulticastGroup(groupAddress); //_Socketlistener.setSocketOption(QAbstractSocket::MulticastTtlOption, 5); } connect(&_Socketlistener,SIGNAL(readyRead()),this,SLOT(onRead()),Qt::DirectConnection); MTU = 60000; _timeout = 3000; moveToThread(&ztpTask); connect(this,SIGNAL(registTask(const QByteArray &,const QString &,quint16)),this, SLOT(procPkg(const QByteArray &,const QString &,quint16)),Qt::QueuedConnection); }
HttpConnectionHandler::HttpConnectionHandler(QSettings* settings, HttpRequestHandler* requestHandler) : QThread() { Q_ASSERT(settings!=0); Q_ASSERT(requestHandler!=0); this->settings=settings; this->requestHandler=requestHandler; currentRequest=0; busy = false; // execute signals in my own thread moveToThread(this); socket.moveToThread(this); readTimer.moveToThread(this); connect(&socket, SIGNAL(readyRead()), SLOT(read())); connect(&socket, SIGNAL(disconnected()), SLOT(disconnected())); connect(&readTimer, SIGNAL(timeout()), SLOT(readTimeout())); readTimer.setSingleShot(true); qDebug("HttpConnectionHandler (%p): constructed", this); this->start(); }
/*------------------------------------------------------------------------------ | OMX_WatchDog::OMX_WatchDog +-----------------------------------------------------------------------------*/ OMX_Watchdog::OMX_Watchdog(QObject* parent) : QObject(parent) { moveToThread(&m_thread); // Note that the even timer must be in a separate thread as we MUST ensure // its own thread does not lock. m_timer.moveToThread(&m_thread); m_timer.setSingleShot(false); m_timer.setInterval(1000); m_thread.start(); connect(&m_timer, SIGNAL(timeout()), this, SLOT(testOmx())); #if 0 QFile f(IPC_FILE_ABS_PATH); f.remove(); #endif }
CoreAV::CoreAV(Tox *tox) : coreavThread{new QThread}, iterateTimer{new QTimer{this}}, threadSwitchLock{false} { coreavThread->setObjectName("qTox CoreAV"); moveToThread(coreavThread.get()); iterateTimer->setSingleShot(true); connect(iterateTimer.get(), &QTimer::timeout, this, &CoreAV::process); toxav = toxav_new(tox, nullptr); toxav_callback_call(toxav, CoreAV::callCallback, this); toxav_callback_call_state(toxav, CoreAV::stateCallback, this); toxav_callback_bit_rate_status(toxav, CoreAV::bitrateCallback, this); toxav_callback_audio_receive_frame(toxav, CoreAV::audioFrameCallback, this); toxav_callback_video_receive_frame(toxav, CoreAV::videoFrameCallback, this); coreavThread->start(); }
QtNetworkReplyThreadSafeProxy::QtNetworkReplyThreadSafeProxy(QNetworkAccessManager *manager) : m_manager(manager) , m_reply(0) , m_forwardingDefered(false) , m_contentLengthHeader(0) , m_error(QNetworkReply::NoError) , m_httpStatusCode(0) { moveToThread(manager->thread()); // This might be unnecessarily heavy to do for each request while we could have the same wrapper for the manager instead connect(this, SIGNAL(localGetRequested(const QNetworkRequest&)), SLOT(localGet(const QNetworkRequest&))); connect(this, SIGNAL(localPostRequested(const QNetworkRequest&, QIODevice*)), SLOT(localPost(const QNetworkRequest&, QIODevice*))); connect(this, SIGNAL(localHeadRequested(const QNetworkRequest&)), SLOT(localHead(const QNetworkRequest&))); connect(this, SIGNAL(localPutRequested(const QNetworkRequest&, QIODevice*)), SLOT(localPut(const QNetworkRequest&, QIODevice*))); connect(this, SIGNAL(localDeleteResourceRequested(const QNetworkRequest&)), SLOT(localDeleteResource(const QNetworkRequest&))); connect(this, SIGNAL(localCustomRequestRequested(const QNetworkRequest&, const QByteArray&)), SLOT(localCustomRequest(const QNetworkRequest&, const QByteArray&))); connect(this, SIGNAL(localAbortRequested()), SLOT(localAbort())); connect(this, SIGNAL(localSetForwardingDeferedRequested(bool)), SLOT(localSetForwardingDefered(bool))); }
Exchange_BTCChina::Exchange_BTCChina(QByteArray pRestSign, QByteArray pRestKey) : Exchange() { exchangeDisplayOnlyCurrentPairOpenOrders=true; buySellAmountExcludedFee=true; clearHistoryOnCurrencyChanged=false; isLastTradesTypeSupported=true; balanceDisplayAvailableAmount=false; minimumRequestIntervalAllowed=600; calculatingFeeMode=1; baseValues.exchangeName="BTC China"; depthAsks=0; depthBids=0; forceDepthLoad=false; julyHttpAuth=0; julyHttpPublic=0; tickerOnly=false; setApiKeySecret(pRestKey,pRestSign); currencyMapFile="BTCChina"; baseValues.currentPair.name="BTC/CNY"; baseValues.currentPair.setSymbol("BTCCNY"); baseValues.currentPair.currRequestPair="BTCCNY"; baseValues.currentPair.priceDecimals=2; baseValues.currentPair.priceMin=qPow(0.1,baseValues.currentPair.priceDecimals); baseValues.currentPair.tradeVolumeMin=0.001; baseValues.currentPair.tradePriceMin=0.1; defaultCurrencyParams.currADecimals=8; defaultCurrencyParams.currBDecimals=8; defaultCurrencyParams.currABalanceDecimals=8; defaultCurrencyParams.currBBalanceDecimals=5; defaultCurrencyParams.priceDecimals=2; defaultCurrencyParams.priceMin=qPow(0.1,baseValues.currentPair.priceDecimals); supportsLoginIndicator=true; supportsAccountVolume=false; moveToThread(this); authRequestTime.restart(); }
qint32 connect_bySignature(QMetaObject::Connection* _retVal, quintptr sender, const char* encodedSignal, quintptr receiver, const char* encodedMethod) { if (!bridge) return LQ::EngineNotRunningError; if (!sender || !receiver) return LQ::NullPointerUseError; if ( !QMetaObject::checkConnectArgs(encodedSignal, encodedMethod) ) return LQ::IncompatibleArgumentsError; Q_ASSERT( strlen(encodedMethod) > 0 ); QObject* finalTarget = reinterpret_cast<QObject*>(receiver); QByteArray finalEncodedMethod(encodedMethod); if ( isSignal(encodedMethod) ) { int signalIndex = finalTarget->metaObject()->indexOfSignal( encodedMethod+1 ); // The encoding simply prepends the signature with a 1-char code if (signalIndex < 0) return LQ::InvalidSignalError; // ASSUMPTION: All native C++ signals are recorded in the QObject's static meta object, // but all LabVIEW-defined signals are not. if ( signalIndex >= finalTarget->staticMetaObject.methodCount() ) { // LabVIEW-defined signals don't have function bodies generated by the meta-object compiler. // Thus, we use LQSignalRelay to activate those signals manually. // LabVIEW could call this function from any thread. We must run things in the correct thread. auto middleMan = new LQSignalRelay; middleMan->moveToThread(finalTarget->thread()); QMetaObject::invokeMethod(middleMan, "finalize", Qt::BlockingQueuedConnection, Q_ARG(QObject*, finalTarget), Q_ARG(int, signalIndex)); // TODO: Merge finalize() into the constructor, and invoke it in the finalTarget's context? // ASSUMPTION: The registration process already validated the signal args. No need to check again. finalEncodedMethod = "1activate" + QByteArray( strchr(encodedMethod, '(') ); finalTarget = middleMan; } }
/** \brief Start accepting kinect data and serving / storing them Returns a bitmask: 0: OK 1: File creation error 2: Server creation error **/ int KWriter::start(QString fname,quint16 port,unsigned numuser,QKinect::QKinectWrapper *k,KeyPressEater *ke) { KWriter::fname=fname; KWriter::port=port; KWriter::numuser=numuser; kinect=k; KWriter::ke = ke; label=0; // Start a file stream if requested (file specified) if(!fname.isEmpty()) { file.setFileName(fname); if(!file.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text)) return 1; stream.setDevice(&file); stream.setRealNumberNotation(QTextStream::FixedNotation); stream.setRealNumberPrecision(12); } // Start a streaming server if requested (port specified) if(port) { if(!streamSrv.start(port)) return 2; } // Connect the kinect data notification to this object connect(kinect,SIGNAL(dataNotification()),this,SLOT(dataNotification())); // Connect the key generator to this object connect(ke,SIGNAL(Key(int)),this,SLOT(key(int))); moveToThread(&thread); thread.start(); return 0; }
Sniffer::Sniffer(uint32 pid, QString processName, Core *core) { //Set up some variables _core = core; _pid = pid; isDead = false; _processName = processName; //Move to thread _thread = new QThread(); moveToThread(_thread); //Setup the connection to manage this thread connect(_thread, SIGNAL(started()), this, SLOT(start())); connect(this, SIGNAL(finished()), _thread, SLOT(quit())); connect(this, SIGNAL(finished()), this, SLOT(deleteLater())); connect(_thread, SIGNAL(finished()), _thread, SLOT(deleteLater())); //Start the thread and let the this->start() handle the real initial work _thread->start(); }
void Master::init() { moveToThread(QCoreApplication::instance()->thread()); settings = new QSettings("muntemu.org", "Munt mt32emu-qt"); synthProfileName = settings->value("Master/defaultSynthProfile", "default").toString(); trayIcon = NULL; defaultAudioDriverId = settings->value("Master/DefaultAudioDriver").toString(); defaultAudioDeviceName = settings->value("Master/DefaultAudioDevice").toString(); initAudioDrivers(); initMidiDrivers(); lastAudioDeviceScan = -4 * MasterClock::NANOS_PER_SECOND; getAudioDevices(); pinnedSynthRoute = NULL; qRegisterMetaType<MidiDriver *>("MidiDriver*"); qRegisterMetaType<MidiSession *>("MidiSession*"); qRegisterMetaType<MidiSession **>("MidiSession**"); qRegisterMetaType<SynthState>("SynthState"); }
SpectrumAnalyserThread::SpectrumAnalyserThread(QObject *parent) : QObject(parent) #ifndef DISABLE_FFT , m_fft(new FFTRealWrapper) #endif , m_numSamples(SpectrumLengthSamples) , m_windowFunction(DefaultWindowFunction) , m_window(SpectrumLengthSamples, 0.0) , m_input(SpectrumLengthSamples, 0.0) , m_output(SpectrumLengthSamples, 0.0) , m_spectrum(SpectrumLengthSamples) #ifdef SPECTRUM_ANALYSER_SEPARATE_THREAD , m_thread(new QThread(this)) #endif { #ifdef SPECTRUM_ANALYSER_SEPARATE_THREAD moveToThread(m_thread); m_thread->start(); #endif calculateWindow(); }
void TcpServer::incomingConnection(qintptr socketDescriptor) //多线程必须在此函数里捕获新连接. { if (tcpClient->size() > maxPendingConnections())//继承重写此函数后,QTcpServer默认的判断最大连接数失效,自己实现 { QTcpSocket tcp; tcp.setSocketDescriptor(socketDescriptor); tcp.disconnectFromHost(); return; } auto th = ThreadHandle::getClass().getThread(); auto tcpTemp = new TcpSocket(socketDescriptor); QString ip = tcpTemp->peerAddress().toString(); qint16 port = tcpTemp->peerPort(); connect(tcpTemp,&TcpSocket::sockDisConnect,this,&TcpServer::sockDisConnectSlot);//NOTE:断开连接的处理,从列表移除,并释放断开的Tcpsocket,此槽必须实现,线程管理计数也是考的他 connect(this,&TcpServer::sentDisConnect,tcpTemp,&TcpSocket::disConTcp);//断开信号 tcpTemp->moveToThread(th);//把tcp类移动到新的线程,从线程管理类中获取 tcpClient->insert(socketDescriptor,tcpTemp);//插入到连接信息中 emit connectClient(socketDescriptor,ip,port); }
FileAnalyzer::FileAnalyzer(const QStringList &inputFiles) : m_tasksCounterNext(0), m_tasksCounterDone(0), m_inputFiles(inputFiles), m_templateFile(NULL), m_pool(NULL) { m_bSuccess = false; m_bAborted = false; m_filesAccepted = 0; m_filesRejected = 0; m_filesDenied = 0; m_filesDummyCDDA = 0; m_filesCueSheet = 0; moveToThread(this); /*makes sure queued slots are executed in the proper thread context*/ m_timer = new QElapsedTimer; }
QOggSimplePlayer::QOggSimplePlayer(const QString &filePath, QThread *audioThread) { if(audioThread!=NULL) moveToThread(audioThread); needPlay=false; volume=0; output=NULL; loop=false; buffer.open(QIODevice::ReadWrite|QIODevice::Unbuffered); this->filePath=filePath; connect(&buffer,&QOggAudioBuffer::readDone,this,&QOggSimplePlayer::readDone,Qt::QueuedConnection); connect(this,&QOggSimplePlayer::internalOpen,this,&QOggSimplePlayer::open,Qt::QueuedConnection); connect(this,&QOggSimplePlayer::emitInternalStart,this,&QOggSimplePlayer::internalStart,Qt::QueuedConnection); connect(this,&QOggSimplePlayer::emitInternalStop,this,&QOggSimplePlayer::internalStop,Qt::QueuedConnection); if(audioThread!=NULL) connect(this,&QOggSimplePlayer::internalClose,this,&QOggSimplePlayer::close,Qt::BlockingQueuedConnection); else connect(this,&QOggSimplePlayer::internalClose,this,&QOggSimplePlayer::close,Qt::DirectConnection); emit internalOpen(); }
ContentWindowManager::ContentWindowManager(boost::shared_ptr<Content> content) { // ContentWindowManagers must always belong to the main thread! moveToThread(QApplication::instance()->thread()); // content dimensions content->getDimensions(contentWidth_, contentHeight_); // default position / size, assumes a 16/9 aspect ratio // the actual aspect ratio will be set after the content is loaded //x_ = y_ = 0.01; //h_ = 0.3; //w_ = (double)g_configuration->getTotalHeight() / (double)g_configuration->getTotalWidth() * 16./9. * h_; double th = (double)g_configuration->getTotalHeight(); double tw = (double)g_configuration->getTotalWidth(); if (tw > th) { w_ = 1.0; h_ = tw/th; } else { h_ = 1.0; w_ = th/tw; } // default to centered centerX_ = 0.5; centerY_ = 0.5; // default to no zoom zoom_ = 1.; // default window state windowState_ = UNSELECTED; // set content object content_ = content; // receive updates to content dimensions connect(content.get(), SIGNAL(dimensionsChanged(int, int)), this, SLOT(setContentDimensions(int, int))); }
Network::Network(MainWindow *parent) : QObject(0) { // Initialization mw = parent; this->dm = mw->dm; server = 0; // Connections connect(this, &Network::postToLogArea, mw->getLogArea(), &QPlainTextEdit::appendPlainText); // SSL Configuration sslConfig.setProtocol(QSsl::TlsV1_2); // Disable remote certificate request sslConfig.setPeerVerifyMode(QSslSocket::VerifyNone); // TODO: Replace these temporary certificates with files QByteArray certificateText("-----BEGIN CERTIFICATE-----\nMIIGzTCCBLWgAwIBAgIJAL7oZ7T5jFYeMA0GCSqGSIb3DQEBBQUAMIGfMQswCQYD\nVQQGEwJVUzERMA8GA1UECBMIQ29sb3JhZG8xEDAOBgNVBAcTB0JvdWxkZXIxHTAb\nBgNVB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bjIUK6wS2Mb\ntxRLPC/VM97hcUx6Qxi51GuGjSZZpq1DwKg0b/avgnfoBmy8dznsefczwBsqVYjN\n755QBb0PnEV512Lq6rTkIGM=\n-----END CERTIFICATE-----\n"); QSslCertificate certificate(certificateText); if (certificate.isNull()) log(tr("Certificate invalid")); else sslConfig.setLocalCertificate(certificate); QByteArray keyText("-----BEGIN RSA PRIVATE KEY-----\nMIIJKQIBAAKCAgEAwPb0v0qrLC+suBHZLcuyijnv4guiKlvvbPMabC+u6vD5X3C6\nb024YdMImz2uw2JhxAUKN/cpBhuIWdwpiSr+qS2jCZOV9O7wO+U/+FQoZOLk/g+l\nrhOt+tsWBu1GU81cE3Nv/vmBpeg/qKFfNZ8WEmxlAXbCYY/p3EvZiYYnhhrzpUYT\nzdPqGorAWwcWAphU9vvYWkO9MgobGkwvTdHPTUQQUfBwENpjBgublPUB8XQQhm4v\n8Xcn5ZvIbeJ9Frtgf0p7FSEj4t6R8UXqulpFmaqKBPcTcgYKjrrSxPOvYZAxWOe6\nZzOGhavgZSs9S3OO6D1l80zVwL54A51KZPDdvjnhUyTwyU7NUlw6u6OSSyloRh+v\n8MTG/HXHlsaRXT5pvI53CoEMgnIqMkcfbMZNlh6H518R+qAVGkcoMcqWZXazssRg\n+sNqfJwXKzaHcAAYzu00P2Bjn8OdZ9DAP7W7ktci5JQ1lL++X4XJyPnEBjE0se6q\nLj6N5oWmGKUEfHZyANURdqGo+WVGbWQi9HU7j4CPycDOOKoEqmoIlQf+OWM33HVS\nHxEgeCqi9bo/v0eMDnXKq/kN3LsbENzF2VaI2IHp++GwohgZ65wThFjea5lvsPZQ\nHEa6ZvS9hDpMPE3WhnrNODABJGM5m10goTYt4pDrFO3nsZeMPMCgjMRHWhsCAwEA\nAQKCAgA++VluhGPQi86GU+zYsT2XNsk+sCVARbihicT5waYILpRzvUpawLaH1mNc\npoi+YwEdA7gOA69zutCI4vz7MvjhJW+r1GqAAOqN4Yc699wm8JVjBKBBa1LAJ3fM\n0u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JLgjw+n96kYXBOZw5cqtEyvjd+ThNM\n2JiqPij0w7qmGnnKKTnNxDtwV73X50dPisBYjgYMjGeopy3mj+31+nL6iGBrg2Fy\nH3dfyFjiXls/dr7cFyGaCyTjyHTX7gys1kB/XT9srzjiIC+2xMWgQ481qMueisZa\nY60gvZeZLW2zgOOR1VNhc3QUNE8Wtyxy/9Mqa8PxGSaDY+b8dj3QLMQa/7gz\n-----END RSA PRIVATE KEY-----\n"); QSslKey key(keyText, QSsl::Rsa); if (key.isNull()) log(tr("Private key invalid")); else sslConfig.setPrivateKey(key); // TODO: Tailor a list of acceptable ciphers and ECs #if (QT_VERSION < QT_VERSION_CHECK(5, 5, 0)) sslConfig.setCiphers(QSslSocket::supportedCiphers()); #else sslConfig.setCiphers(QSslConfiguration::supportedCiphers()); sslConfig.setEllipticCurves(QSslConfiguration::supportedEllipticCurves()); #endif // Threading #ifdef NETWORK_THREAD QThread *t = new QThread(daemon); moveToThread(t); connect(t, &QThread::started, this, &Network::init); connect(this, &Network::destroyed, t, &QThread::quit); connect(t, &QThread::finished, t, &QThread::deleteLater); t->start(); #else init(); #endif }
void QDnsLookupThreadPool::start(QRunnable *runnable) { // Ensure threads complete at application destruction. if (!signalsConnected) { QMutexLocker signalsLocker(&signalsMutex); if (!signalsConnected) { QCoreApplication *app = QCoreApplication::instance(); if (!app) { qWarning("QDnsLookup requires a QCoreApplication"); delete runnable; return; } moveToThread(app->thread()); connect(app, SIGNAL(destroyed()), SLOT(_q_applicationDestroyed()), Qt::DirectConnection); signalsConnected = true; } } QThreadPool::start(runnable); }
FQTermUniteSession::FQTermUniteSession(int socketDescriptor ) : context_(NULL) { moveToThread(this); socket_ = new QTcpSocket; FQ_VERIFY(connect(socket_, SIGNAL(readyRead()), this, SLOT(readyRead()),Qt::DirectConnection)); FQ_VERIFY(connect(socket_, SIGNAL(disconnected()), this, SLOT(disconnected()),Qt::DirectConnection)); FQ_VERIFY(connect(socket_, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(stateChanged(QAbstractSocket::SocketState)),Qt::DirectConnection)); FQ_VERIFY(connect(socket_, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError)),Qt::DirectConnection)); // FQ_VERIFY(connect(socket_, SIGNAL(connected()), // this, SLOT(welcome()),Qt::DirectConnection)); socket_->setSocketDescriptor(socketDescriptor); socket_->moveToThread(this); setTerminationEnabled(); StateBuilder sb; sb.BuildState(); }
PreviewThread::PreviewThread(uint timeInterval, uint maxWidth, uint maxHeight) // ---------------------------------------------------------------------------- // Start preview-save thread by saving // ---------------------------------------------------------------------------- : mutex(), path(), image(), nextSave(), timeInterval(timeInterval), maxWidth(maxWidth), maxHeight(maxHeight) { IFTRACE(preview) debug() << "Starting preview thread (" << timeInterval << " ms)\n"; // Ready the thread to receive events moveToThread(this); connect(this, SIGNAL(imageAvailable()), this, SLOT(savePreview())); // Configure the timer nextSave.setSingleShot(true); nextSave.setInterval(timeInterval); connect(&nextSave, SIGNAL(timeout()), this, SLOT(savePreview())); start(); // Wait until a preview is posted to save }
JohnHandler::JohnHandler() : m_env(QProcessEnvironment::systemEnvironment()) { qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError"); qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus"); qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState"); moveToThread(&m_thread); m_thread.start(); connect(&m_john, SIGNAL(started()), this, SIGNAL(started()), Qt::QueuedConnection); connect(&m_john, SIGNAL(finished(int, QProcess::ExitStatus)), this, SIGNAL(finished(int, QProcess::ExitStatus)), Qt::QueuedConnection); connect(&m_john, SIGNAL(error(QProcess::ProcessError)), this, SIGNAL(error(QProcess::ProcessError)), Qt::QueuedConnection); connect(&m_john, SIGNAL(readyReadStandardError()), this, SIGNAL(readyReadStandardError()), Qt::QueuedConnection); connect(&m_john, SIGNAL(readyReadStandardOutput()), this, SIGNAL(readyReadStandardOutput()), Qt::QueuedConnection); connect(&m_john, SIGNAL(stateChanged(QProcess::ProcessState)), this, SIGNAL(stateChanged(QProcess::ProcessState)), Qt::QueuedConnection); }
LogThread::LogThread() { sync=false; //load the GUI option QString defaultLogFile=""; if(resources->getWritablePath()!="") defaultLogFile=resources->getWritablePath()+"ultracopier-files.log"; QList<QPair<QString, QVariant> > KeysList; KeysList.append(qMakePair(QString("enabled"),QVariant(false))); KeysList.append(qMakePair(QString("file"),QVariant(defaultLogFile))); KeysList.append(qMakePair(QString("transfer"),QVariant(true))); KeysList.append(qMakePair(QString("error"),QVariant(true))); KeysList.append(qMakePair(QString("folder"),QVariant(true))); KeysList.append(qMakePair(QString("sync"),QVariant(true))); KeysList.append(qMakePair(QString("transfer_format"),QVariant("[%time%] %source% (%size%) %destination%"))); KeysList.append(qMakePair(QString("error_format"),QVariant("[%time%] %path%, %error%"))); KeysList.append(qMakePair(QString("folder_format"),QVariant("[%time%] %operation% %path%"))); options->addOptionGroup("Write_log",KeysList); connect(options,SIGNAL(newOptionValue(QString,QString,QVariant)), this, SLOT(newOptionValue(QString,QString,QVariant))); enabled=false; moveToThread(this); start(QThread::IdlePriority); connect(this, SIGNAL(newData(QString)), this,SLOT(realDataWrite(QString)),Qt::QueuedConnection); newOptionValue("Write_log", "transfer", options->getOptionValue("Write_log","transfer")); newOptionValue("Write_log", "error", options->getOptionValue("Write_log","error")); newOptionValue("Write_log", "folder", options->getOptionValue("Write_log","folder")); newOptionValue("Write_log", "sync", options->getOptionValue("Write_log","sync")); newOptionValue("Write_log", "transfer_format", options->getOptionValue("Write_log","transfer_format")); newOptionValue("Write_log", "error_format", options->getOptionValue("Write_log","error_format")); newOptionValue("Write_log", "folder_format", options->getOptionValue("Write_log","folder_format")); newOptionValue("Write_log", "sync", options->getOptionValue("Write_log","sync")); newOptionValue("Write_log", "enabled", options->getOptionValue("Write_log","enabled")); }
void PluginStarter::run() { if (_plugin_url.scheme() == "rom") { QString file_name = _plugin_url.path().remove("/"); try { Genode::Rom_connection rc(file_name.toLatin1().constData()); Genode::Dataspace_capability rom_ds = rc.dataspace(); char const *rom_ds_addr = (char const *)Genode::env()->rm_session()->attach(rom_ds); QByteArray file_buf = QByteArray::fromRawData(rom_ds_addr, Genode::Dataspace_client(rom_ds).size()); _start_plugin(file_name, file_buf); Genode::env()->rm_session()->detach(rom_ds_addr); } catch (Genode::Rom_connection::Rom_connection_failed) { _plugin_loading_state = ROM_CONNECTION_FAILED_EXCEPTION; } emit finished(); } else if (_plugin_url.scheme() == "http") { _qnam = new QNetworkAccessManager(); _reply = _qnam->get(QNetworkRequest(_plugin_url)); connect(_reply, SIGNAL(finished()), this, SLOT(networkReplyFinished())); } exec(); delete _pc; moveToThread(QApplication::instance()->thread()); }
DirectShowIOReader::DirectShowIOReader( QIODevice *device, DirectShowIOSource *source, DirectShowEventLoop *loop) : m_source(source) , m_device(device) , m_loop(loop) , m_pendingHead(0) , m_pendingTail(0) , m_readyHead(0) , m_readyTail(0) , m_synchronousPosition(0) , m_synchronousLength(0) , m_synchronousBytesRead(0) , m_synchronousBuffer(0) , m_synchronousResult(S_OK) , m_totalLength(0) , m_availableLength(0) , m_flushing(false) { moveToThread(device->thread()); connect(device, SIGNAL(readyRead()), this, SLOT(readyRead())); }
pSocket::pSocket(QTcpSocket *socket, QThread *thread, QAtomicInt& limit) : QObject(0), _socket(socket), _packetSize(0), _limit(limit) { connect(_socket, SIGNAL(readyRead()), this, SLOT(onDataReceived())); connect(_socket, SIGNAL(disconnected()), this, SLOT(deleteLater())); // connect(_socket, SIGNAL(disconnected()), _socket, SLOT(deleteLater())); connect(this, SIGNAL(saveFile(QByteArray,QString)), pSaver::inst(), SLOT(save(QByteArray,QString))); _socket->setParent(this); moveToThread(thread); #ifdef FUNC_DEBUG qDebug() << '\n' << Q_FUNC_INFO << "New connection" << socket->localAddress(); #endif #ifdef TIME_DEBUG if (!dTime) { dTime = new QTime; dTime->start(); } #endif }