1 // Copyright (C) 2009 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "BL_MachineCatalog.hxx"
21 #include "BL_Traces.hxx"
23 BL::MachineCatalog::MachineCatalog(QWidget *parent, BL::SALOMEServices * salome_services) : QWidget(parent)
25 DEBTRACE("Creating BL::MachineCatalog");
27 BL_ASSERT(salome_services);
29 _salome_services = salome_services;
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++)
40 std::string machine = *it;
41 _machine_files_list->addItem(QString(machine.c_str()));
44 QVBoxLayout * mainLayout = new QVBoxLayout(this);
45 mainLayout->addWidget(_refresh_button);
46 mainLayout->addWidget(_machine_files_list);
47 setLayout(mainLayout);
50 BL::MachineCatalog::~MachineCatalog()
52 DEBTRACE("Destroying BL::MachineCatalog");
56 BL::MachineCatalog::refresh_machine_list()
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++)
63 std::string machine = *it;
64 _machine_files_list->addItem(QString(machine.c_str()));