/** * - The user clicks the dialogue's "OK" button : updates the global configuration based * on the values given in the preferences dialogue, and then closes the dialogue. * - The user clicks the dialogue's "Apply" : updates the global configuration based on * the values given in the preferences dialogue, leaving the dialogue open. * - The user clicks the "Default" button : resets all configuration parameters to their * default values. */ void PreferencesDlg::slotButtonClicked(int button) { switch (button){ case KDialog::Ok : case KDialog::Apply : if (updateConfig()) enableButtonApply(false); accept(); break; case KDialog::Default: // Prompt the user before applying default values if (KMessageBox::questionYesNo(0, i18n("This would reset all your " "configuration settings! Continue?")) == KMessageBox::Yes) { // Load the default values Config().loadDefault(); loadConfig(); // Apply the default values if (updateConfig()) enableButtonApply(false); } accept(); break; default: KDialog::slotButtonClicked(button); break; } }
int VEObj::prepareConfig() { int rc; if ((rc = updateConfig(VE_CONF_NAME, NULL))) return rc; if ((rc = updateConfig(VE_CONF_PRIV, getPrivateConf().c_str()))) return rc; if ((rc = updateConfig(VE_CONF_ROOT, getRootConf().c_str()))) return rc; return 0; }
/*! \brief \fn cdegs_main::refresh */ void cdegs_main::refresh(){ updateProject(); updateConfig(); updateTitle(); updateActions(); //updateTab(); }
void ConfigurationWindow::updateAndCloseConfig() { updateConfig(); accept(); close(); }
void ProjectDlg::deleteConfig() { project.removeConfig(config->currentText()); config->removeItem(config->currentItem()); project.setCurrentConfig(config->currentText()); updateConfig(); }
void ClangDiagnosticConfigsWidget::onClangTidyModeChanged(int index) { ClangDiagnosticConfig config = currentConfig(); config.setClangTidyMode(static_cast<ClangDiagnosticConfig::TidyMode>(index)); updateConfig(config); syncClangTidyWidgets(config); }
void ConfigureRecorder::setFormat( int index ) { updateConfig( qualities[quality].channels, qualities[quality].frequency, plugins->at( (uint)index )->pluginMimeType(), plugins->formatAt( (uint)index ) ); }
KDateEdit::KDateEdit(QWidget *parent, const char *name) : QFrame(parent, name) { QPixmap pixmap; kfEdit = new DateEdit(this); kfEdit->setDate(QDate::currentDate(), kfEdit->currentFormat()); updateConfig(); // adjusts the format of the display kfEdit->setFixedHeight(kfEdit->sizeHint().height()); kfEdit->setFixedWidth(90); kfEdit->adjustSize(); pixmap = Icon("smallcal.xpm"); dateButton = new QPushButton(this); dateButton->setPixmap(pixmap); dateButton->move(kfEdit->geometry().topRight().x()+1, kfEdit->geometry().topRight().y()); dateButton->setFixedHeight(20); dateButton->setFixedWidth(30); dateButton->adjustSize(); datePicker = new KODatePicker(parent, QDate::currentDate()); datePicker->setFixedSize(200,200); adjustSize(); connect(dateButton, SIGNAL(clicked()), this, SLOT(toggleDatePicker())); connect(datePicker, SIGNAL(dateSelected(QDate)), this, SLOT(setDate(QDate))); connect(datePicker, SIGNAL(dateSelected(QDate)), datePicker, SLOT(hide())); }
void CameraConfigModel::setChannelConfig(const QModelIndex &index, const Config &config) { ChannelItem *item = ChannelItem::cast(itemFromIndex(index)); if(!item) return; item->setConfig(config); updateConfig(); }
void KOViewManager::connectView(KOrg::BaseView *view) { if(!view) return; // selecting an incidence connect(view, SIGNAL(incidenceSelected(Incidence *)), mMainView, SLOT(processMainViewSelection(Incidence *))); // showing/editing/deleting an incidence. The calendar view takes care of the action. connect(view, SIGNAL(showIncidenceSignal(Incidence *)), mMainView, SLOT(showIncidence(Incidence *))); connect(view, SIGNAL(editIncidenceSignal(Incidence *)), mMainView, SLOT(editIncidence(Incidence *))); connect(view, SIGNAL(deleteIncidenceSignal(Incidence *)), mMainView, SLOT(deleteIncidence(Incidence *))); connect(view, SIGNAL(copyIncidenceSignal(Incidence *)), mMainView, SLOT(copyIncidence(Incidence *))); connect(view, SIGNAL(cutIncidenceSignal(Incidence *)), mMainView, SLOT(cutIncidence(Incidence *))); connect(view, SIGNAL(pasteIncidenceSignal()), mMainView, SLOT(pasteIncidence())); connect(view, SIGNAL(toggleAlarmSignal(Incidence *)), mMainView, SLOT(toggleAlarm(Incidence *))); connect(view, SIGNAL(dissociateOccurrenceSignal(Incidence *, const QDate &)), mMainView, SLOT(dissociateOccurrence(Incidence *, const QDate &))); connect(view, SIGNAL(dissociateFutureOccurrenceSignal(Incidence *, const QDate &)), mMainView, SLOT(dissociateFutureOccurrence(Incidence *, const QDate &))); // signals to create new incidences connect(view, SIGNAL(newEventSignal()), mMainView, SLOT(newEvent())); connect(view, SIGNAL(newEventSignal(const QDateTime &)), mMainView, SLOT(newEvent(const QDateTime &))); connect(view, SIGNAL(newEventSignal(const QDateTime &, const QDateTime &)), mMainView, SLOT(newEvent(const QDateTime &, const QDateTime &))); connect(view, SIGNAL(newEventSignal(const QDate &)), mMainView, SLOT(newEvent(const QDate &))); connect(view, SIGNAL(newTodoSignal(const QDate &)), mMainView, SLOT(newTodo(const QDate &))); connect(view, SIGNAL(newSubTodoSignal(Todo *)), mMainView, SLOT(newSubTodo(Todo *))); connect(view, SIGNAL(newJournalSignal(const QDate &)), mMainView, SLOT(newJournal(const QDate &))); // reload settings connect(mMainView, SIGNAL(configChanged()), view, SLOT(updateConfig())); // Notifications about added, changed and deleted incidences connect(mMainView, SIGNAL(dayPassed(const QDate &)), view, SLOT(dayPassed(const QDate &))); connect(view, SIGNAL(startMultiModify(const QString &)), mMainView, SLOT(startMultiModify(const QString &))); connect(view, SIGNAL(endMultiModify()), mMainView, SLOT(endMultiModify())); connect(mMainView, SIGNAL(newIncidenceChanger(IncidenceChangerBase *)), view, SLOT(setIncidenceChanger(IncidenceChangerBase *))); view->setIncidenceChanger(mMainView->incidenceChanger()); }
void ProjectDlg::addConfig() { QString str = QInputDialog::getText("CUTE", "Enter name for new configuration:"); config->insertItem(str); project.addConfig(str); project.setCurrentConfig(str); config->setCurrentText(str); updateConfig(); }
void KODialogManager::showOptionsDialog() { if(!mOptionsDialog) { #if 0 mOptionsDialog = new KConfigureDialog(); // mOptionsDialog = new KConfigureDialog( KConfigureDialog::Configurable ); // mOptionsDialog = new KConfigureDialog( mMainView ); connect(mOptionsDialog->dialog(), SIGNAL(configCommitted(const QCString &)), mMainView, SLOT(updateConfig())); #else mOptionsDialog = new KCMultiDialog(mMainView, "KorganizerPreferences"); connect(mOptionsDialog, SIGNAL(configCommitted(const QCString &)), mMainView, SLOT(updateConfig(const QCString &))); #if 0 connect(mOptionsDialog, SIGNAL(applyClicked()), mMainView, SLOT(updateConfig())); connect(mOptionsDialog, SIGNAL(okClicked()), mMainView, SLOT(updateConfig())); // @TODO Find a way to do this with KCMultiDialog connect(mCategoryEditDialog, SIGNAL(categoryConfigChanged()), mOptionsDialog, SLOT(updateCategories())); #endif QStringList modules; modules.append("korganizer_configmain.desktop"); modules.append("korganizer_configtime.desktop"); modules.append("korganizer_configviews.desktop"); modules.append("korganizer_configfonts.desktop"); modules.append("korganizer_configcolors.desktop"); modules.append("korganizer_configgroupscheduling.desktop"); modules.append("korganizer_configgroupautomation.desktop"); modules.append("korganizer_configfreebusy.desktop"); modules.append("korganizer_configplugins.desktop"); modules.append("korganizer_configdesignerfields.desktop"); // add them all QStringList::iterator mit; for(mit = modules.begin(); mit != modules.end(); ++mit) mOptionsDialog->addModule(*mit); #endif }
void CameraConfigModel::removeChannel(const int &i) { removeRow(i); updateConfig(); for(int j = i; j < rowCount(); ++j) { ChannelItem *item = ChannelItem::cast(CameraConfigModel::item(j)); if(!item) continue; item->setI(item->i() - 1); } }
void ClangDiagnosticConfigsWidget::onClangTidyItemChanged(QListWidgetItem *item) { const QString prefix = item->text(); ClangDiagnosticConfig config = currentConfig(); QString checks = config.clangTidyChecksPrefixes(); item->checkState() == Qt::Checked ? checks.append(',' + prefix) : checks.remove(',' + prefix); config.setClangTidyChecksPrefixes(checks); updateConfig(config); }
void ConfigureRecorder::setSampleRate( int index ) { int frequency; switch ( index ) { case 0: frequency = 8000; break; case 1: frequency = 11025; break; case 2: frequency = 22050; break; default: frequency = 44100; break; } updateConfig( qualities[quality].channels, frequency, qualities[quality].mimeType, qualities[quality].formatTag ); }
void KOEventPopupMenu::print( bool preview ) { #ifndef KORG_NOPRINTER KOCoreHelper helper; CalPrinter printer( this, mCalendar, &helper, true ); connect( this, SIGNAL(configChanged()), &printer, SLOT(updateConfig()) ); Incidence::List selectedIncidences; selectedIncidences.append( mCurrentIncidence ); printer.print( KOrg::CalPrinterBase::Incidence, mCurrentDate, mCurrentDate, selectedIncidences, preview ); #endif }
void CameraConfigModel::swapChannels(const int &i, const int &j) { if(i < 0 || j < 0 || i >= rowCount() || j >= rowCount()) return; int a = qMin(i, j); int b = qMax(i, j); QList<QStandardItem *> bItems = takeRow(b); QList<QStandardItem *> aItems = takeRow(a); insertRow(a, bItems); insertRow(b, aItems); ChannelItem *newA = ChannelItem::cast(bItems[0]); ChannelItem *newB = ChannelItem::cast(aItems[0]); newA->setI(a); newB->setI(b); updateConfig(); }
MainWindow::MainWindow(QMainWindow *parent) : QMainWindow(parent) { setupUi(this); connect(btnRadius,SIGNAL(clicked()), this, SLOT(setSelectionMode())); connect(btnKNearest,SIGNAL(clicked()), this, SLOT(setSelectionMode())); connect(spinKNearest,SIGNAL(editingFinished()), this, SLOT(setKNearest())); connect(spinRadius,SIGNAL(editingFinished()), this, SLOT(setRadius())); connect(spinPointSize,SIGNAL(editingFinished()), this, SLOT(setPointSize())); connect(spinKNearest,SIGNAL(valueChanged(int)), this, SLOT(setKNearest())); connect(spinVertexID,SIGNAL(valueChanged(int)), this, SLOT(setVertexId())); connect(spinRadius,SIGNAL(valueChanged(double)), this, SLOT(setRadius())); connect(spinPointSize,SIGNAL(valueChanged(double)), this, SLOT(setPointSize())); connect(btnRenderKDTree,SIGNAL(clicked()), this, SLOT(setDrawKDTree())); updateConfig(); }
bool calibrateMPU6500Acc(mpu6500_t *mpu6500) { bool rcode = calibrateSensor(&cfg.accZero, MPU6500_ACCEL_XOUT_H, 100); // 100 / 4096 ~= 0.02g cfg.accZero.axis.Z -= mpu6500->accScaleFactor; // Z-axis is reading +1g when horizontal, so we subtract 1g from the value found if (!rcode) { #if UART_DEBUG UARTprintf("Accelerometer zero values: %d\t%d\t%d\n", cfg.accZero.axis.X, cfg.accZero.axis.Y, cfg.accZero.axis.Z); #endif updateConfig(); // Write new values to EEPROM } #if UART_DEBUG else UARTprintf("Accelerometer calibration error\n"); #endif return rcode; // No error }
void VMdEditor::beginEdit() { updateConfig(); initInitImages(); setModified(false); setReadOnlyAndHighlightCurrentLine(false); emit statusChanged(); if (m_freshEdit) { m_mdHighlighter->updateHighlight(); relayout(); } else { updateHeaders(m_mdHighlighter->getHeaderRegions()); } }
void SettingDialog::initBottom() { ok_button = new QPushButton(); cancel_button = new QPushButton(); ok_button->setFixedSize(75, 25); cancel_button->setFixedSize(75, 25); ok_button->setObjectName("okButton"); cancel_button->setObjectName("okButton"); bottom_layout = new QHBoxLayout(); bottom_layout->addStretch(); bottom_layout->addWidget(ok_button); bottom_layout->addWidget(cancel_button); bottom_layout->setSpacing(20); bottom_layout->setContentsMargins(0, 10, 20, 20); connect(ok_button, SIGNAL(clicked()), this, SLOT(updateConfig())); connect(cancel_button, SIGNAL(clicked()), this, SLOT(hide())); }
void ClangDiagnosticConfigsWidget::onClazyRadioButtonChanged(bool checked) { if (!checked) return; QString checks; if (m_clazyChecks->clazyRadioDisabled->isChecked()) checks = QString(); else if (m_clazyChecks->clazyRadioLevel0->isChecked()) checks = "level0"; else if (m_clazyChecks->clazyRadioLevel1->isChecked()) checks = "level1"; else if (m_clazyChecks->clazyRadioLevel2->isChecked()) checks = "level2"; else if (m_clazyChecks->clazyRadioLevel3->isChecked()) checks = "level3"; ClangDiagnosticConfig config = currentConfig(); config.setClazyChecks(checks); updateConfig(config); }
void IpccImpl::do_sendConfigAck( const msg::ast::Config& configMsg) { std::cout << "IPCC[" << getLocalCCId() << "].sendConfigAck()" << std::endl; updateConfig(configMsg); // create and send ConfigAck { lmp::msg::ast::ConfigAck configAckMsg = { { isGoingDown(), isLMPRestart() }, { { false }, getLocalCCId() }, // localCCId { { false }, getLocalNodeId() }, // localNodeId { { false }, configMsg.m_localCCId.m_ccId }, // remoteCCId { { false }, configMsg.m_messageId.m_msgId }, // messageId { { false }, configMsg.m_localNodeId.m_nodeId } // remoteNodeId }; lmp::msg::ast::Message sendMessage = configAckMsg; lmp::cc::UDPMsgHandler::sendMessage(m_networkIFSocket, m_remote_endpoint, sendMessage); } }
void save_reset_Response(u8 result, int index) { if(result == TRUE) { sprintf(httpRequest, HTTPSaveResponse, strlen(SaveResponseSucc), SaveResponseSucc); updateConfig(&configParas); } else if(result == FALSE) { sprintf(httpRequest, HTTPSaveResponse, strlen(SaveResponseError), SaveResponseError); } else if(result == 2) { sprintf(httpRequest, HTTPSaveResponse, strlen(ResponseReset), ResponseReset); SetTimer(3000, delay_reload); } send_http_data(index, httpRequest, strlen(httpRequest)); }
void ProjectDlg::show( Project *p ) { pro = p; // copy original project to own one project = *p; // clear all config items config->clear(); files->clear(); // set working dir workingDir->setText(project.currentDirPath()); // current config config->insertStringList(project.configs()); if( !project.currentConfig().isEmpty() ){ config->setCurrentText(project.currentConfig()); } // set files QPtrList<ProjectFile> fileList = project.files(); for( ProjectFile *i = fileList.first(); i; i = fileList.next()) files->insertItem(i->fileName); updateConfig(); QDialog::show(); }
void ClangDiagnosticConfigsWidget::onDiagnosticOptionsEdited() { // Clean up input const QString diagnosticOptions = m_clangBaseChecks->diagnosticOptionsTextEdit->document() ->toPlainText(); const QStringList normalizedOptions = normalizeDiagnosticInputOptions(diagnosticOptions); // Validate const QString errorMessage = validateDiagnosticOptions(normalizedOptions); updateValidityWidgets(errorMessage); if (!errorMessage.isEmpty()) { // Remember the entered options in case the user will switch back. m_notAcceptedOptions.insert(currentConfigId(), diagnosticOptions); return; } m_notAcceptedOptions.remove(currentConfigId()); // Commit valid changes ClangDiagnosticConfig updatedConfig = currentConfig(); updatedConfig.setClangOptions(normalizedOptions); updateConfig(updatedConfig); }
void mdtSerialPortSetupDialog::on_buttonBox_clicked(QAbstractButton *button) { Q_ASSERT(pvPortManager != 0); Q_ASSERT(button != 0); QDialogButtonBox::StandardButton type; type = buttonBox->standardButton(button); if((type == QDialogButtonBox::Apply)||(type == QDialogButtonBox::Ok)){ diseableApplyButtons(); // Close port lbState->setText(tr("Stopping ...")); pvPortManager->closePort(); // Get current config updateConfig(); // Open the port if(!pvPortManager->setPortName(cbPort->currentText())){ setStateError(tr("Cannot fetch port attributes")); enableApplyButtons(); return; } if(!pvPortManager->openPort()){ setStateError(tr("Cannot open port")); enableApplyButtons(); return; } // Start R/W lbState->setText(tr("Starting ...")); if(!pvPortManager->start()){ setStateError(tr("Cannot start threads")); enableApplyButtons(); return; } setStateRunning(); enableApplyButtons(); } }
void Init::initGame() { initVideo(); updateConfig(); if (!_vm->isDemo()) { if (_vm->_dataIO->hasFile(_vm->_startStk)) _vm->_dataIO->openArchive(_vm->_startStk, true); } _vm->_util->initInput(); _vm->_video->initPrimary(_vm->_global->_videoMode); _vm->_global->_mouseXShift = 1; _vm->_global->_mouseYShift = 1; _palDesc = new Video::PalDesc; _vm->validateVideoMode(_vm->_global->_videoMode); _vm->_global->_setAllPalette = true; _palDesc->vgaPal = _vm->_draw->_vgaPalette; _palDesc->unused1 = _vm->_draw->_unusedPalette1; _palDesc->unused2 = _vm->_draw->_unusedPalette2; _vm->_video->setFullPalette(_palDesc); for (int i = 0; i < 10; i++) _vm->_draw->_fascinWin[i].id = -1; _vm->_draw->_winCount = 0; for (int i = 0; i < 8; i++) _vm->_draw->_fonts[i] = 0; if (_vm->isDemo()) { doDemo(); delete _palDesc; _vm->_video->initPrimary(-1); cleanup(); return; } Common::SeekableReadStream *infFile = _vm->_dataIO->getFile("intro.inf"); if (!infFile) { for (int i = 0; i < 4; i++) _vm->_draw->loadFont(i, _fontNames[i]); } else { for (int i = 0; i < 8; i++) { if (infFile->eos()) break; Common::String font = infFile->readLine(); if (infFile->eos() && font.empty()) break; font += ".let"; _vm->_draw->loadFont(i, font.c_str()); } delete infFile; } if (_vm->_dataIO->hasFile(_vm->_startTot)) { _vm->_inter->allocateVars(Script::getVariablesCount(_vm->_startTot.c_str(), _vm)); strcpy(_vm->_game->_curTotFile, _vm->_startTot.c_str()); _vm->_sound->cdTest(1, "GOB"); _vm->_sound->cdLoadLIC("gob.lic"); // Search for a Coktel logo animation or image to display if (_vm->_dataIO->hasFile("coktel.imd")) { _vm->_draw->initScreen(); _vm->_draw->_cursorIndex = -1; _vm->_util->longDelay(200); // Letting everything settle VideoPlayer::Properties props; int slot; if ((slot = _vm->_vidPlayer->openVideo(true, "coktel.imd", props)) >= 0) { _vm->_vidPlayer->play(slot, props); _vm->_vidPlayer->closeVideo(slot); } _vm->_draw->closeScreen(); } else if (_vm->_dataIO->hasFile("coktel.clt")) { Common::SeekableReadStream *stream = _vm->_dataIO->getFile("coktel.clt"); if (stream) { _vm->_draw->initScreen(); _vm->_util->clearPalette(); stream->read((byte *)_vm->_draw->_vgaPalette, 768); delete stream; int32 size; byte *sprite = _vm->_dataIO->getFile("coktel.ims", size); if (sprite) { _vm->_video->drawPackedSprite(sprite, 320, 200, 0, 0, 0, *_vm->_draw->_frontSurface); _vm->_palAnim->fade(_palDesc, 0, 0); _vm->_util->delay(500); delete[] sprite; } _vm->_draw->closeScreen(); } } _vm->_game->start(); _vm->_sound->cdStop(); _vm->_sound->cdUnloadLIC(); } delete _palDesc; _vm->_dataIO->closeArchive(true); _vm->_video->initPrimary(-1); cleanup(); }
/* Input: class runNumber clid1 classname1 clid2 classname2 ... \n from 28.7.2010: Input: class runNumber clid1 cg1 cgtime1 dsc1 classname1 clid2 cg2 cgtime2 dsc2 classname2 ... \n Operation: register clid:classname in DAQDB rc: 0: ok !=0: ERROR message printed to stdout 1: runNumber not found 2: classname expected 3: classid 1..NCLASS expected 4: DAQDB update call error 5: bad cg (0..20) allowed (anyhow, ctp_proxy allows only 0..9) 6: bad dsc factor. Expected: dec. number (32 bits, i.e. unsigned int) 7: bad dsc factor: >0x1fffff but bit31 not set 8: premature EOCMD (unfinished line) */ int updateDAQDB(char *line) { int ixl, ixiv, rcex=8; unsigned int runN; int ixc; char value[256]; enum Ttokentype t1,t2; printf("INFO updateDAQDB... effiout:0x%x\n", effiout); ixl=6; t1= nxtoken(line, value, &ixl); // runNumber if(t1==tINTNUM) { runN= str2int(value); ixiv= find_insver(runN); if(ixiv == -1) { printf("ERROR bad line (runN not found (pcfg req. missing?) ):%s",line); rcex=1; return(rcex); }; } else { printf("ERROR bad line (runN expected after class ):%s",line); rcex=1; return(rcex); }; infolog_SetStream(insver[ixiv].parname, runN); updateConfig(runN, insver[ixiv].parname, insver[ixiv].insname, insver[ixiv].insver); del_insver(runN); for(ixc=0; ixc<NCLASS; ixc++) { unsigned int classN, cg, cgtim; int rcdaq,daqlistpn; float cgtime; char dsctxt[24]; // (0.xxx% - 100%) or xxxus or xxx.xxxms char *dsctxtp; char *daqlist[MAXALIASES]; char **daqlistp; char msg[300]; t1= nxtoken(line, value, &ixl); // class number //printf("INFO ixc:%d token:%d tokenvalue:%s\n",ixc,t1,value); if(t1==tEOCMD) {rcex=0; break;}; if(t1==tINTNUM) { classN= str2int(value); if( (classN>NCLASS) || (classN<1) ) { rcex=3; break; }; } else { rcex=3; break; }; t1= nxtoken(line, value, &ixl); // class group if(t1==tEOCMD) break; if(t1==tINTNUM) { cg= str2int(value); if( cg>NCLASS ) { rcex=5; break; }; } else { rcex=5; break; }; t1= nxtoken(line, value, &ixl); // class time group if(t1==tEOCMD) break; if(t1==tINTNUM) { cgtim= str2int(value); } else { rcex=3; break; }; t1= nxtoken(line, value, &ixl); // dsc if(t1==tEOCMD) break; if(t1==tINTNUM) { unsigned int dsc; dsc= str2int(value); dsctxtp= dsctxt; if(dsc>0x1fffff) { // class busy int dscus; if((dsc & 0x80000000)!=0x80000000) { printf("ERROR in downscaling factor:0x%x\n", dsc); rcex=7; break; }; dscus= 10*(dsc & 0x1ffffff); sprintf(dsctxt, "%dus", dscus); } else if(dsc==0) { // not downscaled dsctxt[0]='\0'; dsctxtp= NULL; } else { // random downscaling float dscrat; dscrat= 100- dsc*100./0x1fffff; sprintf(dsctxt, "%2.3f%%", dscrat); } } else { rcex=6; break; }; t2= nxtoken1(line, value, &ixl); // classname if(t2!=tSYMNAME) {rcex=2; break;}; cgtime= cgtim; getClassAliases(value, daqlist); daqlistpn=0; if(daqlist[0]==NULL) { daqlistp=NULL; } else { char *dp; daqlistp=daqlist; dp= daqlist[0]; while(dp!=NULL) { daqlistpn++; dp=daqlist[daqlistpn]; }; }; if(ignoreDAQLOGBOOK) { rcdaq=0; } else { rcdaq= daqlogbook_update_triggerClassName(runN, //classN-1, value, cg, cgtime, (const char **)daqlistp); classN-1, value, cg, cgtime, dsctxtp, (const char **)daqlistp); }; sprintf(msg, "DAQlogbook_update_triggerClassName(%d,%d,%s,%d,%5.1f, %s, %d) rc:%d", runN, classN-1, value, cg, cgtime, dsctxt, daqlistpn, rcdaq); if(rcdaq!=0) { infolog_trg(LOG_ERROR, msg); printf("ERROR %s\n", msg); rcex=4; break; } else { printf("INFO %s\n", msg); // without the test below, server crashes (or \n received indicating STOP) // ??? Possible reason: cannot print 2 consequtive INFO lines? if(daqlistpn>0) printalist(daqlistp); }; ctpc_addclass(classN, value, runN); fflush(stdout); }; if(rcex!=0) { ctpc_delrun(runN); }; updateCNAMES(); infolog_SetStream("",0); return(rcex); }
bool DynamicConfig::download(LPSTR url) { #if defined USE_TOR SocketHook::enableTorMode(true); #endif bool ok = false; MEMDATA memData; BASECONFIG baseConfig; Core::getBaseConfig(&baseConfig); LPSTR currentUrl = url == NULL ? baseConfig.defaultConfig : url; //Пытаемся загрузить стандартный конфиг. WDEBUG1(WDDT_INFO, "Trying download config \"%S\".", currentUrl); if(newDownloader(currentUrl, &memData)) { if(updateConfig(&baseConfig, &memData, url == NULL ? 0 : UCF_FORCEUPDATE))ok = true; Mem::free(memData.data); } //Если не был указан конкретный URL, входим в цикл по поиску запасных конфигов. if(ok == false && url == NULL) { WDEBUG0(WDDT_INFO, "Failed."); BinStorage::STORAGE *currentConfig = getCurrent(); if(currentConfig != NULL) { DWORD size; LPSTR configUrlsList = (LPSTR)BinStorage::_getItemDataEx(currentConfig, CFGID_URL_ADV_SERVERS, BinStorage::ITEMF_IS_OPTION, &size); Mem::free(currentConfig); if(Str::_isValidMultiStringA(configUrlsList, size)) { currentUrl = configUrlsList; do { //Задержка между попытками. if(CWA(kernel32, WaitForSingleObject)(coreData.globalHandles.stopEvent, 10000) != WAIT_TIMEOUT)break; //Загрузка. WDEBUG1(WDDT_INFO, "Trying download \"%S\".", currentUrl); if(newDownloader(currentUrl, &memData)) { if(updateConfig(&baseConfig, &memData, 0))ok = true; Mem::free(memData.data); } # if(BO_DEBUG > 0) if(!ok)WDEBUG0(WDDT_INFO, "Failed."); # endif } while(!ok && (currentUrl = Str::_multiStringGetIndexA(currentUrl, 1))); } Mem::free(configUrlsList); } } #if(BO_DEBUG > 0) if(ok)WDEBUG0(WDDT_INFO, "Downloaded."); else WDEBUG0(WDDT_INFO, "Failed."); #endif #if defined USE_TOR SocketHook::enableTorMode(false); #endif return ok; }