1 // Copyright (C) 2019 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, or (at your option) any later version.
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
19 #include "QuickConfig.hxx"
23 QuickConfigWidget::QuickConfigWidget(ydefx::JobParametersProxy& model,
28 QWidget* mainWidget = new QWidget();
29 QVBoxLayout *mainLayout = new QVBoxLayout();
30 mainWidget->setLayout(mainLayout);
32 QHBoxLayout *hLayout = new QHBoxLayout();
33 QComboBox* resourcesComboBox = new QComboBox;
34 std::list<std::string> resources = _model.AvailableResources();
35 for(const std::string& it : resources)
36 resourcesComboBox->addItem(QString(it.c_str()));
37 resourcesComboBox->setCurrentIndex(
38 resourcesComboBox->findText(model.resource_name().c_str()));
39 connect(resourcesComboBox, SIGNAL(currentIndexChanged( const QString &)),
40 this, SLOT(updateResource( const QString &)));
42 QLabel * resourcesLabel = new QLabel(tr("Computing resource:"));
43 hLayout->addWidget(resourcesLabel);
44 hLayout->addWidget(resourcesComboBox);
45 mainLayout->addLayout(hLayout);
47 QLabel *nb_branchesLabel = new QLabel(tr("Number of parallel evaluations:"));
48 QSpinBox *nb_branchesEdit = new QSpinBox();
49 nb_branchesEdit->setRange(1, 10000);
50 nb_branchesEdit->setValue(_model.nb_branches());
51 hLayout = new QHBoxLayout();
52 hLayout->addWidget(nb_branchesLabel);
53 hLayout->addWidget(nb_branchesEdit);
54 mainLayout->addLayout(hLayout);
55 connect(this, SIGNAL(defaultNbBranches(int)),
56 nb_branchesEdit, SLOT(setValue(int)));
57 connect(nb_branchesEdit, SIGNAL(valueChanged(int)),
58 this, SLOT(updateNbBranches(int)));
60 mainLayout->addStretch();
61 setWidget(mainWidget);
62 setWidgetResizable (true);
65 QuickConfigWidget::~QuickConfigWidget()
69 void QuickConfigWidget::updateResource(const QString& value)
71 _model.configureResource(value.toStdString());
72 emit defaultNbBranches(_model.nb_branches());
73 emit defaultWorkingDir(_model.work_directory().c_str());
74 emit defaultWcKey(_model.wckey().c_str());
77 void QuickConfigWidget::updateNbBranches(int value)
79 _model.nb_branches(value);
80 emit defaultNbBranches(value);