Vespucci  1.0.0
settingsdialog.cpp
Go to the documentation of this file.
1 #include "settingsdialog.h"
2 #include "ui_settingsdialog.h"
3 
4 SettingsDialog::SettingsDialog(QWidget *parent, QSharedPointer<VespucciWorkspace> ws) :
5  QDialog(parent),
6  ui(new Ui::SettingsDialog)
7 {
8  ui->setupUi(this);
9  workspace_ = ws;
10 
11  settings_ = workspace_->settings();
12  settings_->beginGroup("environment");
13  QString r_home = settings_->value("R_HOME").toString();
14  settings_->endGroup();
15  settings_->beginGroup("specdata");
16  QString abs_label = settings_->value("absLabel").toString();
17  QString abs_units = settings_->value("absUnits").toString();
18  QString ord_label = settings_->value("ordLabel").toString();
19  QString ord_units = settings_->value("ordUnits").toString();
20  settings_->endGroup();
21 
22  ui->rHomeLineEdit->setText(r_home);
23  ui->absLabelLineEdit->setText(abs_label);
24  ui->absUnitsLineEdit->setText(abs_units);
25  ui->ordLabelLineEdit->setText(ord_label);
26  ui->ordUnitsLineEdit->setText(ord_units);
27 }
28 
30 {
31  delete ui;
32 }
33 
34 void SettingsDialog::on_buttonBox_accepted()
35 {
36  QString r_home = ui->rHomeLineEdit->text();
37  QString abs_label = ui->absLabelLineEdit->text();
38  QString abs_units = ui->absUnitsLineEdit->text();
39  QString ord_label = ui->ordLabelLineEdit->text();
40  QString ord_units = ui->ordUnitsLineEdit->text();
41 
42  settings_->beginGroup("environment");
43  settings_->setValue("R_HOME", r_home);
44  settings_->endGroup();
45  settings_->beginGroup("specdata");
46  settings_->setValue("absLabel", abs_label);
47  settings_->setValue("absUnits", abs_units);
48  settings_->setValue("ordLabel", ord_label);
49  settings_->setValue("ordUnits", ord_units);
50  settings_->endGroup();
51 }
SettingsDialog(QWidget *parent, QSharedPointer< VespucciWorkspace > ws)
Definition: ahcadialog.h:26