]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
- Wizard use now the widget JM::ResourceCatalog
authorribes <ribes>
Wed, 20 Jan 2010 09:43:56 +0000 (09:43 +0000)
committerribes <ribes>
Wed, 20 Jan 2010 09:43:56 +0000 (09:43 +0000)
src/genericgui/BL_CreateJobWizard.cxx
src/genericgui/BL_CreateJobWizard.hxx
src/genericgui/JM_ResourceCatalog.cxx
src/genericgui/JM_ResourceCatalog.hxx
src/genericgui/JM_SalomeResource.cxx
src/genericgui/JM_SalomeResource.hxx

index 6d6e6d2094a710d6b425ca8ef3828fd982b83d8b..189b41921a5918cebcf09bf2fe4c4095541ea7be 100644 (file)
@@ -712,16 +712,9 @@ BL::ResourcePage::ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices
 
   // input_Resource
   QGroupBox * resource_group_box = new QGroupBox("Resource List");
-  _resource_list = new QListWidget();
-  _resource_list->setSelectionMode(QAbstractItemView::SingleSelection);
-  std::list<std::string> resource_list = _salome_services->getResourceList();
-  std::list<std::string>::iterator it;
-  for (it = resource_list.begin(); it != resource_list.end(); it++)
-  {
-    std::string resource = *it;
-    _resource_list->addItem(QString(resource.c_str()));
-  }
-  connect(_resource_list, SIGNAL(itemSelectionChanged()), this, SLOT(resource_itemSelectionChanged()));
+  _resource_list = new JM::ResourceCatalog(this, _salome_services);
+  connect(_resource_list->getQListWidget(), SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(itemSelected(QListWidgetItem*)));
+
   QVBoxLayout * resource_list_layout = new QVBoxLayout();
   resource_list_layout->addWidget(_resource_list);
   resource_group_box->setLayout(resource_list_layout);
@@ -761,11 +754,9 @@ BL::ResourcePage::validatePage()
 }
 
 void 
-BL::ResourcePage::resource_itemSelectionChanged()
+BL::ResourcePage::itemSelected(QListWidgetItem * item)
 {
   _resource_choosed->setReadOnly(false);
-  QList<QListWidgetItem *> list = _resource_list->selectedItems();
-  QListWidgetItem * item = list.at(0);
   _resource_choosed->setText(item->text());
   _resource_choosed->setReadOnly(true);
 }
index 20fdce648aee364392155326946d28f707396f5c..609c1ebf50b9d0f86f20f0854f42af147de4b56f 100644 (file)
@@ -25,6 +25,7 @@
 #include "BL_Traces.hxx"
 #include "BL_JobsManager_QT.hxx"
 #include "BL_SALOMEServices.hxx"
+#include "JM_ResourceCatalog.hxx"
 
 #include <string>
 #include <list>
@@ -167,10 +168,10 @@ namespace BL{
       virtual bool validatePage();
 
     public slots:
-      void resource_itemSelectionChanged();
+      void itemSelected(QListWidgetItem * item);
 
     private:
-      QListWidget * _resource_list;
+      JM::ResourceCatalog * _resource_list;
       QLineEdit * _resource_choosed;
       BL::SALOMEServices * _salome_services;
   };
index 464813aeb86c6ff278a3828280d157ff89f227d2..e881cde579b21e02ff027ea6d201628df349837c 100644 (file)
@@ -54,6 +54,12 @@ JM::ResourceCatalog::~ResourceCatalog()
   DEBTRACE("Destroying JM::ResourceCatalog");
 }
 
+QListWidget * 
+JM::ResourceCatalog::getQListWidget()
+{
+  return _resource_files_list;
+}
+
 void
 JM::ResourceCatalog::refresh_resource_list()
 {
@@ -73,8 +79,7 @@ JM::ResourceCatalog::item_choosed(QListWidgetItem * item)
   DEBTRACE("JM::ResourceCatalog::item_choosed");
   JM::SalomeResource * resource_widget = new JM::SalomeResource(this, 
                                                                _salome_services,
-                                                               item->text().toStdString(),
-                                                               false);
+                                                               item->text().toStdString());
   resource_widget->exec();
   delete resource_widget;
 }
index 731430cb72b13475e4450a98c601e0672491cee3..c7bf5e04c7006266da913716ee0b0c1047cd70a0 100644 (file)
@@ -39,6 +39,8 @@ namespace JM
 
       void get_infos();
 
+      QListWidget * getQListWidget();
+
     public slots:
       void refresh_resource_list();
       void item_choosed(QListWidgetItem * item);
index 83e48495eb185cf12bdef470626f92864385fe73..6d096935d299c2662f7b15afccd71318e592f360 100644 (file)
@@ -21,7 +21,7 @@
 #include "BL_Traces.hxx"
 
 JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_services, 
-                                  const std::string & resource_name, bool edit) : QDialog(parent)
+                                  const std::string & resource_name) : QDialog(parent)
 {
   DEBTRACE("Creating JM::SalomeResource");
   BL_ASSERT(parent);
@@ -29,7 +29,6 @@ JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_
   _parent = parent;
   _salome_services = salome_services;
   _resource_name = resource_name;
-  _edit = edit;
 
   // Widget code
   QGroupBox * main_groupBox = new QGroupBox("Main values");
@@ -104,43 +103,37 @@ JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_
   mainLayout->addWidget(config_groupBox);
   setLayout(mainLayout);
 
-  if (_edit)
-  {
-    setWindowTitle("Add a new resource");
-  }
-  else
-  {
-    setWindowTitle("Resource");
-    get_infos();
-    // Line cannot be changed
-    _name_line->setCursorPosition(0);
-    _hostname_line->setCursorPosition(0);
-    _protocol_line->setCursorPosition(0);
-    _username_line->setCursorPosition(0);
-    _applipath_line->setCursorPosition(0);
-    _os_line->setCursorPosition(0);
-    _mem_mb_line->setCursorPosition(0);
-    _cpu_clock_line->setCursorPosition(0);
-    _nb_node_line->setCursorPosition(0);
-    _nb_proc_per_node_line->setCursorPosition(0);
-    _batch_line->setCursorPosition(0);
-    _mpiImpl_line->setCursorPosition(0);
-    _iprotocol_line->setCursorPosition(0);
+  setWindowTitle("Resource");
+  get_infos();
 
-    _name_line->setReadOnly(true);
-    _hostname_line->setReadOnly(true);
-    _protocol_line->setReadOnly(true);
-    _username_line->setReadOnly(true);
-    _applipath_line->setReadOnly(true);
-    _os_line->setReadOnly(true);
-    _mem_mb_line->setReadOnly(true);
-    _cpu_clock_line->setReadOnly(true);
-    _nb_node_line->setReadOnly(true);
-    _nb_proc_per_node_line->setReadOnly(true);
-    _batch_line->setReadOnly(true);
-    _mpiImpl_line->setReadOnly(true);
-    _iprotocol_line->setReadOnly(true);
-  }
+  // Line cannot be changed
+  _name_line->setCursorPosition(0);
+  _hostname_line->setCursorPosition(0);
+  _protocol_line->setCursorPosition(0);
+  _username_line->setCursorPosition(0);
+  _applipath_line->setCursorPosition(0);
+  _os_line->setCursorPosition(0);
+  _mem_mb_line->setCursorPosition(0);
+  _cpu_clock_line->setCursorPosition(0);
+  _nb_node_line->setCursorPosition(0);
+  _nb_proc_per_node_line->setCursorPosition(0);
+  _batch_line->setCursorPosition(0);
+  _mpiImpl_line->setCursorPosition(0);
+  _iprotocol_line->setCursorPosition(0);
+
+  _name_line->setReadOnly(true);
+  _hostname_line->setReadOnly(true);
+  _protocol_line->setReadOnly(true);
+  _username_line->setReadOnly(true);
+  _applipath_line->setReadOnly(true);
+  _os_line->setReadOnly(true);
+  _mem_mb_line->setReadOnly(true);
+  _cpu_clock_line->setReadOnly(true);
+  _nb_node_line->setReadOnly(true);
+  _nb_proc_per_node_line->setReadOnly(true);
+  _batch_line->setReadOnly(true);
+  _mpiImpl_line->setReadOnly(true);
+  _iprotocol_line->setReadOnly(true);
 }
 
 JM::SalomeResource::~SalomeResource()
index 4daf7a0d7f3a8840a88a51d2c3306b64f20c1829..b71b4494c5e4e777124d8231189deaa044d88bd8 100644 (file)
@@ -33,7 +33,7 @@ namespace JM
 
     public:
       SalomeResource(QWidget *parent, BL::SALOMEServices * salome_services, 
-                    const std::string & resource_name, bool edit);
+                    const std::string & resource_name);
       virtual ~SalomeResource();
 
       void get_infos();
@@ -42,7 +42,6 @@ namespace JM
       QWidget* _parent;
       BL::SALOMEServices * _salome_services;
       std::string _resource_name;
-      bool _edit;
 
       // widget
       QLineEdit * _name_line;