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_PluginManager.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 bool ModuleBase_IOperation::isGranted(ModuleBase_IOperation* /*theOperation*/) const
47 /*void ModuleBase_IOperation::setModelWidgets(const std::string& theXmlRepresentation,
48 QList<ModuleBase_ModelWidget*> theWidgets)
50 QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end();
51 for (; anIt != aLast; anIt++) {
52 QObject::connect(*anIt, SIGNAL(valuesChanged()), this, SLOT(storeCustomValue()));
54 getDescription()->setModelWidgets(theXmlRepresentation, theWidgets);
57 boost::shared_ptr<ModelAPI_Document> ModuleBase_IOperation::document() const
59 return ModelAPI_PluginManager::get()->rootDocument();
62 void ModuleBase_IOperation::start()
64 document()->startOperation();
70 void ModuleBase_IOperation::resume()
75 void ModuleBase_IOperation::abort()
82 document()->abortOperation();
86 bool ModuleBase_IOperation::commit()
88 if (canBeCommitted()) {
94 document()->finishOperation();
97 afterCommitOperation();
103 void ModuleBase_IOperation::setRunning(bool theState)