From: ribes Date: Tue, 26 Jan 2010 12:29:31 +0000 (+0000) Subject: - Study Management X-Git-Tag: V5_1_4a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6a467f90215dfad36d6e5e07e91881858d759b69;p=modules%2Fjobmanager.git - Study Management --- diff --git a/src/genericgui/BL_GenericGui.cxx b/src/genericgui/BL_GenericGui.cxx index 022f939..888b84b 100644 --- a/src/genericgui/BL_GenericGui.cxx +++ b/src/genericgui/BL_GenericGui.cxx @@ -80,14 +80,14 @@ BL::GenericGui::GenericGui(BL::MainWindows_Wrap * wrapper) : QObject(wrapper->ge /* Summary */ _dw_summary = new QDockWidget(_dock_parent); _dw_summary->setWindowTitle("Summary"); - _summary = new BL::Summary(_dock_parent, _jobs_manager); + _summary = new BL::Summary(_dw_summary, _jobs_manager); _summary->setModel(_model); _dw_summary->setWidget(_summary); /* ResourceCatalog */ _dw_resource_catalog = new QDockWidget(_dock_parent); _dw_resource_catalog->setWindowTitle("Resource Catalog"); - _resource_catalog = new JM::ResourceCatalog(_dock_parent, _salome_services); + _resource_catalog = new JM::ResourceCatalog(_dw_resource_catalog, _salome_services); _dw_resource_catalog->setWidget(_resource_catalog); /* Main Dock Window */ @@ -122,10 +122,21 @@ BL::GenericGui::GenericGui(BL::MainWindows_Wrap * wrapper) : QObject(wrapper->ge BL::GenericGui::~GenericGui() { DEBTRACE("Destroying BL::GenericGui"); - delete _salome_services; } +void +BL::GenericGui::deleteDockWidget() +{ + // Specific for SALOME... + _dock_parent->removeDockWidget(_dw_summary); + delete _dw_summary; + _dock_parent->removeDockWidget(_dw_resource_catalog); + delete _dw_resource_catalog; + _dock_parent->removeDockWidget(_jobs_manager); + delete _jobs_manager; +} + void BL::GenericGui::showDockWidgets(bool isVisible) { diff --git a/src/genericgui/BL_GenericGui.hxx b/src/genericgui/BL_GenericGui.hxx index bc623b6..3f7d8e1 100644 --- a/src/genericgui/BL_GenericGui.hxx +++ b/src/genericgui/BL_GenericGui.hxx @@ -52,6 +52,9 @@ namespace BL void delete_job_internal(); + void deleteDockWidget(); + + public slots: void create_job(); void edit_clone_job(); diff --git a/src/genericgui/BL_MainButtons.cxx b/src/genericgui/BL_MainButtons.cxx deleted file mode 100644 index e69de29..0000000 diff --git a/src/genericgui/BL_MainButtons.hxx b/src/genericgui/BL_MainButtons.hxx deleted file mode 100644 index e69de29..0000000 diff --git a/src/salomegui/BL_SalomeGui.cxx b/src/salomegui/BL_SalomeGui.cxx index 5895d94..81226e4 100644 --- a/src/salomegui/BL_SalomeGui.cxx +++ b/src/salomegui/BL_SalomeGui.cxx @@ -29,6 +29,10 @@ BL::SalomeGui::SalomeGui() : MainWindows_SALOME("JobManager"), BL::SalomeGui::~SalomeGui() { DEBTRACE("Destroying BL::SalomeGui"); + if (getApp()) + disconnect(getApp(), SIGNAL(studyClosed()), this, SLOT(studyClosed())); + if (_gengui) + delete _gengui; } void @@ -36,12 +40,18 @@ BL::SalomeGui::initialize(CAM_Application* app) { DEBTRACE("Entering in initialize"); SalomeApp_Module::initialize(app); // MANDATORY -> Otherwise SISEGV... - BL::MainWindows_SALOME::initialize(getApp()); + connect( getApp(), SIGNAL(studyClosed()), this, SLOT(studyClosed())); +} - _gengui = new BL::GenericGui(this); - _gengui->createActions(); - _gengui->createMenus(); - _gengui->updateButtonsStates(); +void +BL::SalomeGui::studyClosed() +{ + if (_gengui) + { + _gengui->deleteDockWidget(); + delete _gengui; + _gengui = NULL; + } } bool @@ -49,9 +59,17 @@ BL::SalomeGui::activateModule(SUIT_Study* theStudy) { DEBTRACE("Entering in BL::SalomeGui::activateModule"); + if (!_gengui) + { + BL::MainWindows_SALOME::initialize(getApp()); + _gengui = new BL::GenericGui(this); + _gengui->createActions(); + _gengui->createMenus(); + _gengui->updateButtonsStates(); + } + bool bOk = SalomeApp_Module::activateModule(theStudy); setMenuShown(true); - _gengui->showDockWidgets(true); return bOk; } @@ -68,9 +86,9 @@ bool BL::SalomeGui::deactivateModule(SUIT_Study* theStudy) { DEBTRACE("Entering in BL::SalomeGui::deactivateModule"); - setMenuShown(false); - _gengui->showDockWidgets(false); + if (_gengui) + _gengui->showDockWidgets(false); bool bOk = SalomeApp_Module::deactivateModule(theStudy); return bOk; } diff --git a/src/salomegui/BL_SalomeGui.hxx b/src/salomegui/BL_SalomeGui.hxx index c72142d..b072f63 100644 --- a/src/salomegui/BL_SalomeGui.hxx +++ b/src/salomegui/BL_SalomeGui.hxx @@ -44,6 +44,7 @@ namespace BL public slots: bool deactivateModule( SUIT_Study* theStudy); bool activateModule( SUIT_Study* theStudy); + void studyClosed(); protected: BL::GenericGui * _gengui;