2 * ModuleBase_IOperation.cpp
4 * Created on: May 5, 2014
8 #include "ModuleBase_IOperation.h"
9 #include "ModuleBase_OperationDescription.h"
10 #include "ModuleBase_ModelWidget.h"
12 #include <ModelAPI_Document.h>
13 #include <ModelAPI_Session.h>
19 ModuleBase_IOperation::ModuleBase_IOperation(const QString& theId, QObject* theParent)
24 myDescription = new ModuleBase_OperationDescription(theId);
27 ModuleBase_IOperation::~ModuleBase_IOperation()
32 ModuleBase_OperationDescription* ModuleBase_IOperation::getDescription() const
37 bool ModuleBase_IOperation::canBeCommitted() const
42 /*void ModuleBase_IOperation::setModelWidgets(const std::string& theXmlRepresentation,
43 QList<ModuleBase_ModelWidget*> theWidgets)
45 QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end();
46 for (; anIt != aLast; anIt++) {
47 QObject::connect(*anIt, SIGNAL(valuesChanged()), this, SLOT(storeCustomValue()));
49 getDescription()->setModelWidgets(theXmlRepresentation, theWidgets);
52 boost::shared_ptr<ModelAPI_Document> ModuleBase_IOperation::document() const
54 return ModelAPI_Session::get()->moduleDocument();
57 void ModuleBase_IOperation::start()
59 ModelAPI_Session::get()->startOperation();
65 void ModuleBase_IOperation::resume()
70 void ModuleBase_IOperation::abort()
77 ModelAPI_Session::get()->abortOperation();
81 bool ModuleBase_IOperation::commit()
83 if (canBeCommitted()) {
89 ModelAPI_Session::get()->finishOperation();
92 afterCommitOperation();
98 void ModuleBase_IOperation::setRunning(bool theState)