aCommand->connectTo(this, SLOT(onSave()));
//aCommand->disable();
+ aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"),
+ QIcon(":pictures/save.png"), QKeySequence());
+ aCommand->connectTo(this, SLOT(onSaveAs()));
+
QString aUndoId = "UNDO_CMD";
aCommand = aGroup->addFeature(aUndoId, tr("Undo"), tr("Undo last command"),
QIcon(":pictures/undo.png"), QKeySequence::Undo);
SIGNAL(updateRedoHistory(const QList<ActionInfo>&)),
SLOT(onRedo(int)));
- aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
- QIcon(":pictures/rebuild.png"), QKeySequence());
- aCommand->connectTo(this, SLOT(onRebuild()));
+ //aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
+ // QIcon(":pictures/rebuild.png"), QKeySequence());
+ //aCommand->connectTo(this, SLOT(onRebuild()));
- aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"),
- QIcon(":pictures/save.png"), QKeySequence());
- aCommand->connectTo(this, SLOT(onSaveAs()));
//aCommand->disable();
aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"),
}
updateCommandStatus();
- myModule->onOperationStarted(aFOperation);
+ connectToPropertyPanel(true);
+ myModule->operationStarted(aFOperation);
// the objects of the current operation should be deactivated
QObjectPtrList anObjects;
if (theOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel
setPropertyPanel(theOperation);
+ connectToPropertyPanel(true);
}
updateCommandStatus();
- myModule->onOperationResumed(theOperation);
+ myModule->operationResumed(theOperation);
}
hidePropertyPanel();
myPropertyPanel->cleanContent();
- myModule->onOperationStopped(aFOperation);
+ connectToPropertyPanel(false);
+ myModule->operationStopped(aFOperation);
// the deactivated objects of the current operation should be activated back.
// They were deactivated on operation start or an object redisplay
void XGUI_Workshop::onOperationCommitted(ModuleBase_Operation* theOperation)
{
- myModule->onOperationCommitted(theOperation);
+ myModule->operationCommitted(theOperation);
}
void XGUI_Workshop::onOperationAborted(ModuleBase_Operation* theOperation)
{
- myModule->onOperationAborted(theOperation);
+ myModule->operationAborted(theOperation);
}
void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation* theOperation)
myErrorMgr->setPropertyPanel(myPropertyPanel);
}
+void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect)
+{
+ XGUI_PropertyPanel* aPropertyPanel = propertyPanel();
+ if (aPropertyPanel) {
+ const QList<ModuleBase_ModelWidget*>& aWidgets = aPropertyPanel->modelWidgets();
+ foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
+ myModule->connectToPropertyPanel(aWidget, isToConnect);
+ if (isToConnect) {
+ connect(aWidget, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetStateChanged(int)));
+ }
+ else {
+ disconnect(aWidget, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetStateChanged(int)));
+ }
+ }
+ }
+}
+
/*
* Saves document with given name.
*/
}
//******************************************************
+void XGUI_Workshop::onWidgetStateChanged(int thePreviousState)
+{
+ ModuleBase_ModelWidget* anActiveWidget = 0;
+ ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
+ if (anOperation) {
+ ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
+ if (aPanel)
+ anActiveWidget = aPanel->activeWidget();
+ }
+ if (anActiveWidget)
+ operationMgr()->onValidateOperation();
+
+ myModule->widgetStateChanged(thePreviousState);
+}
+
ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
{
QString libName = QString::fromStdString(library(theModule.toStdString()));
QAction* aCancelAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort);
connect(aCancelAct, SIGNAL(triggered()), myOperationMgr, SLOT(onAbortOperation()));
- connect(myPropertyPanel, SIGNAL(noMoreWidgets()), myModule, SLOT(onNoMoreWidgets()));
connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)),
myOperationMgr, SLOT(onKeyReleased(QKeyEvent*)));
//connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),