void ModeControlEntity::_activeStateChanged(const bool inactive) { if(m_inactive != inactive) { m_inactive = inactive; emit activeStateChanged(); } }
void Action::setActive(bool state) { if (state != m_active) { m_active = state; emit activeStateChanged(); } }
/*! Sets \a state, which must either be part of this group or 0, to be the active state in this group. If \a state is 0, any active state is deactivated, and if the group has a default state, the default state is automatically activated. Calling this function is equivalent to calling QtState::setActive() on one of the states in the group. \sa activeState(), defaultState() */ void QtStateGroup::setActiveState(QtState *state) { Q_D(QtStateGroup); if (state && state->group() != this) { qWarning("QtStateGroup::setActiveState: state %p belongs" " to group %p; it is not" " part of this group %p", state, state->group(), this); return; } if (state == d->activeState) return; if (!state && d->defaultState) state = d->defaultState; QtState *lastState = d->activeState; d->activeState = state; if (lastState) { lastState->d_func()->active = false; lastState->leaveState(state); emit lastState->deactivated(); emit lastState->activated(false); } if (state && !state->isActive()) { // Only enter if the state isn't already active. The user might set // the state as active, then add it to the group, in which case // there's nothing we need to do. state->d_func()->active = true; state->enterState(lastState); emit state->activated(); emit state->activated(true); } emit activeStateChanged(state); }
void ContextPrivate::setActive(bool pActive) { if( mActive == pActive ) { return; } mActive = pActive; emit activeStateChanged( mActive ); }
WorkflowState* WorkflowStateMachine::newState(WorkflowState* state) { RequestEnterStateTransition* transToState = new RequestEnterStateTransition(state->getUid()); transToState->setTargetState(state); mParentState->addTransition(transToState); connect(state, SIGNAL(entered()), this, SIGNAL(activeStateChanged())); mStates[state->getUid()] = state; connect(state, SIGNAL(aboutToExit()), this, SIGNAL(activeStateAboutToChange())); return state; }
const bool PriorityMuxer::setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms) { if(!_activeInputs.contains(priority)) { Error(_log,"setInputImage() used without registerInput() for priority '%d', probably the priority reached timeout",priority); return false; } // calc final timeout if(timeout_ms > 0) timeout_ms = QDateTime::currentMSecsSinceEpoch() + timeout_ms; InputInfo& input = _activeInputs[priority]; // detect active <-> inactive changes bool activeChange = false; bool active = true; if(input.timeoutTime_ms == -100 && timeout_ms != -100) { activeChange = true; } else if(timeout_ms == -100 && input.timeoutTime_ms != -100) { active = false; activeChange = true; } // update input input.timeoutTime_ms = timeout_ms; input.image = image; // emit active change if(activeChange) { Debug(_log, "Priority %d is now %s", priority, active ? "active" : "inactive"); emit activeStateChanged(priority, active); setCurrentTime(); } return true; }