// 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);
}
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);
}
#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);
_parent = parent;
_salome_services = salome_services;
_resource_name = resource_name;
- _edit = edit;
// Widget code
QGroupBox * main_groupBox = new QGroupBox("Main values");
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()