FOSSredder 0.5.0
Loading...
Searching...
No Matches
ui::ActorViewModel Class Reference

Owns editable actor UI state and delegates actor CRUD to workspace. More...

#include <ActorViewModel.h>

Inheritance diagram for ui::ActorViewModel:
Collaboration diagram for ui::ActorViewModel:

Signals

void changed ()
 Emitted when actor view model state changed.

Public Member Functions

 ActorViewModel (WorkspaceStore *store, WorkspaceCommands *commands, WorkspaceSelection *selection, WorkspaceSelectors *selectors, QObject *parent=nullptr)
 Creates the actor view model bound to workspace roles.
QString currentId () const
 Returns the currently selected actor id.
QString name () const
 Returns the editable actor name.
void setName (const QString &value)
 Updates the editable actor name.
QVariantList aliases () const
 Returns editable actor aliases.
void setAliases (const QVariantList &value)
 Replaces editable actor aliases.
QString aliasInputText () const
 Returns the current alias input text.
void setAliasInputText (const QString &value)
 Updates the current alias input text.
int aliasIndex () const
 Returns the selected alias index.
void setAliasIndex (int value)
 Updates the selected alias index.
QVariantList selectedContractIds () const
 Returns selected contract ids in the actor form.
void setSelectedContractIds (const QVariantList &value)
 Replaces selected contract ids in the actor form.
bool isEdit () const
 Checks whether the form edits an existing actor.
bool hasChanges () const
 Checks whether the editable form differs from the loaded actor.
bool canSubmit () const
 Checks whether the form has enough UI data to submit.
QVariantList actorRows () const
 Returns actor sidebar rows.
QVariantList contractRows () const
 Returns selectable contract rows for the actor form.
Q_INVOKABLE void selectActor (const QString &id)
 Selects an actor for editing.
Q_INVOKABLE bool canAddAlias (const QString &value) const
 Checks whether an alias value can be added to the form.
Q_INVOKABLE void addAlias (const QString &value)
 Adds an alias to the actor form.
Q_INVOKABLE void requestRemoveSelectedAlias ()
 Removes the currently selected alias when possible.
Q_INVOKABLE void enterCreateMode ()
 Clears selection and opens an empty create form.
Q_INVOKABLE void previous ()
 Selects the previous actor row.
Q_INVOKABLE void next ()
 Selects the next actor row.
Q_INVOKABLE QString submit ()
 Creates or updates the actor through workspace commands.
Q_INVOKABLE void deleteCurrent ()
 Deletes the selected actor through workspace commands.
Q_INVOKABLE void clear ()
 Clears the editable actor form.
Q_INVOKABLE void setContractSelected (const QString &contractId, bool selected)
 Adds or removes a contract id from the actor form selection.

Properties

QString currentId
QString name
QVariantList aliases
QString aliasInputText
int aliasIndex
QVariantList selectedContractIds
QVariantList actorRows
QVariantList contractRows
bool isEdit
bool hasChanges
bool canSubmit

Detailed Description

Owns editable actor UI state and delegates actor CRUD to workspace.

Definition at line 24 of file ActorViewModel.h.

Constructor & Destructor Documentation

◆ ActorViewModel()

ui::ActorViewModel::ActorViewModel ( WorkspaceStore * store,
WorkspaceCommands * commands,
WorkspaceSelection * selection,
WorkspaceSelectors * selectors,
QObject * parent = nullptr )
explicit

Creates the actor view model bound to workspace roles.

Parameters
parentOptional QObject parent.

Definition at line 260 of file ActorViewModel.cpp.

Member Function Documentation

◆ actorRows()

QVariantList ui::ActorViewModel::actorRows ( ) const

Returns actor sidebar rows.

Returns
QML-ready actor rows from workspace selectors.

Definition at line 428 of file ActorViewModel.cpp.

◆ addAlias()

void ui::ActorViewModel::addAlias ( const QString & value)

Adds an alias to the actor form.

Parameters
valueAlias text to add.

Definition at line 337 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ aliases()

QVariantList ui::ActorViewModel::aliases ( ) const
inline

Returns editable actor aliases.

Returns
Current alias list.

Definition at line 71 of file ActorViewModel.h.

◆ aliasIndex()

int ui::ActorViewModel::aliasIndex ( ) const
inline

Returns the selected alias index.

Returns
Selected alias index, or -1 when no alias is selected.

Definition at line 95 of file ActorViewModel.h.

◆ aliasInputText()

QString ui::ActorViewModel::aliasInputText ( ) const
inline

Returns the current alias input text.

Returns
Current alias input text.

Definition at line 83 of file ActorViewModel.h.

◆ canAddAlias()

bool ui::ActorViewModel::canAddAlias ( const QString & value) const

Checks whether an alias value can be added to the form.

Parameters
valueAlias text to inspect.
Returns
true when the alias text is not blank.

Definition at line 329 of file ActorViewModel.cpp.

◆ canSubmit()

bool ui::ActorViewModel::canSubmit ( ) const

Checks whether the form has enough UI data to submit.

Returns
true when the actor name field is not blank.

Definition at line 317 of file ActorViewModel.cpp.

◆ changed

void ui::ActorViewModel::changed ( )
signal

Emitted when actor view model state changed.

Here is the caller graph for this function:

◆ clear()

void ui::ActorViewModel::clear ( )

Clears the editable actor form.

Definition at line 410 of file ActorViewModel.cpp.

◆ contractRows()

QVariantList ui::ActorViewModel::contractRows ( ) const

Returns selectable contract rows for the actor form.

Returns
QML-ready contract rows from workspace selectors.

Definition at line 432 of file ActorViewModel.cpp.

◆ currentId()

QString ui::ActorViewModel::currentId ( ) const

Returns the currently selected actor id.

Returns
Selected actor id, or an empty string in create mode.

Definition at line 424 of file ActorViewModel.cpp.

◆ deleteCurrent()

void ui::ActorViewModel::deleteCurrent ( )

Deletes the selected actor through workspace commands.

Definition at line 397 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ enterCreateMode()

void ui::ActorViewModel::enterCreateMode ( )

Clears selection and opens an empty create form.

Definition at line 352 of file ActorViewModel.cpp.

◆ hasChanges()

bool ui::ActorViewModel::hasChanges ( ) const

Checks whether the editable form differs from the loaded actor.

Returns
true when the create form is submittable or an edit changed.

Definition at line 321 of file ActorViewModel.cpp.

◆ isEdit()

bool ui::ActorViewModel::isEdit ( ) const

Checks whether the form edits an existing actor.

Returns
true when an actor id is selected.

Definition at line 313 of file ActorViewModel.cpp.

◆ name()

QString ui::ActorViewModel::name ( ) const
inline

Returns the editable actor name.

Returns
Current form name.

Definition at line 59 of file ActorViewModel.h.

◆ next()

void ui::ActorViewModel::next ( )

Selects the next actor row.

Definition at line 368 of file ActorViewModel.cpp.

◆ previous()

void ui::ActorViewModel::previous ( )

Selects the previous actor row.

Definition at line 359 of file ActorViewModel.cpp.

◆ requestRemoveSelectedAlias()

void ui::ActorViewModel::requestRemoveSelectedAlias ( )

Removes the currently selected alias when possible.

Definition at line 344 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ selectActor()

void ui::ActorViewModel::selectActor ( const QString & id)

Selects an actor for editing.

Parameters
idActor id selected by the QML sidebar.

Definition at line 442 of file ActorViewModel.cpp.

◆ selectedContractIds()

QVariantList ui::ActorViewModel::selectedContractIds ( ) const
inline

Returns selected contract ids in the actor form.

Returns
Selected contract ids.

Definition at line 107 of file ActorViewModel.h.

◆ setAliases()

void ui::ActorViewModel::setAliases ( const QVariantList & value)

Replaces editable actor aliases.

Parameters
valueNew alias list.

Definition at line 278 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ setAliasIndex()

void ui::ActorViewModel::setAliasIndex ( int value)

Updates the selected alias index.

Parameters
valueNew selected alias index.

Definition at line 297 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ setAliasInputText()

void ui::ActorViewModel::setAliasInputText ( const QString & value)

Updates the current alias input text.

Parameters
valueNew alias input text.

Definition at line 289 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ setContractSelected()

void ui::ActorViewModel::setContractSelected ( const QString & contractId,
bool selected )

Adds or removes a contract id from the actor form selection.

Parameters
contractIdContract id to toggle.
selectedWhether the contract should be selected.

Definition at line 416 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ setName()

void ui::ActorViewModel::setName ( const QString & value)

Updates the editable actor name.

Parameters
valueNew form name.

Definition at line 270 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ setSelectedContractIds()

void ui::ActorViewModel::setSelectedContractIds ( const QVariantList & value)

Replaces selected contract ids in the actor form.

Parameters
valueNew selected contract ids.

Definition at line 305 of file ActorViewModel.cpp.

Here is the call graph for this function:

◆ submit()

QString ui::ActorViewModel::submit ( )

Creates or updates the actor through workspace commands.

Returns
Saved actor id, or an empty string when submission fails.

Definition at line 377 of file ActorViewModel.cpp.

Here is the call graph for this function:

Property Documentation

◆ actorRows

QVariantList ui::ActorViewModel::actorRows
read

Definition at line 34 of file ActorViewModel.h.

◆ aliases

QVariantList ui::ActorViewModel::aliases
readwrite

Definition at line 28 of file ActorViewModel.h.

◆ aliasIndex

int ui::ActorViewModel::aliasIndex
readwrite

Definition at line 31 of file ActorViewModel.h.

◆ aliasInputText

QString ui::ActorViewModel::aliasInputText
readwrite

Definition at line 29 of file ActorViewModel.h.

◆ canSubmit

bool ui::ActorViewModel::canSubmit
read

Definition at line 38 of file ActorViewModel.h.

◆ contractRows

QVariantList ui::ActorViewModel::contractRows
read

Definition at line 35 of file ActorViewModel.h.

◆ currentId

QString ui::ActorViewModel::currentId
read

Definition at line 26 of file ActorViewModel.h.

◆ hasChanges

bool ui::ActorViewModel::hasChanges
read

Definition at line 37 of file ActorViewModel.h.

◆ isEdit

bool ui::ActorViewModel::isEdit
read

Definition at line 36 of file ActorViewModel.h.

◆ name

QString ui::ActorViewModel::name
readwrite

Definition at line 27 of file ActorViewModel.h.

◆ selectedContractIds

QVariantList ui::ActorViewModel::selectedContractIds
read

Definition at line 32 of file ActorViewModel.h.


The documentation for this class was generated from the following files: