void ServerConfigurationDialog::on_loadButton_clicked(bool) { QString filePath(QDir::homePath()); filePath = QFileDialog::getOpenFileName(this, tr("Open Server Configuration"), filePath, tr("Configuration Files (*.cfg)")); if (filePath.isEmpty()) return; try { Parser::ParseFile parser(filePath); parser.start(); parser.wait(); QStringList errors(parser.errors()); if (!errors.isEmpty()) { QMsgBox::warning(this, "IQmol", errors.join("\n")); } Data::Bank& bank(parser.data()); QList<Data::YamlNode*> yaml(bank.findData<Data::YamlNode>()); if (yaml.first()) { yaml.first()->dump(); m_currentConfiguration = ServerConfiguration(*(yaml.first())); blockUpdate(true); copyFrom(m_currentConfiguration); blockUpdate(false); } } catch (YAML::Exception& err) { QString msg(QString::fromStdString(err.what())); QMsgBox::warning(this, "IQmol", msg); } }
ServerConfigurationDialog::ServerConfigurationDialog(ServerConfiguration& configuration, QWidget* parent) : QDialog(parent), m_tested(false), m_blockUpdate(false), m_originalConfiguration(configuration) { m_dialog.setupUi(this); init(); m_currentConfiguration = m_originalConfiguration; blockUpdate(true); copyFrom(m_originalConfiguration); blockUpdate(false); // Hide this temporarily as it causes the server to not appear in the list m_dialog.testConnectionButton->hide(); connect(m_dialog.buttonBox, SIGNAL(accepted()), this, SLOT(verify())); }
void ServerConfigurationDialog::on_queueSystem_currentIndexChanged(QString const& queue) { if (blockUpdate()) return; ServerConfiguration::QueueSystemT queueT(ServerConfiguration::toQueueSystemT(queue)); //if (m_currentConfiguration.queueSystem() == queueT) return; m_currentConfiguration.setDefaults(queueT); }
int daEnFlipBlock_c::onExecute() { acState.execute(); physics.update(); blockUpdate(); // now check zone bounds based on state if (acState.getCurrentState()->isEqual(&StateID_Wait)) { checkZoneBoundaries(0); } return true; }
void ServerConfigurationDialog::on_localRadioButton_toggled(bool tf) { if (!tf) return; m_dialog.remoteHostGroupBox->setEnabled(false); m_dialog.configureConnectionButton->setEnabled(false); updateAllowedQueueSystems(false); if (blockUpdate()) return; m_currentConfiguration.setDefaults(ServerConfiguration::Local); on_queueSystem_currentIndexChanged(m_dialog.queueSystem->currentText()); copyFrom(m_currentConfiguration); }
void ServerConfigurationDialog::on_httpsRadioButton_toggled(bool tf) { if (!tf) return; m_dialog.remoteHostGroupBox->setEnabled(true); m_dialog.configureConnectionButton->setEnabled(false); m_dialog.authentication->setEnabled(false); m_dialog.userName->setEnabled(false); m_dialog.workingDirectory->setEnabled(false); updateAllowedQueueSystems(true); if (blockUpdate()) return; m_currentConfiguration.setDefaults(ServerConfiguration::HTTPS); copyFrom(m_currentConfiguration); }
bool BackgroundInitializationModule::run() { if(m_data->currentImage == NULL || m_data->currentImage->isNull()) { AppendToLog("BackgroundInitializationModule: Warning: No current image. Aborting execution...\n"); return false; } uchar *ptr_finalBackground, *ptr_imgData = m_data->currentImage->bits(); int imgWidth = m_data->currentImage->width(), imgHeight = m_data->currentImage->height(); cv::Mat imgARGB32 = cv::Mat(imgHeight, imgWidth, CV_8UC4 ); if( imgWidth % sizeBlock != 0 || imgHeight % sizeBlock != 0) { AppendToLog("BackgroundInitializationModule: Warning: Size of block must divide the image width and height perfectly. Aborting execution...\n"); return false; } if(firstTime) { firstTime = false; if(m_data->bgImage == NULL) { m_data->bgImage= new QImage(m_data->currentImage->width(),m_data->currentImage->height(), QImage::Format_RGB888); //Set Background background = cv::Mat(m_data->bgImage->height(),m_data->bgImage->width(), CV_8UC3, cv::Scalar(UNDEFINED,UNDEFINED,UNDEFINED)); } numBlockUndef = ( m_data->currentImage->width()*m_data->currentImage->height() ) / ( sizeBlock*sizeBlock ); if(currRepresentation.empty()) currRepresentation = cv::Mat(m_data->currentImage->height()/sizeBlock, m_data->currentImage->width()/sizeBlock, CV_8UC1, cv::Scalar(UNDEFINED)); if(currentFrameC3.empty()) currentFrameC3 = cv::Mat(imgHeight, imgWidth, CV_8UC3 ); memcpy(imgARGB32.data, ptr_imgData, imgHeight*m_data->currentImage->bytesPerLine()); cv::cvtColor(imgARGB32, currentFrameC3, CV_RGBA2BGR); cv::cvtColor(currentFrameC3, currentFrameC1, CV_BGR2GRAY ); return true; } else { currentFrameC1.copyTo( previousFrameC1 ); currRepresentation.copyTo( prevRepresentation ); memcpy(imgARGB32.data, ptr_imgData, imgHeight*m_data->currentImage->bytesPerLine()); cv::cvtColor(imgARGB32, currentFrameC3, CV_RGBA2BGR); cv::cvtColor(currentFrameC3, currentFrameC1, CV_BGR2GRAY ); } blockMatching(imgWidth, imgHeight); blockClassification(imgWidth, imgHeight); blockUpdate(imgWidth, imgHeight); //copy initialization background to m_data ptr_finalBackground = m_data->bgImage->bits(); memcpy(ptr_finalBackground, this->background.data, this->background.rows*this->background.step); // AppendToLog("BackgroundInitializationModule: Bloques por inicializar:" + QString::number(this->numBlockUndef)); if(this->numBlockUndef == 0) { this->initializationStage = false; //the end of initialization process // AppendToLog("BackgroundInitializationModule: Process finished. \n"); } return true; }