]> SALOME platform Git repositories - modules/jobmanager.git/blob - src/genericgui/BL_MachineCatalog.cxx
Salome HOME
eae8ded2dde3ef4c98c1c4ed875ec6fd6418f23a
[modules/jobmanager.git] / src / genericgui / BL_MachineCatalog.cxx
1 //  Copyright (C) 2009 CEA/DEN, EDF R&D
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "BL_MachineCatalog.hxx"
21 #include "BL_Traces.hxx"
22
23 BL::MachineCatalog::MachineCatalog(QWidget *parent, BL::SALOMEServices * salome_services) : QWidget(parent)
24 {
25   DEBTRACE("Creating BL::MachineCatalog");
26   BL_ASSERT(parent);
27   BL_ASSERT(salome_services);
28   _parent = parent;
29   _salome_services = salome_services;
30   
31   _refresh_button = new QPushButton("Refresh Machine List");
32   _refresh_button->show();
33   connect(_refresh_button, SIGNAL(clicked()), this, SLOT(refresh_machine_list()));
34   _machine_files_list = new QListWidget(this);
35   _machine_files_list->setSelectionMode(QAbstractItemView::NoSelection);
36   std::list<std::string> machine_list = _salome_services->getMachineList();
37   std::list<std::string>::iterator it;
38   for (it = machine_list.begin(); it != machine_list.end(); it++)
39   {
40     std::string machine = *it;
41     _machine_files_list->addItem(QString(machine.c_str()));
42   }
43
44   QVBoxLayout * mainLayout = new QVBoxLayout(this);
45   mainLayout->addWidget(_refresh_button);
46   mainLayout->addWidget(_machine_files_list);
47   setLayout(mainLayout);
48 }
49
50 BL::MachineCatalog::~MachineCatalog()
51 {
52   DEBTRACE("Destroying BL::MachineCatalog");
53 }
54
55 void
56 BL::MachineCatalog::refresh_machine_list()
57 {
58   _machine_files_list->clear();
59   std::list<std::string> machine_list = _salome_services->getMachineList();
60   std::list<std::string>::iterator it;
61   for (it = machine_list.begin(); it != machine_list.end(); it++)
62   {
63     std::string machine = *it;
64     _machine_files_list->addItem(QString(machine.c_str()));
65   }
66 }