SHAPER  9.12.0
XGUI_OperationMgr Class Reference

Operation manager. More...

Inheritance diagram for XGUI_OperationMgr:
Inheritance graph

Public Types

enum  XGUI_MessageKind { XGUI_AbortOperationMessage , XGUI_InformationMessage }
 Enumeration of kind of message that is used when trying to stop the active operation. More...
 

Public Slots

void onAbortOperation ()
 Slot that aborts the current operation. More...
 
void onAbortAllOperation ()
 Slot that aborts all operations. It shows aborting message. More...
 
void onValidateOperation ()
 Slot that validates the current operation using the validateOperation method. More...
 
bool commitAllOperations ()
 Commit all operations. More...
 
bool onKeyReleased (QObject *theObject, QKeyEvent *theEvent)
 SLOT, that is called by the key in the property panel is clicked. More...
 
bool onKeyPressed (QObject *theObject, QKeyEvent *theEvent)
 SLOT, that is called by the key in the property panel is clicked. More...
 
bool onProcessDelete (QObject *theObject)
 The functionaly, that should be done by delete click Fistly the active widget processes it, then workshop. More...
 

Signals

void operationStopped (ModuleBase_Operation *theOperation)
 Signal about an operation is stopped. More...
 
void operationResumed (ModuleBase_Operation *theOperation)
 Signal about an operation is resumed. It is emitted after the resume() of operation is done. More...
 
void operationCommitted (ModuleBase_Operation *theOperation)
 Emitted when current operation is Committed. More...
 
void operationAborted (ModuleBase_Operation *theOperation)
 Emitted when current operation is aborted. More...
 
void keyEnterReleased ()
 Signal is emitted after the key released click. More...
 

Public Member Functions

 XGUI_OperationMgr (QObject *theParent, ModuleBase_IWorkshop *theWorkshop)
 Constructor. More...
 
virtual ~XGUI_OperationMgr ()
 Destructor. More...
 
void activate ()
 Switch on short cut listener. More...
 
void deactivate ()
 Switch off short cut listener. More...
 
void setWorkshop (ModuleBase_IWorkshop *theWorkshop)
 Set reference to workshop. More...
 
ModuleBase_IWorkshopworkshop () const
 Current workshop. More...
 
XGUI_Workshopxworkshop () const
 Current workshop. More...
 
ModuleBase_OperationcurrentOperation () const
 Returns the current operation or NULL. More...
 
bool isCurrentOperation (ModuleBase_Operation *theOperation)
 Check if the given operation is active operation. More...
 
bool hasOperation () const
 Returns true is operation manager has at least one non-null operation. More...
 
bool hasOperation (const QString &theId) const
 Returns true is operation manager has an operation with given Id. More...
 
bool canStopOperation (ModuleBase_Operation *theOperation, const XGUI_MessageKind &theMessageKind=XGUI_AbortOperationMessage)
 Returns true if the operation can be aborted. More...
 
ModuleBase_OperationfindOperation (const QString &theId) const
 Find and return operation by its Id. More...
 
int operationsCount () const
 Returns number of operations in the stack. More...
 
QStringList operationList () const
 Returns list of all operations IDs. More...
 
ModuleBase_OperationpreviousOperation (ModuleBase_Operation *theOperation) const
 Returns previous (parent) operation if given operation started. More...
 
ModuleBase_ModelWidgetactiveWidget () const
 Returns an active widget of the current operation. More...
 
bool startOperation (ModuleBase_Operation *theOperation)
 Start the operation and append it to the stack of operations. More...
 
bool canStartOperation (const QString &theId, bool &isCommitted)
 Returns whether the operation can be started. More...
 
void stopOperation (ModuleBase_Operation *theOperation, bool &isCommitted)
 If Apply is enabled and operation has modification, it is applyed, otherwise aborted. More...
 
void abortOperation (ModuleBase_Operation *theOperation)
 Aborts the parameter operation if it is current, else abort operations from the stack of operations until the operation is found. More...
 
bool abortAllOperations (const XGUI_MessageKind &theMessageKind=XGUI_AbortOperationMessage)
 Abort all operations. More...
 
bool commitOperation ()
 Commits the current operation. More...
 
void setSHIFTPressed (const bool thePressed)
 Returns true if SHIFT is pressed. More...
 
bool hasSHIFTPressed () const
 Returns true if SHIFT is pressed. More...
 
void updateApplyOfOperations (ModuleBase_Operation *theOperation=0)
 Emits nestedStateChange for operations with an information about validity of the operation. More...
 

Protected Slots

bool onProcessEnter (QObject *theObject)
 The functionaly, that should be done by enter click Fistly the active widget processes it, then module. More...
 
void onOperationStopped ()
 Slot that is called by an operation stop. More...
 
void onBeforeOperationStarted ()
 Slot called before operation started. More...
 
void onOperationStarted ()
 Slot called after operation started. More...
 
void onBeforeOperationAborted ()
 Slot called before operation aborted. Restore the previous current operation. More...
 
void onOperationAborted ()
 Slot called after operation aborted. More...
 
void onBeforeOperationCommitted ()
 Slot called before operation committed. Restore the previous current operation. More...
 
void onOperationCommitted ()
 Slot called after operation committed. More...
 
void onOperationResumed ()
 Slot called on operation resume. More...
 

Protected Member Functions

void resumeOperation (ModuleBase_Operation *theOperation)
 Sets the current operation or NULL. More...
 
bool isGrantedOperation (const QString &theId)
 Returns whether the parameter operation is granted in relation to the previous operation in a stack of started operations. More...
 
void setCurrentFeature (const FeaturePtr &theFeature)
 Sets the feature as a current in the document. More...
 

Detailed Description

Operation manager.

Servers to manipulate to the workshop operations. Contains a stack of started operations. In simple case, if only one operation is started, the stack contains one operation. It is possible for some kind of operations to start them above already started one. In that case, the previous active operation becomes suspended, a new one - active. The new operation is added to the top of the stack. Then it is finished, it is removed from the stack and the previous operation is activated.

Member Enumeration Documentation

◆ XGUI_MessageKind

Enumeration of kind of message that is used when trying to stop the active operation.

Enumerator
XGUI_AbortOperationMessage 

warns and give possibility to abort current operation

XGUI_InformationMessage 

ask to apply the current operation before performing something

Constructor & Destructor Documentation

◆ XGUI_OperationMgr()

XGUI_OperationMgr::XGUI_OperationMgr ( QObject theParent,
ModuleBase_IWorkshop theWorkshop 
)

Constructor.

Parameters
theParentthe parent
theWorkshopa reference to workshop

we need to install filter to the application in order to react to 'Delete' key button this key can not be a short cut for a corresponded action because we need to set the actions priority

◆ ~XGUI_OperationMgr()

XGUI_OperationMgr::~XGUI_OperationMgr ( )
virtual

Destructor.

Member Function Documentation

◆ activate()

void XGUI_OperationMgr::activate ( )

Switch on short cut listener.

◆ deactivate()

void XGUI_OperationMgr::deactivate ( )

Switch off short cut listener.

◆ setWorkshop()

void XGUI_OperationMgr::setWorkshop ( ModuleBase_IWorkshop theWorkshop)
inline

Set reference to workshop.

Parameters
theWorkshopreference to workshop

◆ workshop()

ModuleBase_IWorkshop* XGUI_OperationMgr::workshop ( ) const
inline

Current workshop.

◆ xworkshop()

XGUI_Workshop * XGUI_OperationMgr::xworkshop ( ) const

Current workshop.

◆ currentOperation()

ModuleBase_Operation * XGUI_OperationMgr::currentOperation ( ) const

Returns the current operation or NULL.

Returns
the current operation

◆ isCurrentOperation()

bool XGUI_OperationMgr::isCurrentOperation ( ModuleBase_Operation theOperation)

Check if the given operation is active operation.

Also, returns false is ther is no active operation.

◆ hasOperation() [1/2]

bool XGUI_OperationMgr::hasOperation ( ) const

Returns true is operation manager has at least one non-null operation.

◆ hasOperation() [2/2]

bool XGUI_OperationMgr::hasOperation ( const QString &  theId) const

Returns true is operation manager has an operation with given Id.

◆ canStopOperation()

bool XGUI_OperationMgr::canStopOperation ( ModuleBase_Operation theOperation,
const XGUI_MessageKind theMessageKind = XGUI_AbortOperationMessage 
)

Returns true if the operation can be aborted.

If the operation is modified, the warning message box is shown.

Parameters
theOperationan operation which is checked on stop
theMessageKinda kind of message in warning message box

◆ findOperation()

ModuleBase_Operation * XGUI_OperationMgr::findOperation ( const QString &  theId) const

Find and return operation by its Id.

◆ operationsCount()

int XGUI_OperationMgr::operationsCount ( ) const

Returns number of operations in the stack.

◆ operationList()

QStringList XGUI_OperationMgr::operationList ( ) const

Returns list of all operations IDs.

◆ previousOperation()

ModuleBase_Operation * XGUI_OperationMgr::previousOperation ( ModuleBase_Operation theOperation) const

Returns previous (parent) operation if given operation started.

else, or if there is no parent - returns NULL

◆ activeWidget()

ModuleBase_ModelWidget * XGUI_OperationMgr::activeWidget ( ) const

Returns an active widget of the current operation.

Returns
widget or NULL

◆ startOperation()

bool XGUI_OperationMgr::startOperation ( ModuleBase_Operation theOperation)

Start the operation and append it to the stack of operations.

Parameters
theOperationthe started operation
Returns
the state whether the current operation is started

◆ canStartOperation()

bool XGUI_OperationMgr::canStartOperation ( const QString &  theId,
bool &  isCommitted 
)

Returns whether the operation can be started.

Check if there is already started operation and the granted parameter of the launched operation

Parameters
theIdid of the operation which is going to start
isCommittedboolean value if the operation was committed otherwise it was aborted

◆ stopOperation()

void XGUI_OperationMgr::stopOperation ( ModuleBase_Operation theOperation,
bool &  isCommitted 
)

If Apply is enabled and operation has modification, it is applyed, otherwise aborted.

Parameters
theOperationthe started operation
isCommittedboolean value if the operation was committed otherwise it was aborted

◆ abortOperation()

void XGUI_OperationMgr::abortOperation ( ModuleBase_Operation theOperation)

Aborts the parameter operation if it is current, else abort operations from the stack of operations until the operation is found.

All operations upper the parameter one are not aborted.

Parameters
theOperationan aborted operation

◆ abortAllOperations()

bool XGUI_OperationMgr::abortAllOperations ( const XGUI_MessageKind theMessageKind = XGUI_AbortOperationMessage)

Abort all operations.

Parameters
theMessageKindkind of shown warning message

◆ commitOperation()

bool XGUI_OperationMgr::commitOperation ( )

Commits the current operation.

◆ setSHIFTPressed()

void XGUI_OperationMgr::setSHIFTPressed ( const bool  thePressed)
inline

Returns true if SHIFT is pressed.

Parameters
thePressednew boolean state

◆ hasSHIFTPressed()

bool XGUI_OperationMgr::hasSHIFTPressed ( ) const
inline

Returns true if SHIFT is pressed.

Returns
boolean value

◆ onAbortOperation

void XGUI_OperationMgr::onAbortOperation ( )
slot

Slot that aborts the current operation.

◆ onAbortAllOperation

void XGUI_OperationMgr::onAbortAllOperation ( )
slot

Slot that aborts all operations. It shows aborting message.

◆ onValidateOperation

void XGUI_OperationMgr::onValidateOperation ( )
slot

Slot that validates the current operation using the validateOperation method.

◆ commitAllOperations

bool XGUI_OperationMgr::commitAllOperations ( )
slot

Commit all operations.

◆ operationStopped

void XGUI_OperationMgr::operationStopped ( ModuleBase_Operation theOperation)
signal

Signal about an operation is stopped.

It is emitted after the stop() of operation is done.

Parameters
theOperationa stopped operation

◆ operationResumed

void XGUI_OperationMgr::operationResumed ( ModuleBase_Operation theOperation)
signal

Signal about an operation is resumed. It is emitted after the resume() of operation is done.

◆ operationCommitted

void XGUI_OperationMgr::operationCommitted ( ModuleBase_Operation theOperation)
signal

Emitted when current operation is Committed.

◆ operationAborted

void XGUI_OperationMgr::operationAborted ( ModuleBase_Operation theOperation)
signal

Emitted when current operation is aborted.

◆ keyEnterReleased

void XGUI_OperationMgr::keyEnterReleased ( )
signal

Signal is emitted after the key released click.

◆ updateApplyOfOperations()

void XGUI_OperationMgr::updateApplyOfOperations ( ModuleBase_Operation theOperation = 0)

Emits nestedStateChange for operations with an information about validity of the operation.

Parameters
theOperationthe sent operation. If it is NULL, all operations in the stack are sent.

◆ resumeOperation()

void XGUI_OperationMgr::resumeOperation ( ModuleBase_Operation theOperation)
protected

Sets the current operation or NULL.

Parameters
theOperationthe started operation

◆ isGrantedOperation()

bool XGUI_OperationMgr::isGrantedOperation ( const QString &  theId)
protected

Returns whether the parameter operation is granted in relation to the previous operation in a stack of started operations.

It is used in canStopOperation to avoid warning message when granted operation is aborted, e.g. SketchLine in Sketch

Parameters
theIdid of the operation which is checked
Returns
boolean result

◆ setCurrentFeature()

void XGUI_OperationMgr::setCurrentFeature ( const FeaturePtr &  theFeature)
protected

Sets the feature as a current in the document.

Parameters
theFeaturea feature

◆ onKeyReleased

bool XGUI_OperationMgr::onKeyReleased ( QObject theObject,
QKeyEvent *  theEvent 
)
slot

SLOT, that is called by the key in the property panel is clicked.

Parameters
theObjecta sender of the event
theEventthe mouse event

◆ onKeyPressed

bool XGUI_OperationMgr::onKeyPressed ( QObject theObject,
QKeyEvent *  theEvent 
)
slot

SLOT, that is called by the key in the property panel is clicked.

Parameters
theObjecta sender of the event
theEventthe mouse event

◆ onProcessDelete

bool XGUI_OperationMgr::onProcessDelete ( QObject theObject)
slot

The functionaly, that should be done by delete click Fistly the active widget processes it, then workshop.

If no one does not process it, do nothing

Parameters
theObjecta sender of the event

other widgets such as line edit controls should not lead to processing delete by workshop

Line Edit of Rename operation in ObjectBrowser

◆ onProcessEnter

bool XGUI_OperationMgr::onProcessEnter ( QObject theObject)
protectedslot

The functionaly, that should be done by enter click Fistly the active widget processes it, then module.

If no one does not process it, the current operation is committed

Parameters
theObjecta sender of the event

functionality is similar to Apply click

◆ onOperationStopped

void XGUI_OperationMgr::onOperationStopped ( )
protectedslot

Slot that is called by an operation stop.

Removes the stopped operation form the stack. If there is a suspended operation, restart it.

◆ onBeforeOperationStarted

void XGUI_OperationMgr::onBeforeOperationStarted ( )
protectedslot

Slot called before operation started.

Stores the previous current feature, set the feature of the operation as a current in the document. The previous current feature should be restored by the operation abort/commit

Set current feature and remeber old current feature

◆ onOperationStarted

void XGUI_OperationMgr::onOperationStarted ( )
protectedslot

Slot called after operation started.

◆ onBeforeOperationAborted

void XGUI_OperationMgr::onBeforeOperationAborted ( )
protectedslot

Slot called before operation aborted. Restore the previous current operation.

◆ onOperationAborted

void XGUI_OperationMgr::onOperationAborted ( )
protectedslot

Slot called after operation aborted.

◆ onBeforeOperationCommitted

void XGUI_OperationMgr::onBeforeOperationCommitted ( )
protectedslot

Slot called before operation committed. Restore the previous current operation.

Restore the previous current feature

Restore the previous current feature

◆ onOperationCommitted

void XGUI_OperationMgr::onOperationCommitted ( )
protectedslot

Slot called after operation committed.

◆ onOperationResumed

void XGUI_OperationMgr::onOperationResumed ( )
protectedslot

Slot called on operation resume.