int start() { jparse_init(); rest_init(); http_start(); device_init(); #ifdef _DEBUG billing_init(); #endif #ifndef _MSC_VER const char *initrc = initSearch(search_file.c_str()); if (initrc && initrc[0]) { api_log_printf("%s\r\n", initrc); searcher = NULL; } else { searcher = makeSearcher(); } #endif api_listen_tcp(api_tag, host.c_str(), port.c_str(), &handlers); size_t num_cores; #ifdef WIN32 SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); num_cores = sysinfo.dwNumberOfProcessors; #elif MACOS int nm[2]; size_t len = 4; uint32_t count; nm[0] = CTL_HW; nm[1] = HW_AVAILCPU; sysctl(nm, 2, &count, &len, NULL, 0); if(count < 1) { nm[1] = HW_NCPU; sysctl(nm, 2, &count, &len, NULL, 0); if(count < 1) { count = 1; } } num_cores = count; #else num_cores = sysconf(_SC_NPROCESSORS_ONLN); #endif CPUINFO *cpu_info = cpu_get_info(); api_log_printf("[HTTP] CPU INFO: Brand name: %s, cores count: %u, Hyper threads: %s\r\n", cpu_info->vendor.c_str(), num_cores, (cpu_info->hyper_threads) ? "yes" : "no"); thread_pool_init(num_cores - 1); api_log_printf("[HTTP] Started\r\n"); return 0; }
void MoveFinderExternEngine::findBestMove(const RequestParamFindMove ¶m) { initSearch(param); const PrintableMove m = checkForSingleMove(); if(m.isMove()) { putMove(m); } else { if(!m_externEngine.isReady() || !m_externEngine.isThreadRunning()) { throwException(_T("Extern engine is dead:Flags:%s"), m_externEngine.flagsToString().cstr()); } m_externEngine.findBestMove(param.getGame(), param.getTimeLimit()); } }
FileSystemWidget::FileSystemWidget(QWidget *parent) : QWidget(parent), ui(new Ui::FileSystemWidget) { ui->setupUi(this); m_delegate = new FileSystemItemDelegate(this); ui->listView->setItemDelegate(m_delegate); initModel(); ui->listView->setModel(m_sortModel); connect(ui->listView, SIGNAL(open(QModelIndex)),m_model, SLOT(cd(QModelIndex))); connect(ui->listView, SIGNAL(up()), m_model, SLOT(cdUp())); connect(ui->listView, SIGNAL(play(QStringList,bool,bool)), this, SLOT(play(QStringList,bool,bool))); initSearch(); ui->progressPanel->hide(); connect(ui->upButton, SIGNAL(clicked()), m_model, SLOT(cdUp())); connect(m_model, SIGNAL(upChanged(bool)),ui->upButton, SLOT(setEnabled(bool))); connect(m_model, SIGNAL(pathChanged()), this, SLOT(onPathChanged())); connect(ui->selectButton, SIGNAL(clicked()), this, SLOT(selectFolder())); connect(ui->playAllButton, SIGNAL(clicked()), this, SLOT(playAll())); connect(ui->playRootButton, SIGNAL(clicked()), this, SLOT(playRoot())); connect(ui->addAllButton, SIGNAL(clicked()), this, SLOT(addAll())); connect(ui->addRootButton, SIGNAL(clicked()), this, SLOT(addRoot())); m_scanDialog = new ScanProgressDialog(this); connect(m_scanDialog, SIGNAL(cancelled()), Player::instance()->folder(), SLOT(cancel())); connect(Player::instance()->folder(), SIGNAL(cancelled()), m_scanDialog, SLOT(onScanCancelled())); connect(Player::instance()->folder(), SIGNAL(scanPathChanged(QString)), m_scanDialog, SLOT(setScanPath(QString))); connect(Player::instance()->folder(), SIGNAL(finished(int)), m_scanDialog, SLOT(onScanFinished(int))); m_scanDialogTimer.setSingleShot(true); connect(&m_scanDialogTimer, SIGNAL(timeout()), this, SLOT(showScanDialog())); connect(Player::instance()->folder(), SIGNAL(finished(int)), &m_scanDialogTimer, SLOT(stop())); }
void MoveFinderRandomPlay::findBestMove(const RequestParamFindMove ¶m) { initSearch(param); randomize(); putMove(m_game.getRandomMove()); }
void PeopleApplication::createPeoplePage() { //m_AccountManager = AccountManger::getInstance(); m_mainPage = new MApplicationPage; m_mainPage->setTitle(QObject::tr("People","Title of the application")); QGraphicsLinearLayout *linear = new QGraphicsLinearLayout(Qt::Vertical); linear->setContentsMargins(0, 0, 0, 0); linear->setSpacing(0); m_mainPage->centralWidget()->setLayout(linear); m_topSpacer = new QGraphicsWidget; m_topSpacer->setPreferredHeight(0); linear->addItem(m_topSpacer); m_people = new SeasidePeople; linear->addItem(m_people); m_bottomSpacer = new QGraphicsWidget; m_bottomSpacer->setPreferredHeight(0); linear->addItem(m_bottomSpacer); m_actionSearch = new MAction(QObject::tr("Search","Menu action to bring up search for contact list"), this); m_actionSearch->setLocation(MAction::ApplicationMenuLocation); m_mainPage->addAction(m_actionSearch); connect(m_actionSearch, SIGNAL(triggered()), this, SLOT(searchClicked())); m_actionAdd = new MAction(QObject::tr("Add Contact","Menu action to add contact"), this); m_actionAdd->setLocation(MAction::ApplicationMenuLocation); m_mainPage->addAction(m_actionAdd); connect(m_actionAdd, SIGNAL(triggered()), this, SLOT(addNewContact())); m_actionAll = new MAction(QObject::tr("<b>Show All</b>","Menu filter to show all contacts"), this); m_actionAll->setLocation(MAction::ApplicationMenuLocation); m_actionAll->setObjectName("ShowAllFilter"); m_actionAll->setCheckable(true); connect(m_actionAll, SIGNAL(triggered()), m_people, SLOT(filterAll())); m_actionFav = new MAction(QObject::tr("Show Favorites", "Menu filter to show all contacts marked as favorites"), this); m_actionFav->setLocation(MAction::ApplicationMenuLocation); m_actionFav->setObjectName("ShowFavoritesFilter"); m_actionFav->setCheckable(true); connect(m_actionFav, SIGNAL(triggered()), m_people, SLOT(filterFavorites())); m_actionRecent = new MAction(QObject::tr("Show Recent","Menu filter to show all contacts with recent communications"), this); m_actionRecent->setLocation(MAction::ApplicationMenuLocation); m_actionRecent->setCheckable(true); m_actionRecent->setObjectName("ShowRecentFilter"); connect(m_actionRecent, SIGNAL(triggered()), m_people, SLOT(filterRecent())); m_actionFilters = new QActionGroup(this); m_actionFilters->addAction(m_actionAll); m_actionFilters->addAction(m_actionRecent); m_actionFilters->addAction(m_actionFav); m_actionFilters->setExclusive(true); m_mainPage->addActions(m_actionFilters->actions()); connect(m_actionFilters, SIGNAL(triggered(QAction*)), this, SLOT(menuFilterSelected(QAction*))); connect(m_people, SIGNAL(itemClicked(QModelIndex)), this, SLOT(createDetailPage(QModelIndex))); connect(m_people, SIGNAL(editRequest(QModelIndex)), this, SLOT(createEditPage(QModelIndex))); connect(m_people, SIGNAL(callNumber(const QString&)), this, SLOT(callNumber(const QString&))); connect(m_people, SIGNAL(composeSMS(const QString&)), this, SLOT(composeSMS(const QString&))); connect(m_people, SIGNAL(composeIM(const QString&)), this, SLOT(composeIM(const QString&))); connect(m_people, SIGNAL(composeEmail(const QString&)), this, SLOT(composeEmail(const QString&))); m_mainPage->appear(); initSlider(); initSearch(); repositionOverlays(); }
void BreadthFirstSearch::doSearch(Graph *g, int start) { initSearch(g->nvertices); bfs(g, start); }