#include <WizardEngine.hpp>
|
enum class | Stage {
BasicChoice
, CreateRoot
, OpenHierarchy
, ConstructHierarchy
,
SaveHierarchy
} |
|
|
Item * | _current |
|
bool | _dirty |
|
QString | _filepath |
|
int | _firstPropertyIndex |
|
int | _lastPropertyIndex |
|
NameManager | _nameMgr |
|
bool | _openExisting |
|
bool | _propertyValid |
|
std::unique_ptr< Item > | _root |
|
std::unique_ptr< SchemaDef > | _schema |
|
string | _schemaName |
|
Stage | _stage |
|
std::stack< size_t > | _stateIndexStack |
|
std::stack< State > | _stateStack |
|
int | _subItemIndex |
|
The WizardEngine class implements the back end of the wizard through which users can create and edit SMILE datasets. The MainWindow creates a single WizardEngine instance. This WizardEngine object manages the dataset under construction, keeps track of the wizard's state (i.e. which question should currently be displayed), allowing it to advance and retreat, and generates the user interface pane corresponding to the current state.
◆ WizardEngine()
WizardEngine::WizardEngine |
( |
QObject * |
parent | ) |
|
|
explicit |
The default (and only) constructor places the WizardEngine in its initial state, corresponding to the question "what would you like to do".
◆ ~WizardEngine()
WizardEngine::~WizardEngine |
( |
| ) |
|
The destructor deallocates the dataset under construction and releases any other resources being held.
◆ advance
void WizardEngine::advance |
( |
bool |
state = true , |
|
|
bool |
descend = true |
|
) |
| |
|
slot |
This function advances the wizard to the next state. It should only be called if canAdvance() returns true. Th optional flags are used for recursive calls. If state is set to false, the current advance state is not saved. If descend is set to false, the function will not descend into the current compound property.
◆ advanceToEditSubItem
void WizardEngine::advanceToEditSubItem |
( |
int |
subItemIndex | ) |
|
|
slot |
This function advances the wizard to a state that starts editing the specified item in the current item list property.
◆ canAdvance()
bool WizardEngine::canAdvance |
( |
| ) |
|
This function returns true if the wizard can currently advance; false otherwise.
◆ canAdvanceChangedTo
void WizardEngine::canAdvanceChangedTo |
( |
bool |
canAdvance | ) |
|
|
signal |
This signal is emitted when the return value of the canAdvance() function may have changed. The argument specifies the new value.
◆ canRetreat()
bool WizardEngine::canRetreat |
( |
| ) |
|
This function returns true if the wizard can currently retreat; false otherwise.
◆ canRetreatChangedTo
void WizardEngine::canRetreatChangedTo |
( |
bool |
canRetreat | ) |
|
|
signal |
This signal is emitted when the return value of the canRetreat() function may have changed. The argument specifies the new value.
◆ createPane()
QWidget * WizardEngine::createPane |
( |
| ) |
|
This function creates a fresh QWidget object corresponding to the current wizard state, returns a pointer to it, and transfers ownership to the caller. The QWidget has no parent, but is otherwise fully equipped to handle the keyboard and mouse events for any UI elements it contains. For example, the UI elements are equipped so that they can properly update the corresponding portion of the dataset under construction.
◆ createPropertyHandler()
std::unique_ptr< PropertyHandler > WizardEngine::createPropertyHandler |
( |
int |
propertyIndex | ) |
|
|
private |
This function creates and returns a unique pointer to a property handler for the property of the current item with the specified property index. The function does not check whether the property index is within range.
◆ dirtyChanged
void WizardEngine::dirtyChanged |
( |
| ) |
|
|
signal |
This signal is emitted when the dirty state of the current dataset has changed.
◆ emitStateChanged()
void WizardEngine::emitStateChanged |
( |
| ) |
|
◆ filepath()
QString WizardEngine::filepath |
( |
| ) |
|
This function returns the path of the file to which the current dataset has already been saved (although it may have changed since then), or the empty string if it has never been saved.
◆ hierarchyPath()
QString WizardEngine::hierarchyPath |
( |
| ) |
|
This function returns a human-readable description of the path to the property currently being handled in the dataset.
◆ hierarchyWasChanged
void WizardEngine::hierarchyWasChanged |
( |
| ) |
|
|
slot |
This function sets the dirty flag.
◆ hierarchyWasLoaded
void WizardEngine::hierarchyWasLoaded |
( |
Item * |
root, |
|
|
QString |
filepath |
|
) |
| |
|
slot |
This function deletes the current dataset (if present), and replaces it by the new dataset specified through it root item. The function adopts ownership for specified dataset. This function further clears the dirty flag and remembers the filepath from which the dataset was loaded.
◆ hierarchyWasSaved
void WizardEngine::hierarchyWasSaved |
( |
QString |
filepath | ) |
|
|
slot |
This function clears the dirty flag and remembers the filepath in which the dataset was saved.
◆ isDirty()
bool WizardEngine::isDirty |
( |
| ) |
|
This function returns true if the wizard currently holds unsaved information; false otherwise.
◆ propertyIndexForChild()
int WizardEngine::propertyIndexForChild |
( |
Item * |
child | ) |
|
|
private |
This function returns the property index for the specified child item in its parent item, or -1 if the specified child item does not have a parent or if it is not a child of its parent (which should never happen). The result does not depend on the evaluation of conditional expressions against the current name sets.
◆ restartWizard
void WizardEngine::restartWizard |
( |
| ) |
|
|
slot |
This function intializes the state of the wizard as if it has just been started, and causes the basic choice pane to be shown.
◆ retreat
void WizardEngine::retreat |
( |
| ) |
|
|
slot |
This function retreats the wizard to the previous state. It should only be called if canRetreat() returns true.
◆ schema()
This function returns a pointer to the schema definition for the current dataset (without transfer of ownership), or the null pointer if no dataset has yet been opened or created.
◆ setBasicChoice
void WizardEngine::setBasicChoice |
( |
bool |
openExisting, |
|
|
string |
libraryPath, |
|
|
string |
schemaName |
|
) |
| |
|
slot |
This function updates the basic choice to the specified values.
◆ setPropertyValid
void WizardEngine::setPropertyValid |
( |
bool |
valid | ) |
|
|
slot |
This function updates the flag that indicates whether the value of the property currently being handled is valid.
◆ setRootType
void WizardEngine::setRootType |
( |
string |
newRootType | ) |
|
|
slot |
If the current root does not have the specified type (or if there is no current root), this function deletes the current dataset (if present), and replaces it by a newly created root item of the specified type. If the current root already has the specified type, this function does nothing.
◆ stateChanged
void WizardEngine::stateChanged |
( |
| ) |
|
|
signal |
This signal is emitted when the state of the wizard has changed.
◆ titleChanged
void WizardEngine::titleChanged |
( |
| ) |
|
|
signal |
This signal is emitted when the filename in which the current dataset was saved has changed.
The documentation for this class was generated from the following file: