1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // Author : Guillaume Boulant (EDF)
22 #include "MEDOPModule.hxx"
23 #include "QtHelper.hxx"
25 #include <SALOMEconfig.h>
26 #include CORBA_CLIENT_HEADER(SALOMEDS)
28 #include "MEDOPFactoryClient.hxx"
32 #include <SUIT_Desktop.h>
33 #include <SUIT_ResourceMgr.h>
34 #include <SUIT_Session.h>
35 #include <SUIT_FileDlg.h>
38 MEDOP_MENU_ACTION_ID_IMPORT_MED = 100
41 MEDOPModule::MEDOPModule() :
44 // Note also that we can't use the getApp() function here because
45 // the initialize(...) function has not been called yet.
47 this->setModuleName("MED");
51 // =====================================================================
52 // This part implements the mandatory interface
53 // =====================================================================
57 * Returns the engine of the XMED module, i.e. the SALOME component
58 * associated to the study root of the module.
60 Engines::EngineComponent_ptr MEDOPModule::getEngine() const {
61 return MEDOPFactoryClient::getFactory();
65 * Returns the base file name of the image used for the icon's
66 * module. The file is supposed to be located in the resource
67 * directory of the module.
69 QString MEDOPModule::studyIconName() {
70 return tr("ICO_MEDOP_SMALL");
74 // =====================================================================
75 // This part add custom widgets (a dockwidget containing a tree view
76 // in this example) and add special actions in the toolbox of the
78 // =====================================================================
82 * This function implements the interface StandardApp_Module. It
83 * creates the widgets specific for this module, in particular the
84 * workspace widget and the dataspace widget.
86 void MEDOPModule::createModuleWidgets() {
87 _datasourceController = new DatasourceController(this);
88 _workspaceController = new WorkspaceController(this);
89 _xmedDataModel = new XmedDataModel();
90 _workspaceController->setDataModel(_xmedDataModel);
92 connect(_datasourceController, SIGNAL(datasourceSignal(const DatasourceEvent *)),
93 _workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent *)));
96 bool MEDOPModule::activateModule( SUIT_Study* theStudy )
98 bool bOk = StandardApp_Module::activateModule( theStudy );
99 _workspaceController->showDockWidgets(true);
100 this->setDockLayout(StandardApp_Module::DOCKLAYOUT_LEFT_VLARGE);
103 bool MEDOPModule::deactivateModule( SUIT_Study* theStudy )
105 _workspaceController->showDockWidgets(false);
106 this->unsetDockLayout();
107 return StandardApp_Module::deactivateModule( theStudy );
110 void MEDOPModule::createModuleActions() {
111 // Creating actions concerning the dataspace
112 _datasourceController->createActions();
113 // Creating actions concerning the workspace
114 _workspaceController->createActions();