void taskBroker::update() { //check if current task is completed and delay has passed float curTime = ofGetElapsedTimef(); // we are running as long as we have a pointer to a task if (currentTask) { if (!currentTask->correspondingWindow) { ofLogError("correspondingWindow is NULL"); } else { // check if window is activated and save timestamp if ( currentTask->windowActiveTime < 1.0f && currentTask->correspondingWindow->active ) { currentTask->windowActiveTime = curTime; } // check for if completed (endTime = 0 at start!) if ( currentTask->correspondingWindow->taskCompleted ) { currentTask->endTime = curTime; determineResult(); resetTaskWindow(); saveCurrentTask(); } //check for timeout else if (currentTask->startTime + currentTask->timeOut < curTime ) { ofLogVerbose() << "task timeout " << currentTask->identifier; currentTask->endTime = curTime; currentTask->windowActiveTime = curTime; currentTask->result = blenderTask::TIMEOUT; resetTaskWindow(); saveCurrentTask(); } } } else if (nextTaskDeparture < curTime ) { if (blenderWindow::operatorActive ) { // an operator is still active so determine new moment for next task determineNextTaskDeparture(); } else { newTask(); } } }
} void MainWindow::disableGames() { disconnect( this, SIGNAL(postQuestion(QObject*)), d->m_countryByShape, SLOT(postQuestion(QObject*)) ); disconnect( this, SIGNAL(postQuestion(QObject*)), d->m_countryByFlag, SLOT(postQuestion(QObject*)) ); disconnect( this, SIGNAL(postQuestion(QObject*)), d->m_clickOnThat, SLOT(postQuestion(QObject*)) ); disconnect( d->m_clickOnThat, SIGNAL(updateResult(bool)), this, SLOT(displayResult(bool)) ); disconnect( d->m_marbleWidget, SIGNAL(highlightedPlacemarksChanged(qreal,qreal,GeoDataCoordinates::Unit)), d->m_clickOnThat, SLOT(determineResult(qreal,qreal,GeoDataCoordinates::Unit)) ); d->m_clickOnThat->disablePinDocument(); // Reset the map view d->m_marbleWidget->centerOn( 23.0, 42.0 ); d->m_marbleWidget->setDistance( 7500 ); } void MainWindow::enableCountryShapeGame() { connect( this, SIGNAL(postQuestion(QObject*)), d->m_countryByShape, SLOT(postQuestion(QObject*)) ); d->m_countryByShape->initiateGame(); }