Salome HOME
Button 'Default parameters'.
[tools/ydefx.git] / src / gui / QuickConfig.cxx
index 0282afbf26aa10d48f727b39f1eacee8030000c9..dfbf7a401763c31237e1ea5cbbf540ca62dcd722 100644 (file)
@@ -39,9 +39,13 @@ QuickConfigWidget::QuickConfigWidget(ydefx::JobParametersProxy& model,
   connect(resourcesComboBox, SIGNAL(currentIndexChanged( const QString &)),
           this, SLOT(updateResource( const QString &)));
 
+  QPushButton* resetBtn = new QPushButton(tr("Default parameters"));
+  connect(resetBtn,SIGNAL(clicked()),this, SLOT(resetParams()));
+
   QLabel * resourcesLabel = new QLabel(tr("Computing resource:"));
   hLayout->addWidget(resourcesLabel);
   hLayout->addWidget(resourcesComboBox);
+  hLayout->addWidget(resetBtn);
   mainLayout->addLayout(hLayout);
   
   QLabel *nb_branchesLabel = new QLabel(tr("Number of parallel evaluations:"));
@@ -57,6 +61,16 @@ QuickConfigWidget::QuickConfigWidget(ydefx::JobParametersProxy& model,
   connect(nb_branchesEdit, SIGNAL(valueChanged(int)),
           this, SLOT(updateNbBranches(int)));
 
+  hLayout = new QHBoxLayout();
+  QLabel *label = new QLabel(tr("Job name:"));
+  QLineEdit *editLine = new QLineEdit();
+  editLine->setText(_model.job_name().c_str());
+  hLayout->addWidget(label);
+  hLayout->addWidget(editLine);
+  mainLayout->addLayout(hLayout);
+  connect(editLine, SIGNAL(textChanged(const QString &)),
+          this, SLOT(updateJobName(const QString&)));
+
   mainLayout->addStretch();
   setWidget(mainWidget);
   setWidgetResizable (true);
@@ -66,9 +80,19 @@ QuickConfigWidget::~QuickConfigWidget()
 {
 }
 
+void QuickConfigWidget::updateJobName(const QString& value)
+{
+  _model.job_name(value.toStdString());
+}
+
 void QuickConfigWidget::updateResource(const QString& value)
 {
-  _model.configureResource(value.toStdString());
+  _model.resource_name(value.toStdString());
+}
+
+void QuickConfigWidget::resetParams()
+{
+  _model.configureResource(_model.resource_name());
   emit defaultNbBranches(_model.nb_branches());
   emit defaultWorkingDir(_model.work_directory().c_str());
   emit defaultWcKey(_model.wckey().c_str());