void Thread::run() { qDebug()<<"run"; if (l_source_files.size()!=l_destination_files.size()) { exec(); emit processFinished(encrypt); return; } if (encrypt) { //encryptFile(v.toString().toLatin1().data(),dest_path.toLatin1().data(),text.toLatin1().data()); for (int i = 0; i< l_source_files.size(); i++) { emit setLabel("Encrypt: " + *l_source_files[i]); encryptFile(l_source_files[i]->toLatin1().data(), l_destination_files[i]->toLatin1().data(), password.toLatin1().data()); } } else { for (int i = 0; i<l_source_files.size(); i++) { emit setLabel("Decrypt: " + *l_source_files[i]); decryptFile(l_source_files[i]->toLatin1().data(), l_destination_files[i]->toLatin1().data(), password.toLatin1().data()); } } emit setLabel(""); emit processFinished(encrypt); exec(); }
QByteArray GraphvizImageHttpHandler::imageData(ParamsProvider *params, int timeoutMillis) { Q_UNUSED(params) QMutexLocker ml(&_mutex); if (_refreshStrategy == OnDemandWithCache && _renderingNeeded) { //Log::debug() << "imageData() with rendering needed"; qint64 deadline = QDateTime::currentMSecsSinceEpoch()+timeoutMillis; ml.unlock(); if (QThread::currentThread() == thread()) startRendering(); else QCoreApplication::postEvent(this, new QEvent(UPDATE_EVENT)); while (QDateTime::currentMSecsSinceEpoch() <= deadline && _renderingNeeded) { if (QThread::currentThread() == thread()) { if (_process->waitForFinished( deadline - QDateTime::currentMSecsSinceEpoch())) { processFinished(_process->exitCode(), _process->exitStatus()); break; // avoid testing _renderingNeeded: in case a new modification // has been done meanwhile we don't want to wait again for a rendering } } else usleep(qMin(50000LL, deadline - QDateTime::currentMSecsSinceEpoch())); } ml.relock(); } return _imageData; }
medFilteringWorkspace::medFilteringWorkspace(QWidget *parent): medAbstractWorkspace (parent), d(new medFilteringWorkspacePrivate) { d->filteringToolBox = new medFilteringSelectorToolBox(parent); connect(d->filteringToolBox,SIGNAL(processFinished()),this,SLOT(onProcessSuccess())); connect(d->filteringToolBox, SIGNAL(destroyed()), this, SLOT(removeInternSelectorToolBox())); this->addToolBox(d->filteringToolBox); }
void GameProcess::finished(int exitCode, QProcess::ExitStatus ) { process = NULL; ui->textBrowser->append("Process exited with exit code " + QString::number(exitCode)); emit processFinished(this, exitCode); }
void ProcessThread::run() { while(isRunning && counter != 0) { mutex.lock(); image = images[pointer2 % 30].copy(); mutex.unlock(); if(image.isNull()) continue; pointer2++; if(pointer2 == 30000) pointer2 = 0; int width, height; width = image.width(); height = image.height(); double momentb10 = 0, momentb01 = 0, momentb00 = 0; double momenty10 = 0, momenty01 = 0, momenty00 = 0; for(int x = 0 ; x < width;x++) { for(int y = 0 ; y < height;y++) { bleh.setRgb(image.pixel(x,y)); int hue = bleh.hsvHue(); int sat = bleh.hsvSaturation(); int value = bleh.value(); if(hue <= 267 && hue >= 167 && sat >= 150 && value >= 150) //Yellow: between 72 and 53 Blue: between 267 and 167 { momentb10 += 255 * x; momentb01 += 255 * y; momentb00 += 255; } else if(hue <= 102 && hue >= 10 && sat >= 150 && value >= 150) { momenty10 += 255 * x; momenty01 += 255 * y; momenty00 += 255; } } } if(momentb00 > 255*10) { oldbX = momentb10/momentb00;//((moment10/moment00)/width)*320; oldbY = momentb01/momentb00;//((moment01/moment00)/height)*240; } if(momenty00 > 255*10) { oldyX = momenty10/momenty00; oldyY = momenty01/momenty00; } mutex.lock(); counter--; mutex.unlock(); emit processFinished(oldbX, oldbY, oldyX, oldyY); } isRunning = false; // if(stopRequested) // return; }
void GraphvizImageHttpHandler::processError(QProcess::ProcessError error) { readyReadStandardError(); readyReadStandardOutput(); Log::warning() << "graphviz rendering process crashed with " "QProcess::ProcessError code " << error << " (" << _process->errorString() << ") and stderr content: " << _stderr; _process->kill(); processFinished(-1, QProcess::CrashExit); }
void ProcessHandler::onProcessEnd(int exitCode,QProcess::ExitStatus stat) { int returnCode = 0; if (stat == QProcess::CrashExit) { returnCode = 2; } else if(exitCode == 1) { returnCode = 1; } emit processFinished(returnCode); }
int QCrawlerFocusFilter::process(QCrawlerRecord &rec) { QString url = rec.crawl_url().url(); QCrawlerUrl::Status url_status; if (! contentFilter(rec)) { url_status = QCrawlerUrl::NOT_NEED_CRAWL; crawler_db->updateUrlStatus(url, url_status); emit processFinished(false, rec); return 1; } urlFilter(rec); insertFocusedUrls(rec); emit processFinished(true, rec); return 0; }
std::string ProcessCallbackI::block(long ms) { if (poll) { try { RIntPtr rc = process->poll(); if (rc) { processFinished(rc->getValue()); } } catch (const Ice::Exception& ex) { cerr << "Error calling poll: " << ex << endl; } } event.wait(Time::milliSeconds(ms)); return result; // Possibly empty };
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void D3DProcessor::run() { PreviewTableModel* model = PreviewTableModel::Instance(); // Now run the chosen pipeline on each image file in the table for (int i = 0; i < model->rowCount(); i++) { QModelIndex index = model->index(i, PreviewTableModel::RawImagePath); QString imagePath = model->data(index, Qt::DisplayRole).toString(); QFileInfo imageFi(imagePath); if (imagePath.isEmpty() == true) { QString s = tr("The image file path at row %1 is empty.").arg(QString::number(i + 1)); QMessageBox::warning(NULL, "MDCTool Warning", s, QMessageBox::Ok); continue; } else if (imageFi.exists() == false) { QString s = tr("The image file path at row %1 does not exist.").arg(QString::number(i + 1)); QMessageBox::warning(NULL, "MDCTool Warning", s, QMessageBox::Ok); continue; } model->setPipelineState(index.row(), PreviewTableItem::InProgress); emit processGeneratedMessage("Executing pipeline on \"" + imageFi.baseName() + "\""); // Run the pipeline delay(3); model->setPipelineState(index.row(), PreviewTableItem::DoneNoError); double value = (static_cast<double>(i + 1) / static_cast<double>(model->rowCount())) * 100; emit processGeneratedProgressValue(value); if (m_Stop == true) { break; } } if (m_Stop == true) { emit processGeneratedMessage("The process has been stopped."); } else { emit processGeneratedMessage("The process has finished."); } emit processFinished(); }
medFilteringWorkspace::medFilteringWorkspace ( QWidget *parent ) : medWorkspace ( parent ), d ( new medFilteringWorkspacePrivate ) { d->viewPropertiesToolBox = new medViewPropertiesToolBox ( parent ); this->addToolBox ( d->viewPropertiesToolBox ); d->filteringToolBox = new medFilteringSelectorToolBox ( parent ); connect(d->filteringToolBox, SIGNAL(addToolBox(medToolBox *)), this, SLOT(addToolBox(medToolBox *))); connect(d->filteringToolBox, SIGNAL(removeToolBox(medToolBox *)), this, SLOT(removeToolBox(medToolBox *))); connect(d->filteringToolBox,SIGNAL(processFinished()),this,SLOT(onProcessSuccess())); this->addToolBox( d->filteringToolBox ); }
void WareSrcContainer::processFinishedOutput(int ExitCode) { if (!ExitCode) { WareSrcMsgParser::WareSrcMsg Message = WareSrcMsgParser::WareSrcMsg( "\nCommand ended\n\n", WareSrcMsgParser::WareSrcMsg::MessageType::MSG_COMMAND); mp_Stream->write(Message); } else { WareSrcMsgParser::WareSrcMsg Message = WareSrcMsgParser::WareSrcMsg( "\nCommand ended with error\n\n", WareSrcMsgParser::WareSrcMsg::MessageType::MSG_ERROR); mp_Stream->write(Message); } emit processFinished(); }
MidiPlayerThread::MidiPlayerThread( MediaData *md, QObject *parent ) : QThread( parent ) , m_md( md ) { m_midiPtr = 0; m_totalTime = 0; m_configFile = WILDMIDI_CFG; m_inPause = false; m_isLoop = false; m_isStop = false; m_isFinished = false; m_sample_rate = rate; m_received_end_of_file = false; connect( this, SIGNAL( finished() ), SLOT( processFinished() ) ); }
void ProcessMonitor::addToTable(Process* process) { QTableWidget* table(m_ui.processTable); int row(table->rowCount()); table->setRowCount(row+1); int ncol(table->columnCount()); for (int i = 0; i < ncol; ++i) { table->setItem(row, i, new QTableWidgetItem()); } table->item(row, 2)->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); table->item(row, 3)->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); s_processMap.insert(process, table->item(row,0)); connect(process, SIGNAL(updated()), this, SLOT(processUpdated())); connect(process, SIGNAL(finished()), this, SLOT(processFinished())); updateRow(row, process->monitorItems()); }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: noteOn((*reinterpret_cast< const int(*)>(_a[1]))); break; case 1: noteOff((*reinterpret_cast< const int(*)>(_a[1]))); break; case 2: pauseActive((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: setChannelChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: setVelocityChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 5: setBase_octaveChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 6: setTransposeChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 7: setEditEnable((*reinterpret_cast< bool(*)>(_a[1]))); break; case 8: editChord((*reinterpret_cast< QPoint(*)>(_a[1]))); break; case 9: on_actionOpenMidi_triggered(); break; case 10: on_actionOpen_triggered(); break; case 11: on_actionPlayMidi_triggered(); break; case 12: on_btn_9_clicked(); break; case 13: on_btn_8_clicked(); break; case 14: on_btn_7_clicked(); break; case 15: on_btn_6_clicked(); break; case 16: on_btn_5_clicked(); break; case 17: on_btn_4_clicked(); break; case 18: on_btn_3_clicked(); break; case 19: on_btn_2_clicked(); break; case 20: on_btn_1_clicked(); break; case 21: on_btn_0_clicked(); break; case 22: on_chordAnalyse_triggered(); break; case 23: on_redoAction_triggered(); break; case 24: on_undoAction_triggered(); break; case 25: on_actionSave_triggered(); break; case 26: on_actionMIDI_controller_triggered((*reinterpret_cast< bool(*)>(_a[1]))); break; case 27: saveStaff(); break; case 28: loadStaff((*reinterpret_cast< QString(*)>(_a[1]))); break; case 29: processFinished((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QProcess::ExitStatus(*)>(_a[2]))); break; default: ; } _id -= 30; } return _id; }
/*! * \reimp */ void QxtWebCgiService::pageRequestedEvent(QxtWebRequestEvent* event) { // Create the process object and initialize connections QProcess* process = new QProcess(this); qxt_d().requests[process] = QxtCgiRequestInfo(event); qxt_d().processes[event->content] = process; QxtCgiRequestInfo& requestInfo = qxt_d().requests[process]; QObject::connect(process, SIGNAL(readyRead()), &qxt_d(), SLOT(processReadyRead())); QObject::connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), &qxt_d(), SLOT(processFinished())); QObject::connect(process, SIGNAL(error(QProcess::ProcessError)), &qxt_d(), SLOT(processFinished())); requestInfo.timeout = new QTimer(process); qxt_d().timeoutMapper.setMapping(requestInfo.timeout, process); QObject::connect(requestInfo.timeout, SIGNAL(timeout()), &qxt_d().timeoutMapper, SLOT(map())); // Initialize the system environment QStringList s_env = process->systemEnvironment(); QMap<QString, QString> env; foreach(const QString& entry, s_env) { int pos = entry.indexOf('='); env[entry.left(pos)] = entry.mid(pos + 1); }
void TarsnapClient::run() { _process = new QProcess(); _process->setProcessChannelMode(QProcess::MergedChannels); _process->setProgram(_command); _process->setArguments(_arguments); LOG << tr("Executing [%1 %2]").arg(_process->program()).arg(_process->arguments().join(' ')) << DELIMITER; _process->start(); if(_process->waitForStarted(DEFAULT_TIMEOUT_MS)) { emit started(_uuid); } else { processError(); goto cleanup; } if(_requiresPassword) { QByteArray password( _password.toUtf8() + "\n" ); _process->write( password.data(), password.size() ); } if(_process->waitForFinished(-1)) { readProcessOutput(); processFinished(); } else { processError(); goto cleanup; } cleanup: delete _process; _process = 0; }
void DGLDebugeeQTProcess::handleProcessFinished(int code, QProcess::ExitStatus status) { m_PollTimer->stop(); if (status == QProcess::CrashExit) { // this is loader process that crashed! emit processCrashed(); } else { // check in IPC if loader was successful if (m_Loaded || m_SemLoader.try_wait()) { IPCMessage* ipcMessage = (IPCMessage*)m_MappedRegion.get_address(); if (ipcMessage) { static_assert(sizeof(char) == sizeof(ipcMessage->m_message[0]), "Wrong IPC message element size"); if (!ipcMessage->m_ok) { emit processError((char*)ipcMessage->m_message); } } } emit processFinished(code); } }
procMenu->addAction(autoLevelsAct); procMenu->addAction(whiteBalanceAct); procMenu->addSeparator(); procMenu->addAction(geometryAct); procMenu->addAction(filterAct); procMenu->addAction(convolutionAct); menuBar()->addMenu(procMenu); } bool EditorWindow::runProcessor(ImageProcessor &processor) { // TODO: show progress window after 0.5 seconds the processor started connect(&processor, SIGNAL(progressChanged(double)), progressDialog, SLOT(setProgress(double))); connect(progressDialog, SIGNAL(cancelRequested()), &processor, SLOT(terminate())); connect(&processor, SIGNAL(terminated()), progressDialog, SLOT(reject())); connect(&processor, SIGNAL(processFinished()), progressDialog, SLOT(accept())); processor.start(); if (progressDialog->exec() == QDialog::Accepted) { imageWidget->setImage(processor.getImage()); return true; } else return false; } void EditorWindow::doAutoContrast() { HistogramProcessor processor(imageWidget->getImage(), imageWidget->getRect(), this); processor.setType(HistogramProcessor::LUMA_LINEAR_STRETCH); runProcessor(processor); }