From: ribes Date: Thu, 7 Jan 2010 10:40:33 +0000 (+0000) Subject: - Compile with KERNEL interface X-Git-Tag: V5_1_4a1~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=76ee82427c7a42cacac73ffc546621f84432aefd;p=modules%2Fjobmanager.git - Compile with KERNEL interface - Machine to Resource --- diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index 2d22f93..9581175 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -31,7 +31,7 @@ BL::Job::Job() _batch_params.expected_memory = ""; _batch_params.nb_proc = 0; _files_params.result_directory = ""; - _machine_choosed = ""; + _resource_choosed = ""; _batch_queue = ""; _state = BL::Job::CREATED; _thread_state = BL::Job::NOTHING; @@ -50,7 +50,7 @@ BL::Job::Job(const std::string & name) _batch_params.expected_memory = ""; _batch_params.nb_proc = 0; _files_params.result_directory = ""; - _machine_choosed = ""; + _resource_choosed = ""; _batch_queue = ""; _state = BL::Job::CREATED; _thread_state = BL::Job::NOTHING; @@ -150,15 +150,15 @@ BL::Job::getFilesParameters() } void -BL::Job::setMachine(std::string & machine) +BL::Job::setResource(std::string & resource) { - _machine_choosed = machine; + _resource_choosed = resource; } std::string & -BL::Job::getMachine() +BL::Job::getResource() { - return _machine_choosed; + return _resource_choosed; } void diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index 3ea4658..df38b68 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -68,8 +68,8 @@ namespace BL{ void setFilesParameters(BL::Job::FilesParam & param); BL::Job::FilesParam & getFilesParameters(); - void setMachine(std::string & machine); - std::string & getMachine(); + void setResource(std::string & resource); + std::string & getResource(); void setBatchQueue(std::string & queue); std::string & getBatchQueue(); @@ -99,7 +99,7 @@ namespace BL{ BL::Job::BatchParam _batch_params; BL::Job::FilesParam _files_params; - std::string _machine_choosed; + std::string _resource_choosed; std::string _batch_queue; int _salome_launcher_id; diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 4ecb47b..16910da 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -64,23 +64,23 @@ BL::SALOMEServices::initNS() } std::list -BL::SALOMEServices::getMachineList() +BL::SALOMEServices::getResourceList() { - std::list machine_list; + std::list resource_list; if (_state) { - Engines::MachineParameters params; + Engines::ResourceParameters params; _lcc->preSet(params); - Engines::MachineList * machineList = _resources_manager->GetFittingResources(params); - for (int i = 0; i < machineList->length(); i++) + Engines::ResourceList * resourceList = _resources_manager->GetFittingResources(params); + for (int i = 0; i < resourceList->length(); i++) { - const char* aMachine = (*machineList)[i]; - machine_list.push_back(aMachine); + const char* aResource = (*resourceList)[i]; + resource_list.push_back(aResource); } } - return machine_list; + return resource_list; } std::string @@ -94,12 +94,12 @@ BL::SALOMEServices::create_job(BL::Job * job) if (job->getType() == BL::Job::COMMAND) { job_parameters->job_type = CORBA::string_dup("command"); - job_parameters->command = CORBA::string_dup(job->getCommand().c_str()); + job_parameters->job_file = CORBA::string_dup(job->getCommand().c_str()); } else if (job->getType() == BL::Job::YACS_SCHEMA) { job_parameters->job_type = CORBA::string_dup("yacs_file"); - job_parameters->yacs_file = CORBA::string_dup(job->getYACSFile().c_str()); + job_parameters->job_file = CORBA::string_dup(job->getYACSFile().c_str()); } // Files @@ -130,7 +130,7 @@ BL::SALOMEServices::create_job(BL::Job * job) // Resource job_parameters->maximum_duration = CORBA::string_dup(cpp_batch_params.maximum_duration.c_str()); - job_parameters->resource_required.hostname = CORBA::string_dup(job->getMachine().c_str()); + job_parameters->resource_required.name = CORBA::string_dup(job->getResource().c_str()); job_parameters->resource_required.nb_node = cpp_batch_params.nb_proc; job_parameters->queue = CORBA::string_dup(job->getBatchQueue().c_str()); diff --git a/src/engine/BL_SALOMEServices.hxx b/src/engine/BL_SALOMEServices.hxx index ef8ac95..c81f022 100644 --- a/src/engine/BL_SALOMEServices.hxx +++ b/src/engine/BL_SALOMEServices.hxx @@ -41,7 +41,7 @@ namespace BL{ bool initNS(); - std::list getMachineList(); + std::list getResourceList(); std::string create_job(BL::Job * job); std::string start_job(BL::Job * job); diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index ad54e2d..733a2cb 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -37,7 +37,7 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO result_directory = ""; - machine_choosed = ""; + resource_choosed = ""; batch_queue = ""; start_job = false; @@ -49,7 +49,7 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO setPage(Page_BatchParameters, new BL::BatchParametersPage(this)); setPage(Page_Files, new BL::FilesPage(this)); setPage(Page_Command_Main_Definitions, new BL::CommandMainPage(this)); - setPage(Page_Machine, new BL::MachinePage(this, salome_services)); + setPage(Page_Resource, new BL::ResourcePage(this, salome_services)); setPage(Page_Conclusion, new BL::CreateJobWizard::ConclusionPage(this)); setWindowTitle("Create Job Wizard"); @@ -130,9 +130,9 @@ BL::CreateJobWizard::end(int result) output_files_list.push_back(item_text.toStdString()); } - // Machine list - QString f_machine_choosed = field("machine_choosed").toString(); - machine_choosed = f_machine_choosed.toStdString(); + // Resource list + QString f_resource_choosed = field("resource_choosed").toString(); + resource_choosed = f_resource_choosed.toStdString(); // Batch Queue QString f_batch_queue = field("batch_queue").toString(); @@ -651,7 +651,7 @@ BL::FilesPage::output_itemSelectionChanged() int BL::FilesPage::nextId() const { - return BL::CreateJobWizard::Page_Machine; + return BL::CreateJobWizard::Page_Resource; } BL::CreateJobWizard::ConclusionPage::ConclusionPage(QWidget * parent) @@ -680,77 +680,77 @@ BL::CreateJobWizard::ConclusionPage::nextId() const return -1; } -BL::MachinePage::MachinePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services) +BL::ResourcePage::ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services) : QWizardPage(parent) { _salome_services = salome_services; - setTitle("Select a Machine"); + setTitle("Select a Resource"); - QLabel * main_label = new QLabel("In this step you select the machine of your job"); + QLabel * main_label = new QLabel("In this step you select the resource of your job"); main_label->setWordWrap(true); - // input_Machine - QGroupBox * machine_group_box = new QGroupBox("Machine List"); - _machine_list = new QListWidget(); - _machine_list->setSelectionMode(QAbstractItemView::SingleSelection); - std::list machine_list = _salome_services->getMachineList(); + // input_Resource + QGroupBox * resource_group_box = new QGroupBox("Resource List"); + _resource_list = new QListWidget(); + _resource_list->setSelectionMode(QAbstractItemView::SingleSelection); + std::list resource_list = _salome_services->getResourceList(); std::list::iterator it; - for (it = machine_list.begin(); it != machine_list.end(); it++) + for (it = resource_list.begin(); it != resource_list.end(); it++) { - std::string machine = *it; - _machine_list->addItem(QString(machine.c_str())); + std::string resource = *it; + _resource_list->addItem(QString(resource.c_str())); } - connect(_machine_list, SIGNAL(itemSelectionChanged()), this, SLOT(machine_itemSelectionChanged())); - QVBoxLayout * machine_list_layout = new QVBoxLayout(); - machine_list_layout->addWidget(_machine_list); - machine_group_box->setLayout(machine_list_layout); + connect(_resource_list, SIGNAL(itemSelectionChanged()), this, SLOT(resource_itemSelectionChanged())); + QVBoxLayout * resource_list_layout = new QVBoxLayout(); + resource_list_layout->addWidget(_resource_list); + resource_group_box->setLayout(resource_list_layout); - QLabel * machine_label = new QLabel("Machine selected: "); - _machine_choosed = new QLineEdit(); - _machine_choosed->setText(""); - _machine_choosed->setReadOnly(true); - registerField("machine_choosed", _machine_choosed); + QLabel * resource_label = new QLabel("Resource selected: "); + _resource_choosed = new QLineEdit(); + _resource_choosed->setText(""); + _resource_choosed->setReadOnly(true); + registerField("resource_choosed", _resource_choosed); QLabel * bqLabel = new QLabel("Batch Queue (optional):"); QLineEdit * _bqLineEdit = new QLineEdit(this); registerField("batch_queue", _bqLineEdit); QGridLayout * main_layout = new QGridLayout; - main_layout->addWidget(machine_group_box, 0, 0, 1, -1); - main_layout->addWidget(machine_label, 1, 0); - main_layout->addWidget(_machine_choosed, 1, 1); + main_layout->addWidget(resource_group_box, 0, 0, 1, -1); + main_layout->addWidget(resource_label, 1, 0); + main_layout->addWidget(_resource_choosed, 1, 1); main_layout->addWidget(bqLabel, 2, 0); main_layout->addWidget(_bqLineEdit, 2, 1); setLayout(main_layout); }; -BL::MachinePage::~MachinePage() +BL::ResourcePage::~ResourcePage() {} bool -BL::MachinePage::validatePage() +BL::ResourcePage::validatePage() { - QString machine_choosed = field("machine_choosed").toString(); - if (machine_choosed == "") + QString resource_choosed = field("resource_choosed").toString(); + if (resource_choosed == "") { - QMessageBox::warning(NULL, "Machine Error", "Please choose a machine"); + QMessageBox::warning(NULL, "Resource Error", "Please choose a resource"); return false; } return true; } void -BL::MachinePage::machine_itemSelectionChanged() +BL::ResourcePage::resource_itemSelectionChanged() { - _machine_choosed->setReadOnly(false); - QList list = _machine_list->selectedItems(); + _resource_choosed->setReadOnly(false); + QList list = _resource_list->selectedItems(); QListWidgetItem * item = list.at(0); - _machine_choosed->setText(item->text()); - _machine_choosed->setReadOnly(true); + _resource_choosed->setText(item->text()); + _resource_choosed->setReadOnly(true); } int -BL::MachinePage::nextId() const +BL::ResourcePage::nextId() const { return BL::CreateJobWizard::Page_Conclusion; } diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index 3b36b2c..ffd6612 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -70,14 +70,14 @@ namespace BL{ std::list input_files_list; std::list output_files_list; - std::string machine_choosed; + std::string resource_choosed; std::string batch_queue; bool start_job; public: enum {Page_JobName, Page_YACSSchema, Page_BatchParameters, Page_Files, - Page_Command_Main_Definitions, Page_Machine, Page_Conclusion}; + Page_Command_Main_Definitions, Page_Resource, Page_Conclusion}; class JobNamePage: virtual public QWizardPage { @@ -190,23 +190,23 @@ namespace BL{ QListWidget * _output_files_list; }; - class MachinePage: virtual public QWizardPage + class ResourcePage: virtual public QWizardPage { Q_OBJECT public: - MachinePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services); - virtual ~MachinePage(); + ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services); + virtual ~ResourcePage(); virtual int nextId() const; virtual bool validatePage(); public slots: - void machine_itemSelectionChanged(); + void resource_itemSelectionChanged(); private: - QListWidget * _machine_list; - QLineEdit * _machine_choosed; + QListWidget * _resource_list; + QLineEdit * _resource_choosed; BL::SALOMEServices * _salome_services; }; } diff --git a/src/genericgui/BL_GenericGui.cxx b/src/genericgui/BL_GenericGui.cxx index 49d37af..66aae0d 100644 --- a/src/genericgui/BL_GenericGui.cxx +++ b/src/genericgui/BL_GenericGui.cxx @@ -82,18 +82,18 @@ BL::GenericGui::GenericGui(BL::MainWindows_Wrap * wrapper) : QObject(wrapper->ge _summary->setModel(_model); _dw_summary->setWidget(_summary); - /* MachineCatalog */ - _dw_machine_catalog = new QDockWidget(_dock_parent); - _dw_machine_catalog->setWindowTitle("Machine Catalog"); - _machine_catalog = new BL::MachineCatalog(_dock_parent, _salome_services); - _dw_machine_catalog->setWidget(_machine_catalog); + /* ResourceCatalog */ + _dw_resource_catalog = new QDockWidget(_dock_parent); + _dw_resource_catalog->setWindowTitle("Resource Catalog"); + _resource_catalog = new JM::ResourceCatalog(_dock_parent, _salome_services); + _dw_resource_catalog->setWidget(_resource_catalog); /* Main Dock Window */ _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _jobs_manager); _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_summary); - _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_machine_catalog); + _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_resource_catalog); _dock_parent->splitDockWidget(_jobs_manager, _dw_summary, Qt::Vertical); - _dock_parent->tabifyDockWidget(_dw_summary, _dw_machine_catalog); + _dock_parent->tabifyDockWidget(_dw_summary, _dw_resource_catalog); /* Signals and Slots */ @@ -130,7 +130,7 @@ BL::GenericGui::showDockWidgets(bool isVisible) DEBTRACE("BL::GenericGui::showDockWidgets " << isVisible); if (_jobs_manager) _jobs_manager->setVisible(isVisible); if (_dw_summary) _dw_summary->setVisible(isVisible); - if (_dw_machine_catalog) _dw_machine_catalog->setVisible(isVisible); + if (_dw_resource_catalog) _dw_resource_catalog->setVisible(isVisible); } void diff --git a/src/genericgui/BL_GenericGui.hxx b/src/genericgui/BL_GenericGui.hxx index 161a24e..5a80e5e 100644 --- a/src/genericgui/BL_GenericGui.hxx +++ b/src/genericgui/BL_GenericGui.hxx @@ -34,7 +34,7 @@ #include "BL_JobTab.hxx" #include "BL_Buttons.hxx" #include "BL_Summary.hxx" -#include "BL_MachineCatalog.hxx" +#include "JM_ResourceCatalog.hxx" namespace BL { @@ -72,7 +72,7 @@ namespace BL QMainWindow * _dock_parent; QMainWindow * _tab_parent; QDockWidget * _dw_summary; - QDockWidget * _dw_machine_catalog; + QDockWidget * _dw_resource_catalog; BL::Buttons * _buttons; BL::JobsTable * _jobs_table; @@ -88,7 +88,7 @@ namespace BL BL::JobsManager_QT * _jobs_manager; BL::QModelManager * _model_manager; QStandardItemModel * _model; - BL::MachineCatalog * _machine_catalog; + JM::ResourceCatalog * _resource_catalog; int _row_selected; QString _job_name_selected; diff --git a/src/genericgui/BL_JobTab.cxx b/src/genericgui/BL_JobTab.cxx index 3be18ad..c78d93c 100644 --- a/src/genericgui/BL_JobTab.cxx +++ b/src/genericgui/BL_JobTab.cxx @@ -61,8 +61,8 @@ BL::JobTab::createJobSummaryTab() _job_type_label_value = new QLabel(""); QLabel * job_state_label = new QLabel("State:"); _job_state_label_value = new QLabel(""); - QLabel * job_machine_label = new QLabel("Machine:"); - _job_machine_label_value = new QLabel(""); + QLabel * job_resource_label = new QLabel("Resource:"); + _job_resource_label_value = new QLabel(""); _job_command_label = new QLabel("Schema or Command:"); _job_command_label_value = new QLabel(""); @@ -71,7 +71,7 @@ BL::JobTab::createJobSummaryTab() values_form->insertRow(0, job_name_label, _job_name_label_value); values_form->insertRow(1, job_type_label, _job_type_label_value); values_form->insertRow(2, job_state_label, _job_state_label_value); - values_form->insertRow(3, job_machine_label, _job_machine_label_value); + values_form->insertRow(3, job_resource_label, _job_resource_label_value); values_form->insertRow(4, _job_command_label, _job_command_label_value); main_values_box->setLayout(values_form); @@ -177,7 +177,7 @@ BL::JobTab::job_selected(const QModelIndex & index) _job_type_label_value->setText("Command"); } - _job_machine_label_value->setText(QString(job->getMachine().c_str())); + _job_resource_label_value->setText(QString(job->getResource().c_str())); BL::Job::BatchParam batch_params = job->getBatchParameters(); @@ -243,7 +243,7 @@ BL::JobTab::reset(QString job_name) _job_name_label_value->setText(""); _job_type_label_value->setText(""); _job_state_label_value->setText(""); - _job_machine_label_value->setText(""); + _job_resource_label_value->setText(""); _job_nif_label_value->setText(""); _job_nof_label_value->setText(""); _job_bd_label_value->setText(""); diff --git a/src/genericgui/BL_JobTab.hxx b/src/genericgui/BL_JobTab.hxx index 7f1031e..cd40316 100644 --- a/src/genericgui/BL_JobTab.hxx +++ b/src/genericgui/BL_JobTab.hxx @@ -54,7 +54,7 @@ namespace BL QLabel * _job_name_label_value; QLabel * _job_type_label_value; QLabel * _job_state_label_value; - QLabel * _job_machine_label_value; + QLabel * _job_resource_label_value; QLabel * _job_command_label; QLabel * _job_command_label_value; diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index bcd1e33..c9d642b 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -173,7 +173,7 @@ BL::JobsManager_QT::create_job_wizard() files_params.input_files_list = wizard.input_files_list; files_params.output_files_list = wizard.output_files_list; new_job->setFilesParameters(files_params); - new_job->setMachine(wizard.machine_choosed); + new_job->setResource(wizard.resource_choosed); new_job->setBatchQueue(wizard.batch_queue); } else @@ -193,7 +193,7 @@ BL::JobsManager_QT::create_job_wizard() files_params.input_files_list = wizard.input_files_list; files_params.output_files_list = wizard.output_files_list; new_job->setFilesParameters(files_params); - new_job->setMachine(wizard.machine_choosed); + new_job->setResource(wizard.resource_choosed); new_job->setBatchQueue(wizard.batch_queue); } addJobToLauncher(wizard.job_name); diff --git a/src/genericgui/BL_MachineCatalog.cxx b/src/genericgui/BL_MachineCatalog.cxx deleted file mode 100644 index eae8ded..0000000 --- a/src/genericgui/BL_MachineCatalog.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2009 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "BL_MachineCatalog.hxx" -#include "BL_Traces.hxx" - -BL::MachineCatalog::MachineCatalog(QWidget *parent, BL::SALOMEServices * salome_services) : QWidget(parent) -{ - DEBTRACE("Creating BL::MachineCatalog"); - BL_ASSERT(parent); - BL_ASSERT(salome_services); - _parent = parent; - _salome_services = salome_services; - - _refresh_button = new QPushButton("Refresh Machine List"); - _refresh_button->show(); - connect(_refresh_button, SIGNAL(clicked()), this, SLOT(refresh_machine_list())); - _machine_files_list = new QListWidget(this); - _machine_files_list->setSelectionMode(QAbstractItemView::NoSelection); - std::list machine_list = _salome_services->getMachineList(); - std::list::iterator it; - for (it = machine_list.begin(); it != machine_list.end(); it++) - { - std::string machine = *it; - _machine_files_list->addItem(QString(machine.c_str())); - } - - QVBoxLayout * mainLayout = new QVBoxLayout(this); - mainLayout->addWidget(_refresh_button); - mainLayout->addWidget(_machine_files_list); - setLayout(mainLayout); -} - -BL::MachineCatalog::~MachineCatalog() -{ - DEBTRACE("Destroying BL::MachineCatalog"); -} - -void -BL::MachineCatalog::refresh_machine_list() -{ - _machine_files_list->clear(); - std::list machine_list = _salome_services->getMachineList(); - std::list::iterator it; - for (it = machine_list.begin(); it != machine_list.end(); it++) - { - std::string machine = *it; - _machine_files_list->addItem(QString(machine.c_str())); - } -} diff --git a/src/genericgui/BL_MachineCatalog.hxx b/src/genericgui/BL_MachineCatalog.hxx deleted file mode 100644 index 95355b4..0000000 --- a/src/genericgui/BL_MachineCatalog.hxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2009 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _BL_MACHINECATALOG_HXX_ -#define _BL_MACHINECATALOG_HXX_ - -#include - -#include "BL_SALOMEServices.hxx" - -#include -#include - -namespace BL -{ - class MachineCatalog: public QWidget - { - Q_OBJECT - - public: - MachineCatalog(QWidget *parent, BL::SALOMEServices * salome_services); - virtual ~MachineCatalog(); - - public slots: - void refresh_machine_list(); - - protected: - QWidget* _parent; - BL::SALOMEServices * _salome_services; - - QPushButton * _refresh_button; - QListWidget * _machine_files_list; - }; -} - -#endif - - diff --git a/src/genericgui/BL_QModelManager.cxx b/src/genericgui/BL_QModelManager.cxx index 6412dd2..e806ac7 100644 --- a/src/genericgui/BL_QModelManager.cxx +++ b/src/genericgui/BL_QModelManager.cxx @@ -27,7 +27,7 @@ BL::QModelManager::QModelManager(QObject * parent, BL::JobsManager_QT * jobs_man _model = new QStandardItemModel(this); QStringList headers; - headers << "Job Name" << "Type" << "State" << "Machine"; + headers << "Job Name" << "Type" << "State" << "Resource"; _model->setHorizontalHeaderLabels(headers); } @@ -70,13 +70,13 @@ BL::QModelManager::new_job_added(const QString & name) else new_job_state = new QStandardItem("Finished"); - QStandardItem * new_job_machine = new QStandardItem(job->getMachine().c_str()); + QStandardItem * new_job_resource = new QStandardItem(job->getResource().c_str()); int row = _model->rowCount(); _model->setItem(row, 0, new_job_name); _model->setItem(row, 1, new_job_type); _model->setItem(row, 2, new_job_state); - _model->setItem(row, 3, new_job_machine); + _model->setItem(row, 3, new_job_resource); } void diff --git a/src/genericgui/JM_ResourceCatalog.cxx b/src/genericgui/JM_ResourceCatalog.cxx new file mode 100644 index 0000000..1ca831a --- /dev/null +++ b/src/genericgui/JM_ResourceCatalog.cxx @@ -0,0 +1,66 @@ +// Copyright (C) 2009 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "JM_ResourceCatalog.hxx" +#include "BL_Traces.hxx" + +JM::ResourceCatalog::ResourceCatalog(QWidget *parent, BL::SALOMEServices * salome_services) : QWidget(parent) +{ + DEBTRACE("Creating JM::ResourceCatalog"); + BL_ASSERT(parent); + BL_ASSERT(salome_services); + _parent = parent; + _salome_services = salome_services; + + _refresh_button = new QPushButton("Refresh Resource List"); + _refresh_button->show(); + connect(_refresh_button, SIGNAL(clicked()), this, SLOT(refresh_resource_list())); + _resource_files_list = new QListWidget(this); + _resource_files_list->setSelectionMode(QAbstractItemView::NoSelection); + std::list resource_list = _salome_services->getResourceList(); + std::list::iterator it; + for (it = resource_list.begin(); it != resource_list.end(); it++) + { + std::string resource = *it; + _resource_files_list->addItem(QString(resource.c_str())); + } + + QVBoxLayout * mainLayout = new QVBoxLayout(this); + mainLayout->addWidget(_refresh_button); + mainLayout->addWidget(_resource_files_list); + setLayout(mainLayout); +} + +JM::ResourceCatalog::~ResourceCatalog() +{ + DEBTRACE("Destroying JM::ResourceCatalog"); +} + +void +JM::ResourceCatalog::refresh_resource_list() +{ + _resource_files_list->clear(); + std::list resource_list = _salome_services->getResourceList(); + std::list::iterator it; + for (it = resource_list.begin(); it != resource_list.end(); it++) + { + std::string resource = *it; + _resource_files_list->addItem(QString(resource.c_str())); + } +} diff --git a/src/genericgui/JM_ResourceCatalog.hxx b/src/genericgui/JM_ResourceCatalog.hxx new file mode 100644 index 0000000..59e3699 --- /dev/null +++ b/src/genericgui/JM_ResourceCatalog.hxx @@ -0,0 +1,54 @@ +// Copyright (C) 2009 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _JM_RESOURCECATALOG_HXX_ +#define _JM_RESOURCECATALOG_HXX_ + +#include + +#include "BL_SALOMEServices.hxx" + +#include +#include + +namespace JM +{ + class ResourceCatalog: public QWidget + { + Q_OBJECT + + public: + ResourceCatalog(QWidget *parent, BL::SALOMEServices * salome_services); + virtual ~ResourceCatalog(); + + public slots: + void refresh_resource_list(); + + protected: + QWidget* _parent; + BL::SALOMEServices * _salome_services; + + QPushButton * _refresh_button; + QListWidget * _resource_files_list; + }; +} + +#endif + + diff --git a/src/genericgui/Makefile.am b/src/genericgui/Makefile.am index e0e69f3..383fd24 100644 --- a/src/genericgui/Makefile.am +++ b/src/genericgui/Makefile.am @@ -29,13 +29,13 @@ libBL_GenericGui_la_SOURCES = BL_GenericGui.hxx BL_GenericGui.cxx \ BL_QModelManager.hxx BL_QModelManager.cxx \ BL_CreateJobWizard.hxx BL_CreateJobWizard.cxx \ BL_Summary.hxx BL_Summary.cxx \ - BL_MachineCatalog.hxx BL_MachineCatalog.cxx + JM_ResourceCatalog.hxx JM_ResourceCatalog.cxx nodist_libBL_GenericGui_la_SOURCES = BL_GenericGui_moc.cxx BL_JobsTable_moc.cxx \ BL_JobTab_moc.cxx \ BL_Buttons_moc.cxx BL_JobsManager_QT_moc.cxx \ BL_QModelManager_moc.cxx BL_CreateJobWizard_moc.cxx \ - BL_Summary_moc.cxx BL_MachineCatalog_moc.cxx + BL_Summary_moc.cxx JM_ResourceCatalog_moc.cxx libBL_GenericGui_la_CXXFLAGS = $(qt4_cppflags) \ -I$(top_srcdir)/src/bases \