1 // Copyright (C) 2009-2022 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, or (at your option) any later version.
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 #include "BL_SalomeGui.hxx"
21 #include "JOBMANAGER_version.h"
23 #include <SUIT_Desktop.h>
24 #include <SUIT_ViewWindow.h>
26 BL::SalomeGui::SalomeGui() : MainWindows_SALOME("JobManager")
28 DEBTRACE("Creating BL::SalomeGui");
32 BL::SalomeGui::~SalomeGui()
34 DEBTRACE("Destroying BL::SalomeGui");
36 disconnect(getApp(), SIGNAL(studyClosed()), this, SLOT(studyClosed()));
42 BL::SalomeGui::initialize(CAM_Application* app)
44 DEBTRACE("Entering in initialize");
45 SalomeApp_Module::initialize(app); // MANDATORY -> Otherwise SISEGV...
46 connect( getApp(), SIGNAL(studyClosed()), this, SLOT(studyClosed()));
47 if ( app && app->desktop() )
48 connect( app->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
49 this, SLOT(onWindowActivated( SUIT_ViewWindow* )) );
53 BL::SalomeGui::studyClosed()
57 _gengui->saveIfNeeded();
58 _gengui->deleteDockWidget();
66 BL::SalomeGui::activateModule(SUIT_Study* theStudy)
68 DEBTRACE("Entering in BL::SalomeGui::activateModule");
72 BL::MainWindows_SALOME::initialize(getApp());
73 BL::MainWindows_SALOME::createView();
74 _gengui = new BL::GenericGui(this);
76 _gengui->createDockWidgets();
77 _gengui->createCentralWidget();
78 _gengui->createActions();
79 _gengui->createMenus();
80 _gengui->updateButtonsStates();
85 if (!BL::MainWindows_SALOME::restoreViewFocus())
87 // We need to recreate QT objects and the view
88 BL::MainWindows_SALOME::createView();
89 _gengui->createCentralWidget();
94 _gengui->showDockWidgets(true);
95 bool bOk = SalomeApp_Module::activateModule(theStudy);
100 BL::SalomeGui::windows(QMap<int, int>& theMap) const
102 DEBTRACE("Entering in BL::SalomeGui::windows");
104 theMap.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea);
108 BL::SalomeGui::deactivateModule(SUIT_Study* theStudy)
110 DEBTRACE("Entering in BL::SalomeGui::deactivateModule");
113 _gengui->showDockWidgets(false);
114 bool bOk = SalomeApp_Module::deactivateModule(theStudy);
119 BL::SalomeGui::onWindowActivated( SUIT_ViewWindow* svw)
121 DEBTRACE("BL::SalomeGui::onWindowActivated");
122 DEBTRACE("activeModule()->moduleName() " << (getApp()->activeModule() ? getApp()->activeModule()->moduleName().toStdString() : "") );
124 if (_viewWin) // Be sure to have a _viewWindow
125 if (svw->getId() == _viewWin->getId()) // Same Id ?
126 if (!getApp()->activeModule() || getApp()->activeModule()->moduleName() != "JobManager") // JobManager already activated ?
127 if ( !getApp()->activateModule("JobManager") ) return;
130 // --- Export the module
133 JOBMANAGER_EXPORT CAM_Module* createModule()
135 return new BL::SalomeGui();
138 char* getModuleVersion()
140 return (char*)JOBMANAGER_VERSION_STR;