* Author: nds
*/
-
#ifndef ModuleBase_IOperation_H
#define ModuleBase_IOperation_H
* - virtual void commitOperation();
*/
-class MODULEBASE_EXPORT ModuleBase_IOperation: public QObject
+class MODULEBASE_EXPORT ModuleBase_IOperation : public QObject
{
Q_OBJECT
-public:
+ public:
/// Constructor
/// Constructs an empty operation. Constructor should work very fast because many
/// operators may be created after starting workshop but only several from them
/// /returns the instance of the description class
ModuleBase_OperationDescription* getDescription() const;
- /// Verifies whether this operator can be commited.
- /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
- virtual bool canBeCommitted() const;
-
/// Verifies whether this operator can be always started above any already running one
/// \return Returns TRUE if current operation must not be checked for ActiveOperation->IsValid( this )
/// This method must be redefined in derived operation if operation of derived class
// QList<ModuleBase_ModelWidget*> theWidgets);
/// Returns True if data of its feature was modified during operation
- virtual bool isModified() const { return myIsModified; }
+ virtual bool isModified() const
+ {
+ return myIsModified;
+ }
/// Returns True id the current operation is launched in editing mode
- bool isEditOperation() const { return myIsEditing; }
+ bool isEditOperation() const
+ {
+ return myIsEditing;
+ }
signals:
- void started(); /// the operation is started
- void aborted(); /// the operation is aborted
- void committed(); /// the operation is committed
- void stopped(); /// the operation is aborted or committed
- void resumed(); /// the operation is resumed
+ void started(); /// the operation is started
+ void aborted(); /// the operation is aborted
+ void committed(); /// the operation is committed
+ void stopped(); /// the operation is aborted or committed
+ void resumed(); /// the operation is resumed
-public slots:
+ public slots:
/// Starts operation
/// Public slot. Verifies whether operation can be started and starts operation.
/// This slot is not virtual and cannot be redefined. Redefine startOperation method
/// Commits operation
/// Public slot. Commits operation. This slot is not virtual and cannot be redefined.
/// Redefine commitOperation method to change behavior of operation instead
- void commit();
+ bool commit();
/// Alias for start/abort slots
/// Public slot. Aborts operation if false, else does nothing.
/// Stores a custom value in model.
virtual void storeCustomValue() = 0;
-protected:
+ protected:
/// Virtual method called when operation started (see start() method for more description)
/// Default impl calls corresponding slot and commits immediately.
virtual void startOperation() = 0;
+
/// Virtual method called when operation stopped - committed or aborted.
virtual void stopOperation() = 0;
+
/// Virtual method called when operation aborted (see abort() method for more description)
virtual void abortOperation() = 0;
+
/// Virtual method called when operation committed (see commit() method for more description)
virtual void commitOperation() = 0;
+
/// Virtual method called after operation committed (see commit() method for more description)
/// it is important that the method is called after the stop() signal is emitted
virtual void afterCommitOperation() = 0;
+ /// Verifies whether this operator can be commited.
+ /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
+ virtual bool canBeCommitted() const;
+
/// Returns pointer to the root document.
boost::shared_ptr<ModelAPI_Document> document() const;
/// Modified feature flag
bool myIsModified;
-private:
- ModuleBase_OperationDescription* myDescription; /// the container to have the operation description
+ private:
+ ModuleBase_OperationDescription* myDescription; /// the container to have the operation description
};
#endif