Example #1
0
    void UpdateService::startChecking() {
        const bool startWorker = m_SettingsModel->getCheckForUpdates();

        if (startWorker) {
            m_UpdatesCheckerWorker = new UpdatesCheckerWorker();
            QThread *thread = new QThread();
            m_UpdatesCheckerWorker->moveToThread(thread);

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

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

            QObject::connect(m_UpdatesCheckerWorker, SIGNAL(updateAvailable(QString)),
                             this, SIGNAL(updateAvailable(QString)));

            QObject::connect(m_UpdatesCheckerWorker, SIGNAL(stopped()),
                             this, SLOT(workerFinished()));

            thread->start();
        } else {
            LOG_INFO << "Update service disabled";
        }
    }
Example #2
0
    void SpellCheckerService::startChecking() {
        Q_ASSERT(!m_SpellCheckWorker->isRunning());
        qDebug() << "Starting spellchecker service...";

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

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

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

        QObject::connect(this, SIGNAL(cancelSpellChecking()),
                         m_SpellCheckWorker, SLOT(cancel()));

        QObject::connect(m_SpellCheckWorker, SIGNAL(queueIsEmpty()),
                         this, SIGNAL(spellCheckQueueIsEmpty()));

        QObject::connect(m_SpellCheckWorker, SIGNAL(stopped()),
                         this, SLOT(workerFinished()));

        thread->start();
        m_WorkerIsAlive = true;
    }
Example #3
0
    void AutoCompleteService::startService() {
        if (m_AutoCompleteWorker != NULL) {
            LOG_WARNING << "Attempt to start running worker";
            return;
        }

        m_AutoCompleteWorker = new AutoCompleteWorker();

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

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

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

        QObject::connect(this, SIGNAL(cancelAutoCompletion()),
                         m_AutoCompleteWorker, SLOT(cancel()));

        QObject::connect(m_AutoCompleteWorker, SIGNAL(stopped()),
                         this, SLOT(workerFinished()));

        QObject::connect(m_AutoCompleteWorker, SIGNAL(destroyed(QObject*)),
                         this, SLOT(workerDestroyed(QObject*)));

        LOG_DEBUG << "starting thread...";
        thread->start();

        emit serviceAvailable(m_RestartRequired);
    }
Example #4
0
void LogLoader::sendLogWorker()
{
    if(!isLogReset())
    {
        logWorker->readLog();
    }

    workerFinished();
}
Example #5
0
void Launcher::startProcess(int first,int num)
{
    runningProcs++;
    QSharedPointer<myProcess> t = QSharedPointer<myProcess>(new myProcess(first,num,workCmd,workArgs,procCount++));
    connect(t.data(),SIGNAL(finished()),this,SLOT(workerFinished()));
    connect(t.data(),SIGNAL(error()),this,SLOT(workerError()));
    t.data()->start();
    process.append(t);
}
Example #6
0
void DiskLocation::fetchItems(QDir::Filter dirFilter, bool recursive)
{
    DirListWorker *dlw  = new DirListWorker(m_info->absoluteFilePath(), dirFilter, recursive);
    connect(dlw,  SIGNAL(itemsAdded(DirItemInfoList)),
            this, SIGNAL(itemsAdded(DirItemInfoList)));
    connect(dlw,  SIGNAL(workerFinished()),
            this, SLOT(onItemsFetched()));
    workerThread()->addRequest(dlw);
}
Example #7
0
void ResultWidget::start(const GuiParams &params)
{
    if (m_functor || m_worker)
        return;
    m_params = params;
    m_ui->preview->setResults(&m_result);
    m_ui->btn_abort->setVisible(true);
    m_ui->progressBar->setVisible(true);
    m_ui->btn_save->setEnabled(false);
    m_functor = new QtProgressFunctor(this);
    m_worker = new AnalysisWorker(*m_functor, m_params, m_result, this);
    connect(m_functor, SIGNAL(stageChanged(int, const QString&)), this, SLOT(stageChanged(int, const QString&)));
    connect(m_functor, SIGNAL(stackSizeChanged(int)), m_ui->progressBar, SLOT(setMaximum(int)));
    connect(m_functor, SIGNAL(progress(int)), m_ui->progressBar, SLOT(setValue(int)));
    connect(m_ui->btn_abort, SIGNAL(clicked()), m_functor, SLOT(abort()));
    connect(m_worker, SIGNAL(finished()), this, SLOT(workerFinished()));
    connect(m_ui->preview, SIGNAL(detections(const QString&)), m_ui->lbl_detections, SLOT(setText(const QString&)));
    m_ui->bottomLayout->removeItem(m_ui->spcr);
    //m_worker->setPriority(QThread::LowPriority);
    connect(m_ui->preview, SIGNAL(initialized()), m_worker, SLOT(start()));
    m_ui->progressBar->setRange(0, 0);
    m_ui->preview->setParams(&params);
    m_ui->scrl_preview->autoZoom();
}