| 247 | } |
| 248 | |
| 249 | void StateMachineViewerServer::addState(State state) |
| 250 | { |
| 251 | if (!selectedStateMachine()->stateValid(state)) |
| 252 | return; |
| 253 | |
| 254 | if (!mayAddState(state)) |
| 255 | return; |
| 256 | |
| 257 | Q_ASSERT(!m_recursionGuard.contains(state)); |
| 258 | m_recursionGuard.append(state); |
| 259 | |
| 260 | State parentState = selectedStateMachine()->parentState(state); |
| 261 | addState(parentState); // be sure that parent is added first |
| 262 | |
| 263 | const bool hasChildren = !selectedStateMachine()->stateChildren(state).isEmpty(); |
| 264 | const QString &label = selectedStateMachine()->stateLabel(state); |
| 265 | // add a connection from parent state to initial state if |
| 266 | // parent state is valid and parent state has an initial state |
| 267 | const bool connectToInitial = parentState && selectedStateMachine()->isInitialState(state); |
| 268 | StateType type = selectedStateMachine()->stateType(state); |
| 269 | |
| 270 | emit stateAdded(StateId(state), StateId(parentState), |
| 271 | hasChildren, label, type, connectToInitial); |
| 272 | |
| 273 | // add outgoing transitions |
| 274 | Q_FOREACH (auto transition, selectedStateMachine()->stateTransitions(state)) { |
| 275 | addTransition(transition); |
| 276 | } |
| 277 | |
| 278 | // add sub-states |
| 279 | Q_FOREACH (auto childState, selectedStateMachine()->stateChildren(state)) { |
| 280 | addState(childState); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | void StateMachineViewerServer::addTransition(Transition transition) |
| 285 | { |
nothing calls this directly
no test coverage detected