|
wiRedPanda
Logic Circuit Simulator
|
Owns the id/title/step-list/progress state machine shared by ExerciseEngine and TourEngine, and the JSON resource-loading logic that builds it.
More...
#include <StepEngineCore.h>
Classes | |
| struct | AdvanceResult |
| Result of advance(): tells the owning engine what to emit next. More... | |
| struct | Persistence |
The four Settings::* functions each engine persists progress/completion through. More... | |
Public Types | |
| using | FillStep = void (*)(const QString &id, const QJsonObject &stepObj, StepType &step) |
Public Member Functions | |
| AdvanceResult | advance () |
| int | currentStep () const |
| const StepType & | currentStepData () const |
| bool | goToPreviousStep () |
| QString | id () const |
| bool | isActive () const |
| bool | loadFromResource (const QString &resourcePath) |
| void | markCompleted () |
| bool | retranslate () |
| bool | start () |
| StepEngineCore (FillStep fillStep, Persistence persistence) | |
| bool | stop () |
| QString | title () const |
| int | totalSteps () const |
Owns the id/title/step-list/progress state machine shared by ExerciseEngine and TourEngine, and the JSON resource-loading logic that builds it.
Not a QObject: Qt's moc cannot process a templated QObject that declares signals, so ExerciseEngine/ own a TourEngine eachStepEngineCore<StepType> member and translate its return values into their own class-specific emit calls (different stepChanged payload types, and ExerciseEngine's extra stepCompleted signal / Scene-validation subsystem, which this core knows nothing about). StepType is ExerciseStep or TourStep; fillStep and persistence are supplied once at construction (see each engine's constructor) since they're fixed per concrete engine type, not per call.
Definition at line 34 of file StepEngineCore.h.
| using StepEngineCore< StepType >::FillStep = void (*)(const QString &id, const QJsonObject &stepObj, StepType &step) |
Fills step's type-specific fields from stepObj (one entry of the JSON "steps" array); id is the resource's id, for building translation catalog keys.
Definition at line 39 of file StepEngineCore.h.
|
inline |
Definition at line 56 of file StepEngineCore.h.
|
inline |
Advances one step, persisting the new position; see AdvanceResult for how the caller should react.
Definition at line 148 of file StepEngineCore.h.
|
inline |
Definition at line 206 of file StepEngineCore.h.
|
inline |
Definition at line 195 of file StepEngineCore.h.
|
inline |
Steps back one, persisting the new position. Returns true if it moved (caller should emit its stepChanged-equivalent signal).
Definition at line 136 of file StepEngineCore.h.
|
inline |
Definition at line 204 of file StepEngineCore.h.
|
inline |
Definition at line 208 of file StepEngineCore.h.
|
inline |
Loads resourcePath (a Qt resource path) and rebuilds id/title/step list from it. Resets active/current-step state; the caller decides whether to (re)activate.
Definition at line 64 of file StepEngineCore.h.
References ExerciseTourResources::translate().
Referenced by retranslate().
|
inline |
Deactivates, records completion, and resets persisted progress. Caller still owns any Scene disconnection and its own completed signal.
Definition at line 183 of file StepEngineCore.h.
|
inline |
Reloads the current resource (picking up any language change) while preserving the current step position and active state. No-op if never loaded or inactive. Returns true if it retranslated (caller should emit its retranslated signal).
Definition at line 165 of file StepEngineCore.h.
References loadFromResource().
|
inline |
Activates the engine at its persisted progress (clamped to a valid step). No-op if there are no steps. Returns true if activation happened (caller should emit its stepChanged-equivalent signal).
Definition at line 110 of file StepEngineCore.h.
|
inline |
Deactivates the engine. Returns true if it was active (caller should emit its stopped signal); false if it was already inactive.
Definition at line 125 of file StepEngineCore.h.
|
inline |
Definition at line 205 of file StepEngineCore.h.
|
inline |
Definition at line 207 of file StepEngineCore.h.