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

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

#include <ContractViewModel.h>

Inheritance diagram for ui::ContractViewModel:
Collaboration diagram for ui::ContractViewModel:

Signals

void changed ()

Public Member Functions

 ContractViewModel (WorkspaceStore *store, WorkspaceCommands *commands, WorkspaceSelection *selection, WorkspaceSelectors *selectors, QObject *parent=nullptr)
 Creates the contract view model bound to workspace roles.
QString currentId () const
 Returns the currently selected contract id.
QString name () const
 Returns the editable contract name.
void setName (const QString &value)
 Updates the editable contract name.
QVariantList aliases () const
 Returns editable contract aliases.
void setAliases (const QVariantList &value)
 Replaces editable contract 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.
QString type () const
 Returns the editable contract type.
void setType (const QString &value)
 Updates the editable contract type.
QString allocatableMode () const
 Returns the editable allocatable mode.
void setAllocatableMode (const QString &value)
 Updates the editable allocatable mode.
QVariantList selectedActorIds () const
 Returns selected actor ids for this contract.
void setSelectedActorIds (const QVariantList &value)
 Replaces selected actor ids for this contract.
QVariantList selectedPropertyIds () const
 Returns selected property ids for this contract.
void setSelectedPropertyIds (const QVariantList &value)
 Replaces selected property ids for this contract.
QVariantList actorDisplayRows () const
 Returns actor rows with an empty entry for the primary actor combo.
QVariantList contractRows () const
 Returns contract sidebar rows.
QVariantList propertyRows () const
 Returns property rows for the contract property selector.
int selectedActorIndex () const
 Returns the selected primary actor combo index.
bool isEdit () const
 Reports whether the form edits an existing contract.
bool hasChanges () const
 Reports whether the editable fields differ from saved state.
bool canSubmit () const
 Reports whether the current form can be submitted.
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 contract form.
Q_INVOKABLE void requestRemoveSelectedAlias ()
 Removes the currently selected alias when possible.
Q_INVOKABLE void clear ()
 Clears the current contract form without changing workspace data.
Q_INVOKABLE void enterCreateMode ()
 Enters create mode and clears the contract form.
Q_INVOKABLE void selectContract (const QString &id)
 Selects a contract for editing.
Q_INVOKABLE void selectPrimaryActor (const QString &actorId)
 Selects the primary actor for the contract.
Q_INVOKABLE void setPropertySelected (const QString &propertyId, bool selected)
 Toggles a property link in the current form.
Q_INVOKABLE void previous ()
 Selects the previous contract row.
Q_INVOKABLE void next ()
 Selects the next contract row.
Q_INVOKABLE QString submit ()
 Creates or updates the current contract through workspace commands.
Q_INVOKABLE void deleteCurrent ()
 Deletes the selected contract through workspace commands.

Properties

QString currentId
QString name
QString type
QString allocatableMode
QVariantList aliases
QString aliasInputText
int aliasIndex
QVariantList selectedActorIds
QVariantList selectedPropertyIds
QVariantList actorDisplayRows
QVariantList contractRows
QVariantList propertyRows
int selectedActorIndex
bool isEdit
bool hasChanges
bool canSubmit

Detailed Description

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

Definition at line 24 of file ContractViewModel.h.

Constructor & Destructor Documentation

◆ ContractViewModel()

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

Creates the contract view model bound to workspace roles.

Parameters
parentOptional QObject parent.

Definition at line 299 of file ContractViewModel.cpp.

Member Function Documentation

◆ actorDisplayRows()

QVariantList ui::ContractViewModel::actorDisplayRows ( ) const

Returns actor rows with an empty entry for the primary actor combo.

Returns
QML-ready display rows.

Definition at line 425 of file ContractViewModel.cpp.

◆ addAlias()

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

Adds an alias to the contract form.

Parameters
valueAlias text to add.

Definition at line 353 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ aliases()

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

Returns editable contract aliases.

Returns
Current alias list.

Definition at line 78 of file ContractViewModel.h.

◆ aliasIndex()

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

Returns the selected alias index.

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

Definition at line 102 of file ContractViewModel.h.

◆ aliasInputText()

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

Returns the current alias input text.

Returns
Current alias input text.

Definition at line 90 of file ContractViewModel.h.

◆ allocatableMode()

QString ui::ContractViewModel::allocatableMode ( ) const

Returns the editable allocatable mode.

Returns
Normalized allocatable mode.

Definition at line 384 of file ContractViewModel.cpp.

◆ canAddAlias()

bool ui::ContractViewModel::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 345 of file ContractViewModel.cpp.

◆ canSubmit()

bool ui::ContractViewModel::canSubmit ( ) const

Reports whether the current form can be submitted.

Returns
True when required contract fields are valid.

Definition at line 454 of file ContractViewModel.cpp.

◆ changed

void ui::ContractViewModel::changed ( )
signal
Here is the caller graph for this function:

◆ clear()

void ui::ContractViewModel::clear ( )

Clears the current contract form without changing workspace data.

Definition at line 459 of file ContractViewModel.cpp.

◆ contractRows()

QVariantList ui::ContractViewModel::contractRows ( ) const

Returns contract sidebar rows.

Returns
QML-ready contract rows from workspace selectors.

Definition at line 431 of file ContractViewModel.cpp.

◆ currentId()

QString ui::ContractViewModel::currentId ( ) const

Returns the currently selected contract id.

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

Definition at line 368 of file ContractViewModel.cpp.

◆ deleteCurrent()

void ui::ContractViewModel::deleteCurrent ( )

Deletes the selected contract through workspace commands.

Definition at line 551 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ enterCreateMode()

void ui::ContractViewModel::enterCreateMode ( )

Enters create mode and clears the contract form.

Definition at line 465 of file ContractViewModel.cpp.

◆ hasChanges()

bool ui::ContractViewModel::hasChanges ( ) const

Reports whether the editable fields differ from saved state.

Returns
True when the form has unsaved changes.

Definition at line 566 of file ContractViewModel.cpp.

◆ isEdit()

bool ui::ContractViewModel::isEdit ( ) const

Reports whether the form edits an existing contract.

Returns
True when a contract id is selected.

Definition at line 450 of file ContractViewModel.cpp.

◆ name()

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

Returns the editable contract name.

Returns
Current form name.

Definition at line 66 of file ContractViewModel.h.

◆ next()

void ui::ContractViewModel::next ( )

Selects the next contract row.

Definition at line 513 of file ContractViewModel.cpp.

Here is the caller graph for this function:

◆ previous()

void ui::ContractViewModel::previous ( )

Selects the previous contract row.

Definition at line 500 of file ContractViewModel.cpp.

◆ propertyRows()

QVariantList ui::ContractViewModel::propertyRows ( ) const

Returns property rows for the contract property selector.

Returns
QML-ready property rows from workspace selectors.

Definition at line 435 of file ContractViewModel.cpp.

◆ requestRemoveSelectedAlias()

void ui::ContractViewModel::requestRemoveSelectedAlias ( )

Removes the currently selected alias when possible.

Definition at line 360 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ selectContract()

void ui::ContractViewModel::selectContract ( const QString & id)

Selects a contract for editing.

Parameters
idContract id selected by the QML sidebar.

Definition at line 474 of file ContractViewModel.cpp.

◆ selectedActorIds()

QVariantList ui::ContractViewModel::selectedActorIds ( ) const

Returns selected actor ids for this contract.

Returns
Actor id list.

Definition at line 397 of file ContractViewModel.cpp.

◆ selectedActorIndex()

int ui::ContractViewModel::selectedActorIndex ( ) const

Returns the selected primary actor combo index.

Returns
Combo index, or 0 when no actor is selected.

Definition at line 439 of file ContractViewModel.cpp.

◆ selectedPropertyIds()

QVariantList ui::ContractViewModel::selectedPropertyIds ( ) const

Returns selected property ids for this contract.

Returns
Property id list.

Definition at line 409 of file ContractViewModel.cpp.

◆ selectPrimaryActor()

void ui::ContractViewModel::selectPrimaryActor ( const QString & actorId)

Selects the primary actor for the contract.

Parameters
actorIdActor id from the QML combo box, or empty.

Definition at line 480 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ setAliases()

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

Replaces editable contract aliases.

Parameters
valueNew alias list.

Definition at line 318 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ setAliasIndex()

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

Updates the selected alias index.

Parameters
valueNew selected alias index.

Definition at line 337 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ setAliasInputText()

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

Updates the current alias input text.

Parameters
valueNew alias input text.

Definition at line 329 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ setAllocatableMode()

void ui::ContractViewModel::setAllocatableMode ( const QString & value)

Updates the editable allocatable mode.

Parameters
valueMode text from QML.

Definition at line 388 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ setName()

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

Updates the editable contract name.

Parameters
valueNew form name.

Definition at line 310 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ setPropertySelected()

void ui::ContractViewModel::setPropertySelected ( const QString & propertyId,
bool selected )

Toggles a property link in the current form.

Parameters
propertyIdProperty id toggled by QML.
selectedWhether the property should be selected.

Definition at line 489 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ setSelectedActorIds()

void ui::ContractViewModel::setSelectedActorIds ( const QVariantList & value)

Replaces selected actor ids for this contract.

Parameters
valueActor id list from QML.

Definition at line 401 of file ContractViewModel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedPropertyIds()

void ui::ContractViewModel::setSelectedPropertyIds ( const QVariantList & value)

Replaces selected property ids for this contract.

Parameters
valueProperty id list from QML.

Definition at line 413 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ setType()

void ui::ContractViewModel::setType ( const QString & value)

Updates the editable contract type.

Parameters
valueNew type text from QML.

Definition at line 376 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ submit()

QString ui::ContractViewModel::submit ( )

Creates or updates the current contract through workspace commands.

Returns
Saved contract id.

Definition at line 526 of file ContractViewModel.cpp.

Here is the call graph for this function:

◆ type()

QString ui::ContractViewModel::type ( ) const

Returns the editable contract type.

Returns
Current type field.

Definition at line 372 of file ContractViewModel.cpp.

Property Documentation

◆ actorDisplayRows

QVariantList ui::ContractViewModel::actorDisplayRows
read

Definition at line 39 of file ContractViewModel.h.

◆ aliases

QVariantList ui::ContractViewModel::aliases
readwrite

Definition at line 31 of file ContractViewModel.h.

◆ aliasIndex

int ui::ContractViewModel::aliasIndex
readwrite

Definition at line 34 of file ContractViewModel.h.

◆ aliasInputText

QString ui::ContractViewModel::aliasInputText
readwrite

Definition at line 32 of file ContractViewModel.h.

◆ allocatableMode

QString ui::ContractViewModel::allocatableMode
read

Definition at line 29 of file ContractViewModel.h.

◆ canSubmit

bool ui::ContractViewModel::canSubmit
read

Definition at line 45 of file ContractViewModel.h.

◆ contractRows

QVariantList ui::ContractViewModel::contractRows
read

Definition at line 40 of file ContractViewModel.h.

◆ currentId

QString ui::ContractViewModel::currentId
read

Definition at line 26 of file ContractViewModel.h.

◆ hasChanges

bool ui::ContractViewModel::hasChanges
read

Definition at line 44 of file ContractViewModel.h.

◆ isEdit

bool ui::ContractViewModel::isEdit
read

Definition at line 43 of file ContractViewModel.h.

◆ name

QString ui::ContractViewModel::name
readwrite

Definition at line 27 of file ContractViewModel.h.

◆ propertyRows

QVariantList ui::ContractViewModel::propertyRows
read

Definition at line 41 of file ContractViewModel.h.

◆ selectedActorIds

QVariantList ui::ContractViewModel::selectedActorIds
read

Definition at line 35 of file ContractViewModel.h.

◆ selectedActorIndex

int ui::ContractViewModel::selectedActorIndex
read

Definition at line 42 of file ContractViewModel.h.

◆ selectedPropertyIds

QVariantList ui::ContractViewModel::selectedPropertyIds
read

Definition at line 37 of file ContractViewModel.h.

◆ type

QString ui::ContractViewModel::type
readwrite

Definition at line 28 of file ContractViewModel.h.


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