]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
- Study Management
authorribes <ribes>
Tue, 26 Jan 2010 12:29:31 +0000 (12:29 +0000)
committerribes <ribes>
Tue, 26 Jan 2010 12:29:31 +0000 (12:29 +0000)
src/genericgui/BL_GenericGui.cxx
src/genericgui/BL_GenericGui.hxx
src/genericgui/BL_MainButtons.cxx [deleted file]
src/genericgui/BL_MainButtons.hxx [deleted file]
src/salomegui/BL_SalomeGui.cxx
src/salomegui/BL_SalomeGui.hxx

index 022f939200a52cf29981e9a8cb0fb9d74f63e9b8..888b84b00521f9a67e52c60a9a393bb147c8aaa2 100644 (file)
@@ -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)
 {
index bc623b6943d1f28dceec8fae9326e9e18bebb55e..3f7d8e1b37de3e3722dc4389e1030a82c88f4bea 100644 (file)
@@ -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 (file)
index e69de29..0000000
diff --git a/src/genericgui/BL_MainButtons.hxx b/src/genericgui/BL_MainButtons.hxx
deleted file mode 100644 (file)
index e69de29..0000000
index 5895d94a242a99e113ccd68e2e17e79d751adf26..81226e4f569dc394fcd42c7c9d68a1a2f66fef73 100644 (file)
@@ -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;
 }
index c72142d9f272b550268e7d02c750fe28006a8afa..b072f639baed64dd6ba9eb845e666874966fec26 100644 (file)
@@ -44,6 +44,7 @@ namespace BL
     public slots:
       bool deactivateModule( SUIT_Study* theStudy);
       bool activateModule( SUIT_Study* theStudy);
+      void studyClosed();
 
     protected:
       BL::GenericGui * _gengui;