int ManageConfig::init() { if (loadConfig("char_config.xml")) { CheckRoleName::instance()->init(); reportParam(); return 0; } else { std::cout << ("Failed to load config file.\n"); return -1; } }
void CallDaemon::slotSysMsg(const QCString &msg, const QByteArray &) { if(msg == "RefreshConfig") { //conf->flush(); qDebug("refreshconfig"); loadConfig(); } if(msg == "Quit") { qDebug("qapp->quit"); qApp->quit(); } }
void MeteorShowersMgr::init() { loadTextures(); m_meteorShowers = new MeteorShowers(this); m_configDialog = new MSConfigDialog(this); m_searchDialog = new MSSearchDialog(this); createActions(); loadConfig(); // timer to hide the alert messages m_messageTimer = new QTimer(this); m_messageTimer->setSingleShot(true); m_messageTimer->setInterval(9000); m_messageTimer->stop(); connect(m_messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout())); // MeteorShowers directory QString userDir = StelFileMgr::getUserDir() + "/modules/MeteorShowers"; StelFileMgr::makeSureDirExistsAndIsWritable(userDir); // Loads the JSON catalog m_catalogPath = userDir + "/showers.json"; if (!loadCatalog(m_catalogPath)) { displayMessage(q_("The current catalog of Meteor Showers is invalid!"), "#bb0000"); restoreDefaultCatalog(m_catalogPath); } // Sets up the download manager m_downloadMgr = new QNetworkAccessManager(this); connect(m_downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateFinished(QNetworkReply*))); // every 5 min, check if it's time to update QTimer* updateTimer = new QTimer(this); updateTimer->setInterval(300000); connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdates())); updateTimer->start(); checkForUpdates(); // always check if we are on Earth StelCore* core = StelApp::getInstance().getCore(); m_onEarth = core->getCurrentPlanet().data()->getEnglishName() == "Earth"; connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(locationChanged(StelLocation))); // enable at startup? setEnablePlugin(getEnableAtStartup()); }
///////////////////////////////////////////////////////////////////////////////////////// 版本更新函数 // 更新检测函数 bool CUpdate::needUpdate(int remoteVersion) { wxString values; bool res = loadConfig( _("SYSTEM/version"), &values); long lastVersion = 0; values.ToLong(&lastVersion); if(lastVersion < remoteVersion) { // 需要更新,并记录需要更新的版本号,以便回写配置文件。 m_updateVersion = remoteVersion; return true; } return false; }
void ClsQHarborImpl::slotLoadConfig() { #ifdef DEBUG_CLSQHARBORIMPL cout << "ClsQHarborImpl::slotLoadConfig()" << endl; #endif QString filename = QFileDialog::getOpenFileName( "", "Harbor Config (*.hconf)", this, "Open File" "Choose a file" ); loadConfig(filename); };
void MixtureOfGaussianV1BGS::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel) { if(img_input.empty()) return; loadConfig(); if(firstTime) saveConfig(); //------------------------------------------------------------------ // BackgroundSubtractorMOG // http://opencv.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.html#backgroundsubtractormog // // Gaussian Mixture-based Backbround/Foreground Segmentation Algorithm. // // The class implements the algorithm described in: // P. KadewTraKuPong and R. Bowden, // An improved adaptive background mixture model for real-time tracking with shadow detection, // Proc. 2nd European Workshp on Advanced Video-Based Surveillance Systems, 2001 //------------------------------------------------------------------ //--S [] 2016/06/16: Sang-Wook Lee //mog(img_input, img_foreground, alpha); mog->apply(img_input, img_foreground, alpha); //--E [] 2016/06/16: Sang-Wook Lee cv::Mat img_background; //--S [] 2016/06/16: Sang-Wook Lee //mog.getBackgroundImage(img_background); mog->getBackgroundImage(img_background); //--E [] 2016/06/16: Sang-Wook Lee if(enableThreshold) cv::threshold(img_foreground, img_foreground, threshold, 255, cv::THRESH_BINARY); if(showOutput) { if (!img_foreground.empty()) cv::imshow("GMM FG (KadewTraKuPong&Bowden)", img_foreground); if (!img_background.empty()) cv::imshow("GMM BG (KadewTraKuPong&Bowden)", img_background); } img_foreground.copyTo(img_output); img_background.copyTo(img_bgmodel); firstTime = false; }
int main(int argc, char** argv) { /** * Main function for the whole PAC Game */ curLevel[0] = '1'; curLevel[1] = '\0'; loadMaze(); loadConfig(); srand(time(NULL)); winsizex=config->resx,winsizey=config->resy; //Pac initialization agentsSet(); cameraSetting.posx = 0.0; cameraSetting.posy = 0.0; cameraSetting.posz = 0.0; cameraSetting.dirx = 0.0; cameraSetting.diry = 0.0; cameraSetting.dirz = -1.0; cameraSetting.upx = 0.0; cameraSetting.upy = 1.0; cameraSetting.upz = 0.0; cameraSetting.cameraMode = 0; prevMouseX = INT_MAX; prevMouseY = INT_MAX; unbuildPacAIMaze(); pacControlAgent = 0; init(argc, argv); //Initialize rendering //Set functions for glutMainLoop to call glutDisplayFunc(draw); glutReshapeFunc(handleResize); glutKeyboardFunc(key); glutKeyboardUpFunc(keyUp); glutSpecialFunc(keyListen); glutMotionFunc(mouseMotion); glutMouseFunc(mouse); //glutIdleFunc(motion); //glutIdleFunc(draw); startTime = prevFrameTime = curFrameTime = glutGet(GLUT_ELAPSED_TIME); glutTimerFunc(ANIM, motion, 0); glutMainLoop(); //Start the main loop. glutMainLoop doesn't return. return 0; //This line is never reached }
int main(void) { int ch; initscr(); atexit(quit); start_color(); clear(); noecho(); curs_set(0); cbreak(); nl(); keypad(stdscr, TRUE); //set stdscr red init_pair(1, COLOR_BLACK, COLOR_RED); bkgd(COLOR_PAIR(1)); // refresh(); loadConfig("config.cfg"); clear(); getmaxyx(stdscr,y,x); box(stdscr,0,0); if (y > 30 && configFile::getInstance()->getContents("printLogo") != "false") { titleWin = newwin(7,x-2,1,1); pluginWin = newwin(y-2-7,x-2,8,1); box(titleWin,0,0); printTitle(); } else pluginWin = stdscr; box(pluginWin,0,0); refresh(); if (titleWin != NULL) wrefresh(titleWin); wrefresh(pluginWin); listModules(); return (0); }
void ReplSetImpl::init(OperationContext* txn, ReplSetSeedList& replSetSeedList) { mgr = new Manager(this); _cfg = 0; memset(_hbmsg, 0, sizeof(_hbmsg)); strcpy(_hbmsg , "initial startup"); lastH = 0; changeState(MemberState::RS_STARTUP); _seeds = &replSetSeedList.seeds; LOG(1) << "replSet beginning startup..." << rsLog; loadConfig(txn); unsigned sss = replSetSeedList.seedSet.size(); for (Member *m = head(); m; m = m->next()) { replSetSeedList.seedSet.erase(m->h()); } for (set<HostAndPort>::iterator i = replSetSeedList.seedSet.begin(); i != replSetSeedList.seedSet.end(); i++) { if (isSelf(*i)) { if (sss == 1) { LOG(1) << "replSet warning self is listed in the seed list and there are no " "other seeds listed did you intend that?" << rsLog; } } else { log() << "replSet warning command line seed " << i->toString() << " is not present in the current repl set config" << rsLog; } } // Figure out indexPrefetch setting std::string& prefetch = getGlobalReplicationCoordinator()->getSettings().rsIndexPrefetch; if (!prefetch.empty()) { IndexPrefetchConfig prefetchConfig = PREFETCH_ALL; if (prefetch == "none") prefetchConfig = PREFETCH_NONE; else if (prefetch == "_id_only") prefetchConfig = PREFETCH_ID_ONLY; else if (prefetch == "all") prefetchConfig = PREFETCH_ALL; else warning() << "unrecognized indexPrefetch setting: " << prefetch << endl; setIndexPrefetchConfig(prefetchConfig); } }
bool ShowLayer::initShow(int level) { if (!Layer::init()) { return false; } //加载资源,创建manager loadConfig(level); //可用update scheduleUpdate(); return true; }
bool StarbookDriver::ISNewSwitch(const char *dev, const char *name, ISState *states, char **names, int n) { if (!strcmp(name, StartSP.name)) { return performStart(); } if (!strcmp(name, "CONNECTION_MODE")) { // TODO: resolve this in less hacky way https://github.com/indilib/indi/issues/810 loadConfig(false, "DEVICE_ADDRESS"); // we pass rest of the work to parent function // hopefully, loading property before connection mode setups won't break anything } return Telescope::ISNewSwitch(dev, name, states, names, n); }
bool _ELC_::Project :: loadProject(_ELENA_::path_t path) { if (emptystr(projectName)) { projectName.copy(_ELENA_::IdentifierString(path)); loadConfig(path); _ELENA_::Path projectPath; projectPath.copySubPath(path); _settings.add(_ELENA_::opProjectPath, _ELENA_::IdentifierString::clonePath(projectPath.c_str())); return true; } else return false; }
int DirScaner::run() { int retVal; bool reRun = false; do { retVal = startProcesses(); syslog(LOG_INFO, "[run] retval %d\n", retVal); if (retVal >= 0) // если мы потомок { bool isInit = true; int status = 0; while(true) { status = scanDir(m_buffer[retVal].dirName.c_str(), isInit); if(status) break; if(isInit) { syslog(LOG_INFO, "[run] initial map successfull\n"); isInit = false; } if(g_destroySelf) { exit(0); } sleep(m_buffer[retVal-1].mTime); } return status; } else if(retVal == -1){ // бесконечный цикл работы while(true) { pause(); if(g_destroySelf) { destroyAllChildren(); exit(0); } if(g_reloadCfg){ destroyAllChildren(); loadConfig(); g_reloadCfg = false; reRun = true; break; } } } } while(reRun); return retVal; }
void LBAdaptiveSOM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel) { if(img_input.empty()) return; loadConfig(); IplImage *frame = new IplImage(img_input); if(firstTime) { saveConfig(); int w = cvGetSize(frame).width; int h = cvGetSize(frame).height; m_pBGModel = new BGModelSom(w,h); m_pBGModel->InitModel(frame); } m_pBGModel->setBGModelParameter(0,sensitivity); m_pBGModel->setBGModelParameter(1,trainingSensitivity); m_pBGModel->setBGModelParameter(2,learningRate); m_pBGModel->setBGModelParameter(3,trainingLearningRate); m_pBGModel->setBGModelParameter(5,trainingSteps); m_pBGModel->UpdateModel(frame); //--S [] 2016/06/16: Sang-Wook Lee //img_foreground = cv::Mat(m_pBGModel->GetFG()); //img_background = cv::Mat(m_pBGModel->GetBG()); img_foreground = cv::cvarrToMat(m_pBGModel->GetFG()); img_background = cv::cvarrToMat(m_pBGModel->GetBG()); //--E [] 2016/06/16: Sang-Wook Lee if(showOutput) { cv::imshow("SOM Mask", img_foreground); cv::imshow("SOM Model", img_background); } img_foreground.copyTo(img_output); img_background.copyTo(img_bgmodel); delete frame; firstTime = false; }
void initConfig() { client_name = NULL; file_config = NULL; dir_store = NULL; dir_restore = NULL; dir_key = NULL; server_port = CONFIG_SERVER_PORT; char *home = getenv("HOME"); if (home == NULL) { printf ( "ERROR: Home-directory not found.\n" ); exit(EXIT_FAILURE); } /* dir_config */ dir_config = malloc (strlen(home)+1+strlen(CONFIG_DIRECTORY)+1); if (dir_config == NULL) { fprintf ( stderr, "\ndynamic memory allocation failed\n" ); exit (EXIT_FAILURE); } sprintf(dir_config, "%s/%s", home, CONFIG_DIRECTORY); mkdir(dir_config, 0755); printf ( "HOME: %s\n", dir_config ); /* file_config */ file_config = malloc (strlen(dir_config)+1+strlen(CONFIG_FILE)+1); if (file_config == NULL) { fprintf ( stderr, "\ndynamic memory allocation failed\n" ); exit (EXIT_FAILURE); } sprintf(file_config, "%s/%s", dir_config, CONFIG_FILE); printf ( "CONFIG: %s\n", file_config ); loadConfig(); if (dir_store == NULL) setConfigStore(NULL); if (dir_restore == NULL) setConfigRestore(NULL); if (dir_key == NULL) setConfigKey(NULL); if (client_name == NULL) setConfigClientName(NULL); if (server_port == -1) setConfigServerPort(-1); /* check if config already exists */ if (!fileExists(file_config)) { saveConfig(); } }
bool ShowLayer::init() { // super init first if (!Layer::init()) { return false; } //加载资源,创建manager loadConfig(); //可用update scheduleUpdate(); return true; }
/** * Loads the given config file from the given location. * It does not search for another locations */ ConfigReader::ConfigReader ( const string& file, const string& location ) : doc ( NULL ), initSuccesful ( true ) { configFile = location + DIRSEP() + file; LOG ( "Trying:" ); LOG ( configFile.c_str() ); if ( loadConfig ( configFile ) ) { LOG ( "Read configuration" ); return; } LOG ( "Did not read configuration" ); initSuccesful = false; }
void MainWindow::openConfig() { QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), QDir::currentPath(), tr("All files (*.xml)")); if (fileName.isEmpty()) { return; } options.clear(); loadConfig(fileName); for (int i = 0; i < options.size(); i++) { updateUIByOption(options[i]); } }
bool atWrapper::initTests(bool *haveBaseline) { qDebug() << "Running test on buildkey:" << QLibraryInfo::buildKey() << " qt version:" << qVersion(); qDebug( "Initializing tests..." ); if (!loadConfig( QHostInfo::localHostName().split( "." ).first() + ".ini" )) return false; //Reset the FTP environment where the results are stored *haveBaseline = setupFTP(); // Retrieve the latest test result baseline from the FTP server. downloadBaseline(); return true; }
ShortUrlConfigureWidget::ShortUrlConfigureWidget(QWidget *parent) : QWidget(parent), d(new ShortUrlConfigureWidgetPrivate) { QHBoxLayout *lay = new QHBoxLayout(this); lay->setMargin(0); QLabel *lab = new QLabel(i18n("Select Short URL server:"), this); lay->addWidget(lab); d->mShortUrlServer = new QComboBox(this); connect(d->mShortUrlServer, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &ShortUrlConfigureWidget::slotChanged); lay->addWidget(d->mShortUrlServer); init(); loadConfig(); }
void JoyStick::ISGetProperties(const char *dev) { INDI::DefaultDevice::ISGetProperties(dev); defineText(&PortTP); loadConfig(true, INDI::SP::DEVICE_PORT); if (isConnected()) { for (int i = 0; i < driver->getNumOfJoysticks(); i++) defineNumber(&JoyStickNP[i]); defineNumber(&AxisNP); defineSwitch(&ButtonSP); } }
//------------------------------------------------------------------------------------- //Main function for the setup runs all different setup sequences bool OGREBase::setup(void) { createRoot(); loadConfig(); addOverlay(); if (!generateRenderWindow()) return false; createSceneBase(); createScene(); createCamera(); createViewports(); startOIS(); initSDKTray(); finalTouch(); return true; }
void MainWindow::on_btnDeletegroup_clicked() { QListWidgetItem *item = ui->lwGroups->currentItem(); if (connections.value(ui->lwGroups->currentItem()->text())->isOpen()) { QMessageBox::information(this, tr("Невозможно удалить подключение"), tr("Подключение активно, остановите подключение " "для его удаления")); return; } connections.remove(item->text()); deleteConfig(item->text()); int row = ui->lwGroups->currentRow(); delete item; ui->lwGroups->setCurrentRow(row == 0 ? row : row - 1); loadConfig(ui->lwGroups->currentItem()->text()); }
/** * This method reads the config-file for the JointJointInteraction-module * @param fileName location of the config-file **/ void JointInteraction::readConfig(std::string fileName) { std::string ConcatenatedPath = getConcatenatedPath(fileName, "JointConfiguration"); if(!fileExists(ConcatenatedPath)) { printd(ERROR, "JointInteraction::readConfig(): cannot read from file %s\n", ConcatenatedPath.c_str()); return; } // if IrrXMLReader* xml = createIrrXMLReader(ConcatenatedPath.c_str()); if (!xml) { printd(ERROR, "JointInteraction::readConfig(): ERROR: could not find config-file %s\n", ConcatenatedPath.c_str()); return; } // if printd(INFO, "JointInteraction::readConfig(): loading from file: %s\n", fileName.c_str()); while (xml && xml->read()) { switch (xml->getNodeType()) { case EXN_ELEMENT: if (!strcmp("jointInteraction", xml->getNodeName())) { // Root node } // if else if (!strcmp("config", xml->getNodeName())) { loadConfig(xml); } // else if else if (!strcmp("joints", xml->getNodeName())) { loadJoints(xml); } // else if else { printd(WARNING, "JointInteraction::readConfig(): WARNING: unknown element with name %s found!\n", xml->getNodeName()); } // else break; default: break; } // switch } // while delete xml; } // readConfig
/** * Starts up the rig client by creating a JVM in a seperate thread. * Installs a signal handler so a SIGINT or SIGTERM causes the rig * client to shut down. */ int main(int argc, char *argv[]) { pthread_t thread; int code; struct sigaction shutAction; if (!loadConfig()) { logMessage("Failed to load configuration, exiting...\n\n"); printf("Failed to load configuration, exiting...\n\n"); return 1; } if (!generateClassPath()) { logMessage("Failed to detected current directory...\n\n"); printf("Failed to detected current directory...\n\n"); return 2; } /* Install signal handler for SIGINT & SIGTERM. */ shutAction.sa_handler = shutDownSchedulingServer; sigemptyset(&shutAction.sa_mask); shutAction.sa_flags = SA_RESTART; if (sigaction(SIGINT, &shutAction, NULL) == -1) { logMessage("Unable to install interrupt signal (SIGINT) handler."); perror("Failed installing SIGINT handler"); } if (sigaction(SIGTERM, &shutAction, 0) == -1) { logMessage("Unable to install terminate signal (SIGTERM) handler."); perror("Failed installing SIGTERM handler"); } /* Start thread. */ if (code = pthread_create(&thread, NULL, runSchedulingServer, NULL)) { logMessage("Failed to create JVM thread with code %i.\n", code); printf("Failed to create JVM thread with code %i.\n", code); return 3; } pthread_join(thread, NULL); return 0; }
DWORD WINAPI threadMain(LPVOID lpParam) { if (!loadConfig()) { logMessage("ERROR: Unable to load configuration.\n"); return 0; } if (!generateClassPath()) { logMessage("ERROR: Unable to generate classpath.\n"); return 0; } startJVM(); return 1; }
void WatchDog::ISGetProperties(const char *dev) { // First we let our parent populate DefaultDevice::ISGetProperties(dev); defineNumber(&HeartBeatNP); defineText(&SettingsTP); defineSwitch(&ShutdownProcedureSP); defineText(&ActiveDeviceTP); // Only load config first time and not on subsequent client connections if (watchDogTimer == -1) loadConfig(true); //watchdogClient->setTelescope(ActiveDeviceT[0].text); //watchdogClient->setDome(ActiveDeviceT[1].text); }
long PADinit(long flags) { int i,j; init_macros(); initPadtime(); for (i=0; i<MAXDEVICES; i++) { maxzero[i] = 250; minzero[i] = -250; for (j=0; j<MAXAXES; j++) { axestatus[i][j] = AXESTS_UNKNOWN; } } loadConfig(); return 0; }
mainWindow::mainWindow( QWidget * parent, Qt::WFlags f) : QMainWindow(parent, f) { setupUi(this); reloadTime = 1; createDocks(); makeConnections(); showMaximized(); loadConfig(); verifyFinstall(); createTrayIcon(); trayIcon->show(); Monitor->setEnabled(false); }
int main( int argc , char ** argv) { int status = 0; { config_type * config = ext_cmd_alloc_config(); int iarg; bool OK = true; for (iarg = 1; iarg < argc; iarg++) OK = OK && loadConfig( config , argv[iarg]); if (!OK) status = 1; config_free(config); } exit( status ); }