37 using namespace YACS::HMI;
38 using namespace YACS::ENGINE;
43 sb_mem->setMaximum(INT_MAX);
44 sb_cpu->setMaximum(INT_MAX);
45 sb_nbNodes->setMaximum(INT_MAX);
46 sb_procNode->setMaximum(INT_MAX);
47 sb_nbprocpar->setMaximum(INT_MAX);
48 sb_nbproc->setMaximum(INT_MAX);
52 connect(cb_policy, SIGNAL(activated(
const QString&)),
this, SLOT(
onModifyPolicy(
const QString&)));
53 connect(cb_parallel, SIGNAL(activated(
const QString&)),
this, SLOT(
onModifyParLib(
const QString&)));
54 connect(le_workdir, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onModifyWorkDir(
const QString&)));
55 connect(le_contname, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onModifyContName(
const QString&)));
56 connect(le_os, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onModifyOS(
const QString&)));
57 connect(le_hostname, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onModifyHostName(
const QString&)));
58 connect(le_compolist, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onModifyCompoList(
const QString&)));
59 connect(le_resourceList, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onModifyResourceList(
const QString&)));
60 connect(ch_mpi, SIGNAL(clicked(
bool)),
this, SLOT(
onModifyIsMPI(
bool)));
61 connect(sb_mem, SIGNAL(valueChanged(
const QString&)),
this, SLOT(
onModifyMem(
const QString&)));
62 connect(sb_cpu, SIGNAL(valueChanged(
const QString&)),
this, SLOT(
onModifyClock(
const QString&)));
63 connect(sb_nbNodes, SIGNAL(valueChanged(
const QString&)),
this, SLOT(
onModifyNodes(
const QString&)));
64 connect(sb_procNode, SIGNAL(valueChanged(
const QString&)),
this, SLOT(
onModifyProcs(
const QString&)));
65 connect(sb_nbprocpar, SIGNAL(valueChanged(
const QString&)),
this, SLOT(
onModifyProcPar(
const QString&)));
66 connect(sb_nbproc, SIGNAL(valueChanged(
const QString&)),
this, SLOT(
onModifyProcRes(
const QString&)));
75 DEBTRACE(
"FormContainer::FillPanel");
87 cb_mode->setText(
"multi");
89 cb_mode->setText(
"mono");
91 vector<string> parlibs;
92 parlibs.push_back(
"");
93 parlibs.push_back(
"Mpi");
94 parlibs.push_back(
"Dummy");
96 for(
int i=0;
i< parlibs.size();
i++)
97 cb_parallel->addItem(parlibs[
i].c_str());
101 for(i=0; i< parlibs.size(); i++)
104 cb_parallel->setCurrentIndex(i);
109 cb_parallel->setCurrentIndex(0);
112 le_workdir->setText(
_properties[
"workingdir"].c_str());
114 le_workdir->setText(
"");
117 le_contname->setText(
_properties[
"container_name"].c_str());
119 le_contname->setText(
"");
125 ch_mpi->setCheckState(Qt::Unchecked);
127 ch_mpi->setCheckState(Qt::Checked);
130 ch_mpi->setCheckState(Qt::Unchecked);
133 sb_nbprocpar->setValue(atoi(
_properties[
"nb_parallel_procs"].c_str()));
135 sb_nbprocpar->setValue(0);
139 if (!QtGuiContext::getQtCurrent()->isEdition())
142 cb_parallel->setEnabled(
false);
143 le_workdir->setReadOnly(
true);
144 le_contname->setReadOnly(
true);
145 ch_mpi->setEnabled(
false);
146 sb_nbprocpar->setReadOnly(
true);
147 le_hostname->setEnabled(
false);
148 le_os->setEnabled(
false);
149 sb_nbproc->setEnabled(
false);
150 sb_mem->setEnabled(
false);
151 sb_cpu->setEnabled(
false);
152 sb_nbNodes->setEnabled(
false);
153 sb_procNode->setEnabled(
false);
154 cb_policy->setEnabled(
false);
155 le_compolist->setEnabled(
false);
156 le_resourceList->setEnabled(
false);
162 DEBTRACE(
"FormContainer::onModified");
163 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
165 YASSERT(QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(sub));
166 QWidget *widget = QtGuiContext::getQtCurrent()->_mapOfEditionItem[sub];
174 DEBTRACE(
"FormContainer::updateResource " << resource);
179 le_hostname->setText(
_properties[
"hostname"].c_str());
181 le_hostname->setText(
"");
182 le_hostname->setEnabled(
true);
188 le_os->setEnabled(
true);
191 sb_nbproc->setValue(atoi(
_properties[
"nb_resource_procs"].c_str()));
193 sb_nbproc->setValue(0);
194 sb_nbproc->setEnabled(
true);
197 sb_mem->setValue(atoi(
_properties[
"mem_mb"].c_str()));
200 sb_mem->setEnabled(
true);
203 sb_cpu->setValue(atoi(
_properties[
"cpu_clock"].c_str()));
206 sb_cpu->setEnabled(
true);
209 sb_nbNodes->setValue(atoi(
_properties[
"nb_node"].c_str()));
211 sb_nbNodes->setValue(0);
212 sb_nbNodes->setEnabled(
true);
215 sb_procNode->setValue(atoi(
_properties[
"nb_proc_per_node"].c_str()));
217 sb_procNode->setValue(0);
218 sb_procNode->setEnabled(
true);
220 std::vector<std::string> policies;
221 policies.push_back(
"cycl");
222 policies.push_back(
"altcycl");
223 policies.push_back(
"best");
224 policies.push_back(
"first");
226 for(
int i=0;
i< policies.size();
i++)
227 cb_policy->addItem(policies[
i].c_str());
231 for(i=0; i< policies.size(); i++)
234 cb_policy->setCurrentIndex(i);
239 cb_policy->setCurrentIndex(1);
240 cb_policy->setEnabled(
true);
243 le_compolist->setText(
_properties[
"component_list"].c_str());
245 le_compolist->setText(
"");
246 le_compolist->setEnabled(
true);
249 le_resourceList->setText(
_properties[
"resource_list"].c_str());
251 le_resourceList->setText(
"");
252 le_resourceList->setEnabled(
true);
259 if(properties.count(
"hostname"))
260 le_hostname->setText(properties[
"hostname"].c_str());
262 le_hostname->setText(
"");
263 le_hostname->setEnabled(
false);
265 if(properties.count(
"OS"))
266 le_os->setText(properties[
"OS"].c_str());
269 le_os->setEnabled(
false);
271 if(properties.count(
"nb_resource_procs"))
272 sb_nbproc->setValue(atoi(properties[
"nb_resource_procs"].c_str()));
274 sb_nbproc->setValue(0);
275 sb_nbproc->setEnabled(
false);
277 if(properties.count(
"mem_mb"))
278 sb_mem->setValue(atoi(properties[
"mem_mb"].c_str()));
281 sb_mem->setEnabled(
false);
283 if(properties.count(
"cpu_clock"))
284 sb_cpu->setValue(atoi(properties[
"cpu_clock"].c_str()));
287 sb_cpu->setEnabled(
false);
289 if(properties.count(
"nb_node"))
290 sb_nbNodes->setValue(atoi(properties[
"nb_node"].c_str()));
292 sb_nbNodes->setValue(0);
293 sb_nbNodes->setEnabled(
false);
295 if(properties.count(
"nb_proc_per_node"))
296 sb_procNode->setValue(atoi(properties[
"nb_proc_per_node"].c_str()));
298 sb_procNode->setValue(0);
299 sb_procNode->setEnabled(
false);
302 cb_policy->setEnabled(
false);
304 if(properties.count(
"component_list"))
305 le_compolist->setText(properties[
"component_list"].c_str());
307 le_compolist->setText(
"");
308 le_compolist->setEnabled(
false);
310 if(properties.count(
"resource_list"))
311 le_resourceList->setText(properties[
"resource_list"].c_str());
313 le_resourceList->setText(
"");
314 le_resourceList->setEnabled(
false);
320 cb_mode->setText(mode.c_str());
325 DEBTRACE(
"onModifyResource " << text.toStdString());
327 std::string resource=text.toStdString();
328 if(resource==
"automatic")resource=
"";
331 if (properties[
"name"] != resource)
349 DEBTRACE(
"onModifyPolicy " << text.toStdString());
354 if (properties[
"policy"] != text.toStdString())
360 DEBTRACE(
"onModifyWorkDir " << text.toStdString());
364 if (properties[
"workingdir"] != text.toStdString())
370 DEBTRACE(
"onModifyContName " << text.toStdString());
373 _properties[
"container_name"] = text.toStdString();
374 if (properties[
"container_name"] != text.toStdString())
380 DEBTRACE(
"onModifyOS " << text.toStdString());
385 if (properties[
"OS"] != text.toStdString())
391 DEBTRACE(
"onModifyParLib " << text.toStdString());
395 if (properties[
"parallelLib"] != text.toStdString())
401 DEBTRACE(
"onModifyIsMPI " << isMpi);
403 string text =
"false";
404 if (isMpi) text =
"true";
408 if (properties[
"isMPI"] != text)
414 DEBTRACE(
"onModifyMem " << text.toStdString());
418 if(properties.count(
"mem_mb")==0 )properties[
"mem_mb"]=
"0";
420 if (properties[
"mem_mb"] != text.toStdString())
426 DEBTRACE(
"onModifyClock " << text.toStdString());
430 if(properties.count(
"cpu_clock")==0 )properties[
"cpu_clock"]=
"0";
432 if (properties[
"cpu_clock"] != text.toStdString())
438 DEBTRACE(
"onModifyNodes " << text.toStdString());
442 if(properties.count(
"nb_node")==0 )properties[
"nb_node"]=
"0";
444 if (properties[
"nb_node"] != text.toStdString())
450 DEBTRACE(
"onModifyProcs " << text.toStdString());
454 if(properties.count(
"nb_proc_per_node")==0 )properties[
"nb_proc_per_node"]=
"0";
455 _properties[
"nb_proc_per_node"] = text.toStdString();
456 if (properties[
"nb_proc_per_node"] != text.toStdString())
462 DEBTRACE(
"onModifyCompo " << text.toStdString());
465 _properties[
"nb_component_nodes"] = text.toStdString();
466 if (properties[
"nb_component_nodes"] != text.toStdString())
472 DEBTRACE(
"onModifyProcPar " << text.toStdString());
475 _properties[
"nb_parallel_procs"] = text.toStdString();
476 if (properties[
"nb_parallel_procs"] != text.toStdString())
482 DEBTRACE(
"onModifyResourceName " << text.toStdString());
486 if (properties[
"resource_name"] != text.toStdString())
492 DEBTRACE(
"onModifyHostName " << text.toStdString());
498 if (properties[
"hostname"] != text.toStdString())
504 DEBTRACE(
"onModifyProcRes " << text.toStdString());
508 if(properties.count(
"nb_resource_procs")==0 )properties[
"nb_resource_procs"]=
"0";
509 _properties[
"nb_resource_procs"] = text.toStdString();
510 if (properties[
"nb_resource_procs"] != text.toStdString())
516 DEBTRACE(
"onModifyCompoList " << text.toStdString());
520 _properties[
"component_list"] = text.toStdString();
521 if (properties[
"component_list"] != text.toStdString())
527 DEBTRACE(
"onModifyResourceList " << text.toStdString());
532 if (properties[
"resource_list"] != text.toStdString())