Salome HOME
[MEDCalc] Support for ELNO field + minor GUI bug fix.
[modules/med.git] / src / MEDCalc / gui / DatasourceController.cxx
index ccfe685b27947ae983cef24c7ef5b05d594fddee..cbf2649d569ba10c203f8032c055f6dd8b62c991 100644 (file)
@@ -105,6 +105,7 @@ void DatasourceController::createActions() {
   icon  = tr("ICO_DATASOURCE_USE");
   actionId = _salomeModule->createStandardAction(label,this,SLOT(OnUseInWorkspace()),icon);
   _salomeModule->addActionInPopupMenu(actionId);
+
 }
 
 /**
@@ -121,13 +122,14 @@ DatasourceController::addDatasource(const char* filename)
   DatasourceEvent* event = new DatasourceEvent();
   event->eventtype = DatasourceEvent::EVENT_ADD_DATASOURCE;
   event->objectalias = filename;
-  emit datasourceSignal(event);
+  emit datasourceSignal(event);  // --> WorkspaceController::processDatasourceEvent()
 //#ifdef MED_WITH_QTTESTING
 //  _dirtyAddDataSource = true;
 //  while(_dirtyAddDataSource)
 //    QApplication::processEvents();
 //#endif
 }
+
 // After above data source creation, python console emits a signal, forwarded by workspace, to update the GUI
 void
 DatasourceController::updateTreeViewWithNewDatasource(const MEDCALC::DatasourceHandler* datasourceHandler)
@@ -216,7 +218,7 @@ void DatasourceController::OnAddImagesource()
   DatasourceEvent* event = new DatasourceEvent();
   event->eventtype = DatasourceEvent::EVENT_ADD_IMAGE_AS_DATASOURCE;
   event->objectalias = imageFilename;
-  emit datasourceSignal(event);
+  emit datasourceSignal(event); // --> WorkspaceController::processDatasourceEvent()
 }
 
 void DatasourceController::OnExpandField()
@@ -230,7 +232,8 @@ void DatasourceController::OnExpandField()
     SALOMEDS::SObject_var soFieldseries = listOfSObject->at(i);
 
     // First retrieve the fieldseries id associated to this study object
-    long fieldseriesId = _studyEditor->getParameterInt(soFieldseries,OBJECT_ID);
+    long fieldseriesId = _studyEditor->getParameterInt(soFieldseries,FIELD_SERIES_ID);
+    //long fieldseriesId = _studyEditor->getParameterInt(soFieldseries,FIELD_ID);
     STDLOG("Expand the field timeseries "<<fieldseriesId);
 
     // If fieldseriesId equals -1, then it means that it is not a
@@ -251,8 +254,8 @@ void DatasourceController::OnExpandField()
       SALOMEDS::SObject_var soField = _studyEditor->newObject(soFieldseries);
       std::string label("it="); label += ToString(fieldHandler.iteration);
       _studyEditor->setName(soField,label.c_str());
-      _studyEditor->setParameterInt(soField, OBJECT_ID, fieldHandler.id);
-      _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,false);
+      _studyEditor->setParameterInt(soField, FIELD_ID, fieldHandler.id);
+      _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,false);
     }
   }
   _salomeModule->updateObjBrowser(true);
@@ -277,7 +280,7 @@ void DatasourceController::OnUseInWorkspace() {
 
     SALOMEDS::SObject_var soField = listOfSObject->at(0);
 
-    bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE);
+    bool isInWorkspace = _studyEditor->getParameterBool(soField,IS_IN_WORKSPACE);
     if ( isInWorkspace ) {
       QMessageBox::warning(_salomeModule->getApp()->desktop(),
          tr("Operation not allowed"),
@@ -285,7 +288,7 @@ void DatasourceController::OnUseInWorkspace() {
       return;
     }
 
-    int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+    int fieldId = _studyEditor->getParameterInt(soField,FIELD_ID);
 
     // If fieldId equals -1, then it means that it is not a field
     // managed by the MED module, and we stop this function process.
@@ -322,9 +325,9 @@ void DatasourceController::OnUseInWorkspace() {
     dataObject->setFieldHandler(*fieldHandler);
     event->objectdata  = dataObject;
     event->objectalias = alias;
-    emit datasourceSignal(event);
+    emit datasourceSignal(event);  // --> WorkspaceController::processDatasourceEvent()
     // Tag the item to prevent double import
-    //    _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
+    //    _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,true);
     // Tag the field as persistent on the server. It means that a
     // saving of the workspace will save at least this field (maybe it
     // should be an option?)
@@ -336,9 +339,9 @@ void DatasourceController::OnUseInWorkspace() {
     for (int i=0; i<listOfSObject->size(); i++) {
       SALOMEDS::SObject_var soField = listOfSObject->at(i);
 
-      bool isInWorkspace = _studyEditor->getParameterBool(soField,OBJECT_IS_IN_WORKSPACE);
+      bool isInWorkspace = _studyEditor->getParameterBool(soField,IS_IN_WORKSPACE);
       if ( !isInWorkspace ) {
-        int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+        int fieldId = _studyEditor->getParameterInt(soField,FIELD_ID);
         MEDCALC::FieldHandler* fieldHandler =
           MEDFactoryClient::getDataManager()->getFieldHandler(fieldId);
         DatasourceEvent* event = new DatasourceEvent();
@@ -346,11 +349,11 @@ void DatasourceController::OnUseInWorkspace() {
         XmedDataObject* dataObject = new XmedDataObject();
         dataObject->setFieldHandler(*fieldHandler);
         event->objectdata  = dataObject;
-        emit datasourceSignal(event);
+        emit datasourceSignal(event); // --> WorkspaceController::processDatasourceEvent()
         // Note that this signal is processed by the WorkspaceController
 
         // Tag the item to prevent double import
-        //        _studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
+        //        _studyEditor->setParameterBool(soField,IS_IN_WORKSPACE,true);
         // Tag the field as persistent on the server. It means that a
         // saving of the workspace will save at least this field (maybe it
         // should be an option?)