void KviThread::internalThreadRun_doNotTouchThis() { // we're on the slave thread here! //qDebug(">> KviThread::internalRun (this=%d)",this); setRunning(true); setStartingUp(false); kvi_threadInitialize(); run(); setRunning(false); //qDebug("<< KviThread::internalRun (this=%d",this); }
void ItemUser::updateValues( af::Node *node, int type) { af::User * user = (af::User*)node; permanent = user->isPermanent(); if( numrunningtasks ) setRunning(); else setNotRunning(); priority = user->getPriority(); annotation = afqt::stoq( user->getAnnontation()); hostname = afqt::stoq( user->getHostName()); numjobs = user->getNumJobs(); numrunningtasks = user->getRunningTasksNumber(); maxrunningtasks = user->getMaxRunningTasks(); hostsmask = afqt::stoq( user->getHostsMask()); hostsmask_exclude = afqt::stoq( user->getHostsMaskExclude()); errors_avoidhost = user->getErrorsAvoidHost(); errors_tasksamehost = user->getErrorsTaskSameHost(); errors_retries = user->getErrorsRetries(); errors_forgivetime = user->getErrorsForgiveTime(); jobs_lifetime = user->getJobsLifeTime(); if( numrunningtasks ) setRunning(); else setNotRunning(); strLeftTop = QString("%1-%2").arg(name).arg( priority); if( false == permanent ) strLeftTop = QString("(%1)").arg( strLeftTop); if( isLocked()) strLeftTop = "(LOCK) " + strLeftTop; strLeftBottom = 'j' + QString::number( numjobs) + '/' + QString::number( user->getNumRunningJobs()); strHCenterTop.clear(); if( maxrunningtasks != -1) strHCenterTop = QString("m%1").arg( maxrunningtasks ); if( false == hostsmask.isEmpty() ) strHCenterTop += QString(" H(%1)").arg( hostsmask ); if( false == hostsmask_exclude.isEmpty()) strHCenterTop += QString(" E(%1)").arg( hostsmask_exclude ); strHCenterTop += QString(" %1").arg( user->generateErrorsSolvingString().c_str()); if( jobs_lifetime > 0 ) strHCenterTop += QString(" L%1").arg( af::time2strHMS( jobs_lifetime, true).c_str()); strRightTop = hostname; if( user->solveJobsParallel()) { strRightBottom = "Par"; } else { strRightBottom = "Ord"; } tooltip = user->generateInfoString( true).c_str(); calcHeight(); }
bool BtDeviceController::start(){ stop(); setRunning(true); if (pthread_create(&thread, NULL, run, this) != 0) { setRunning(false); } pthread_detach(thread); return isRunning(); }
MyWindow::MyWindow(const char *title, int width, int height) { window = NULL; renderer = NULL; setRunning(false); window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_SHOWN); if (window != NULL) { renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); setRunning(true); } }
void QFEFCSSimScriptTab::cancelExecution() { if (!isRunning()) { setRunning(false); return; } if (proc ) { proc->close(); proc->deleteLater(); } setRunning(false); }
KviThread::KviThread() { g_pThreadManager->registerSlaveThread(this); m_pRunningMutex = new KviMutex(); setRunning(false); setStartingUp(false); }
void Raids::checkRaids() { if(!getRunning()){ uint64_t now = OTSYS_TIME(); for(RaidList::iterator it = raidList.begin(); it != raidList.end(); ++it){ if(now >= (getLastRaidEnd() + (*it)->getMargin())){ if(MAX_RAND_RANGE*CHECK_RAIDS_INTERVAL/(*it)->getInterval() >= (uint32_t)random_range(0, MAX_RAND_RANGE)){ #ifdef __DEBUG_RAID__ char buffer[32]; time_t tmp = time(NULL); formatDate(tmp, buffer); std::cout << buffer << " [Notice] Raids: Starting raid " << (*it)->getName() << std::endl; #endif setRunning(*it); (*it)->startRaid(); break; } } } } checkRaidsEvent = Scheduler::getScheduler().addEvent(createSchedulerTask(CHECK_RAIDS_INTERVAL*1000, boost::bind(&Raids::checkRaids, this))); }
void Server::start() { int findingPort = 50; while (findingPort) { try { startServer(); setRunning(true); findingPort = 0; qDebug() << "Connected to port" << m_port; if (m_mainWindow) { m_mainWindow->notify("Server Started", "Port set to " + QString::number(m_port)); } } catch (const nzmqt::ZMQException& ex) { if (ex.num() == 48) { findingPort--; setPort(m_port + 1); } else { qWarning() << Q_FUNC_INFO << "Exception:" << ex.num() << ex.what(); findingPort = 0; emit failure(ex.what()); emit finished(); } } } }
void ScriptEditorWidget::onScriptFinished(const QString& scriptPath) { _scriptEngine = NULL; if (_isRestarting) { _isRestarting = false; setRunning(true); } }
void ScriptEditorWidget::onWindowActivated() { if (!_isReloading) { _isReloading = true; if (QFileInfo(_currentScript).lastModified() > _currentScriptModified) { if (static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent())->autoReloadScripts() || QMessageBox::warning(this, _currentScript, tr("This file has been modified outside of the Interface editor.") + "\n\n" + (isModified() ? tr("Do you want to reload it and lose the changes you've made in the Interface editor?") : tr("Do you want to reload it?")), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { loadFile(_currentScript); if (_scriptEditorWidgetUI->onTheFlyCheckBox->isChecked() && isRunning()) { _isRestarting = true; setRunning(false); // Script is restarted once current script instance finishes. } } } _isReloading = false; } }
void UsbWidget::deviceError() { qDebug("[usb] %s",usb_strerror()); usb_close(handle); handle = NULL; setRunning( false ); }
FingerprinterProgressBar::FingerprinterProgressBar( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f | Qt::Sheet ), m_stopped( false ) { ui.setupUi( this ); setModal( true ); setRunning( false ); m_totalTracks = m_tracksFingerprinted = m_tracksSkipped = m_tracksWithErrors = 0; m_timer.setInterval( 1000 ); connect(&m_timer, SIGNAL(timeout()), this, SLOT(update())); connect(ui.fingerprintProgressBar, SIGNAL( valueChanged( int ) ), this, SLOT( progressBarChanged( int ) ) ); m_timeElapsed = m_etaCounter = m_timeRemaining = 0; setFixedHeight( sizeHint().height() ); ui.okButton->setVisible( false ); connect( ui.okButton, SIGNAL( clicked() ), this, SLOT( onOkClicked() ) ); connect( ui.stopButton, SIGNAL( clicked() ), this, SLOT( onCancelClicked() ) ); }
void SatelliteModel::updateDemoData() { static bool flag = true; QList<QGeoSatelliteInfo> satellites; if (flag) { for (int i = 0; i<5; i++) { QGeoSatelliteInfo info; info.setSatelliteIdentifier(i); info.setSignalStrength(20 + 20*i); satellites.append(info); } } else { for (int i = 0; i<9; i++) { QGeoSatelliteInfo info; info.setSatelliteIdentifier(i*2); info.setSignalStrength(20 + 10*i); satellites.append(info); } } satellitesInViewUpdated(satellites); flag ? satellitesInUseUpdated(QList<QGeoSatelliteInfo>() << satellites.at(2)) : satellitesInUseUpdated(QList<QGeoSatelliteInfo>() << satellites.at(3)); flag = !flag; emit errorFound(flag); if (isSingleRequest() && !singleRequestServed) { singleRequestServed = true; setRunning(false); } }
//[-------------------------------------------------------] //[ Public virtual em5::FreeplayEvent methods ] //[-------------------------------------------------------] bool BMAFireEvent::onStartup() { BMAComponent* bma = mTargetBMA->getComponent<flo11::BMAComponent>(); //No nullptr check, EventFactory did that already qsf::Entity* targetEntity = QSF_MAINMAP.getEntityById(bma->getTargetId()); if (targetEntity != nullptr) { // Mark the entity so it wont get effected by other events em5::EventIdComponent& eventIdComponent = targetEntity->getOrCreateComponentSafe<em5::EventIdComponent>(); eventIdComponent.setEvent(*this, em5::eventspreadreason::NO_REASON); } std::string eventName = QSF_TRANSLATE_CONTEXTSTRING("flo11::BMAFireEvent", "ID_BMA_FIRE_EVENT_NAME"); eventName.append(": "); eventName.append(bma->getName()); this->setEventName(eventName); this->setNormalPointGain(500); bma->detectFire(); //BMA AUslösen mMessageProxy.registerAt(qsf::MessageConfiguration("flo11::BMAResetActionFinished"), boost::bind(&BMAFireEvent::onResetBMAFinished, this, _1)); mTargetBurningMessageProxy.registerAt(qsf::MessageConfiguration(em5::Messages::EM5_OBJECT_STOP_BURNING, bma->getTargetId()), boost::bind(&BMAFireEvent::onTargetStopBurning, this, _1)); mInvestigatingMessageProxy.registerAt(qsf::MessageConfiguration("flo11::BMAInvestigationFinished", bma->getEntityId()), boost::bind(&BMAFireEvent::onInvestigationFinished, this, _1)); setRunning(); // Done return true; }
void NetworkService::stop() { //throw (NetworkException*) { if (_log->isInfo()) _log->info("Shutting down the network service"); if (!_running) { throw new NetworkException(new string("The network service is not running. Try starting it first")); } if (processing > 0) { cout << "Stop requested but still working" << endl; } int i = 0; while (processing > 0) { Thread::sleep(1000); i++; // if the time exceeded then shutdown anyway if (i > 10) { break; } } delete _transactionManager; delete _baseTransaction; __dbController->shutdown(); setRunning(false); _ntserver->stop(); delete __dbController; }
void KWin::Script::slotScriptLoadedFromFile() { QFutureWatcher<QByteArray> *watcher = dynamic_cast< QFutureWatcher< QByteArray>* >(sender()); if (!watcher) { // not invoked from a QFutureWatcher return; } if (watcher->result().isNull()) { // do not load empty script deleteLater(); watcher->deleteLater(); return; } QScriptValue optionsValue = m_engine->newQObject(options, QScriptEngine::QtOwnership, QScriptEngine::ExcludeSuperClassContents | QScriptEngine::ExcludeDeleteLater); m_engine->globalObject().setProperty(QStringLiteral("options"), optionsValue, QScriptValue::Undeletable); m_engine->globalObject().setProperty(QStringLiteral("QTimer"), constructTimerClass(m_engine)); QObject::connect(m_engine, SIGNAL(signalHandlerException(QScriptValue)), this, SLOT(sigException(QScriptValue))); KWin::MetaScripting::supplyConfig(m_engine); installScriptFunctions(m_engine); QScriptValue ret = m_engine->evaluate(QString::fromUtf8(watcher->result())); if (ret.isError()) { sigException(ret); deleteLater(); } watcher->deleteLater(); setRunning(true); m_starting = false; }
void NetworkService::stop() { //throw (NetworkException*) { if (log->isInfo()) log->info("Shutting down the network service"); if (!_running) { throw new NetworkException(new string("The network service is not running. Try starting it first")); } if (processing > 0) { cout << "Stop requested but still working" << endl; } int i = 0; while (processing > 0) { Thread::sleep(1000); i++; // if the time exceeded then shutdown anyway if (i > 10) { break; } } __dbController->shutdown(); setRunning(false); #ifndef WINDOWS int res = close(sock); #else int res = closesocket(sock); #endif if (res != 0) { log->error("The close method returned: " + toString(res)); } m_thread->join(); if (m_thread) delete(m_thread); }
UsbWidget::UsbWidget(QWidget *parent,bool autostart) : QWidget(parent), handle(NULL), old_buffer(NULL) { QSettings settings; usb_init(); setLayout(new QVBoxLayout(this)); button = new QPushButton("Start Device",this); button->setCheckable(true); connect(button,SIGNAL( clicked(bool) ),this,SLOT( setRunning(bool) )); layout()->addWidget(button); intensity = new QSlider(Qt::Horizontal,this); intensity->setRange(0,0x0f); intensity->setValue(settings.value("usb/intensity",7).toInt()); connect(intensity,SIGNAL( valueChanged(int) ),this,SLOT( setIntensity(int) )); connect(button,SIGNAL( clicked(bool) ),intensity,SLOT( setEnabled(bool) )); layout()->addWidget(intensity); status = new QLabel("Device status",this); layout()->addWidget(status); pool_timer = new QTimer(this); connect(pool_timer,SIGNAL( timeout() ),this,SLOT( update() )); pool_timer->setInterval( 10 ); dynamic_cast<QBoxLayout*>(layout())->addStretch(1); old_buffer = new unsigned char[8]; for (int k=0; k<8; k++) old_buffer[k] = 0; if ( autostart ) { button->setChecked(true); setRunning(true); } }
void SettingsMenu::doSave() { auto settings = Game::getInstance()->settings(); settings->setCombatDifficulty(((UI::MultistateImageButton*)getUI("combat_difficulty"))->state()); settings->setGameDifficulty(((UI::MultistateImageButton*)getUI("game_difficulty"))->state()); settings->setViolenceLevel(((UI::MultistateImageButton*)getUI("violence_level"))->state()); settings->setTargetHighlight(((UI::MultistateImageButton*)getUI("target_highlight"))->state()); settings->setCombatLooks(((UI::MultistateImageButton*)getUI("combat_looks"))->state()); settings->setCombatMessages(((UI::MultistateImageButton*)getUI("combat_messages"))->state()); settings->setCombatTaunts(((UI::MultistateImageButton*)getUI("combat_taunts"))->state()); settings->setLanguageFilter(((UI::MultistateImageButton*)getUI("language_filter"))->state()); settings->setRunning(((UI::MultistateImageButton*)getUI("running"))->state()); settings->setSubtitles(((UI::MultistateImageButton*)getUI("subtitles"))->state()); settings->setItemHighlight(((UI::MultistateImageButton*)getUI("item_highlight"))->state()); settings->setMasterVolume(((UI::Slider*)getUI("master_volume"))->value()); settings->setMusicVolume(((UI::Slider*)getUI("music_volume"))->value()); settings->setVoiceVolume(((UI::Slider*)getUI("voice_volume"))->value()); settings->setSfxVolume(((UI::Slider*)getUI("sfx_volume"))->value()); settings->setTextDelay(((UI::Slider*)getUI("text_delay"))->value()); settings->setCombatSpeed(((UI::Slider*)getUI("combat_speed"))->value()); settings->setBrightness(((UI::Slider*)getUI("brightness"))->value()); settings->setMouseSensitivity(((UI::Slider*)getUI("mouse_sensitivity"))->value()); settings->setPlayerSpeedup(((UI::ImageButton*)getUI("player_speedup"))->checked()); settings->save(); Game::getInstance()->popState(); }
Level::Level() { setWindow(); setRenderer(); setRunning(); initObjects(); setObjects(); }
void beginSession(const std::string& rVersion, const std::string& rVersionHome) { setLastUsed(); setRunning(true); setRVersion(rVersion, rVersionHome); }
void ScriptEditorWidget::onWindowActivated() { if (!_isReloading) { _isReloading = true; QDateTime fileStamp = QFileInfo(_currentScript).lastModified(); if (fileStamp > _currentScriptModified) { bool doReload = false; auto window = static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent()); window->inModalDialog = true; if (window->autoReloadScripts() || OffscreenUi::question(this, tr("Reload Script"), tr("The following file has been modified outside of the Interface editor:") + "\n" + _currentScript + "\n" + (isModified() ? tr("Do you want to reload it and lose the changes you've made in the Interface editor?") : tr("Do you want to reload it?")), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { doReload = true; } window->inModalDialog = false; if (doReload) { loadFile(_currentScript); if (_scriptEditorWidgetUI->onTheFlyCheckBox->isChecked() && isRunning()) { _isRestarting = true; setRunning(false); // Script is restarted once current script instance finishes. } } else { _currentScriptModified = fileStamp; // Asked and answered. Don't ask again until the external file is changed again. } } _isReloading = false; } }
void ScriptEditorWidget::onScriptModified() { if(_scriptEditorWidgetUI->onTheFlyCheckBox->isChecked() && isModified() && isRunning() && !_isReloading) { _isRestarting = true; setRunning(false); // Script is restarted once current script instance finishes. } }
// TODO: handle ANIMATE_INTERRUPT void Opcode80CE::_run() { Logger::debug("SCRIPT") << "[80CE] [=] void animate_move_obj_to_tile(void* who, int tile, int speed)" << std::endl; int speed = _script->dataStack()->popInteger(); int tile = _script->dataStack()->popInteger(); auto object = _script->dataStack()->popObject(); // ANIMATE_WALK (0) // ANIMATE_RUN (1) // ANIMATE_INTERRUPT (16) - flag to interrupt current animation auto critter = dynamic_cast<Game::CritterObject*>(object); auto state = Game::Game::getInstance()->locationState(); if (state) { auto tileObj = state->hexagonGrid()->at(tile); auto path = state->hexagonGrid()->findPath(object->hexagon(), tileObj); if (path.size()) { critter->stopMovement(); critter->setRunning((speed & 1) != 0); auto queue = critter->movementQueue(); for (auto pathHexagon : path) { queue->push_back(pathHexagon); } } } }
IntroScene::IntroScene() { setWindow(); setRenderer(); setRunning(); initObjects(); setObjects(); }
/* Method for starting this service */ Service::Status ServerService::start() { setStatus(Service::OK); setRunning(true); return Service::OK; }
bool InputService::start() { if (!mInput.get()) { mInput = std::unique_ptr<Input>(new Input()); } setRunning(true); return true; }
void KWin::DeclarativeScript::createComponent() { if (m_component->isError()) { kDebug(1212) << "Component failed to load: " << m_component->errors(); } else { m_scene->addItem(qobject_cast<QDeclarativeItem*>(m_component->create())); } setRunning(true); }
void QDeclarativeBluetoothDiscoveryModel::errorDeviceDiscovery(QBluetoothDeviceDiscoveryAgent::Error error) { d->m_error = static_cast<QDeclarativeBluetoothDiscoveryModel::Error>(error); emit errorChanged(); //QBluetoothDeviceDiscoveryAgent::finished() signal is not emitted in case of an error //Note that this behavior is different from QBluetoothServiceDiscoveryAgent. //This reset the models running flag. setRunning(false); }
BusyWidget::BusyWidget(Plasma::PopupApplet* parent) : Plasma::BusyWidget(parent), m_svg(new Plasma::Svg(this)) { setAcceptsHoverEvents(true); m_svg->setImagePath("icons/notification"); m_svg->setContainsMultipleImages(true); setRunning(false); }