10 SettingsDialog::SettingsDialog(QWidget *parent): QDialog(parent)
15 vbox = new QVBoxLayout();
17 hbox = new QHBoxLayout();
18 label = new QLabel(QString::fromUtf8("&g, m/s²"), this);
19 hbox->addWidget(label);
20 editG = new QLineEdit(this);
21 hbox->addWidget(editG);
22 editG->setInputMethodHints(Qt::ImhFormattedNumbersOnly);
23 editG->setText(QString::number(g_n));
24 label->setBuddy(editG);
25 label = new QLabel(QString::fromUtf8("&Scale limit, g"), this);
26 hbox->addWidget(label);
27 editMax = new QLineEdit(this);
28 hbox->addWidget(editMax);
29 editMax->setInputMethodHints(Qt::ImhFormattedNumbersOnly);
30 editMax->setText(QString::number(a_max));
31 label->setBuddy(editMax);
32 vbox->addLayout(hbox);
34 hbox = new QHBoxLayout();
35 label = new QLabel(QString::fromUtf8("g scale &divisions"), this);
36 hbox->addWidget(label);
37 editDiv = new QLineEdit(this);
38 hbox->addWidget(editDiv);
39 editDiv->setInputMethodHints(Qt::ImhDigitsOnly);
40 editDiv->setText(QString::number(divisions));
41 label->setBuddy(editDiv);
42 vbox->addLayout(hbox);
44 hbox = new QHBoxLayout();
45 label = new QLabel(QString::fromUtf8("&Inclinometer scale division, °"), this);
46 hbox->addWidget(label);
47 editAngle = new QLineEdit(this);
48 hbox->addWidget(editAngle);
49 editAngle->setInputMethodHints(Qt::ImhDigitsOnly);
50 editAngle->setText(QString::number(angle_step));
51 label->setBuddy(editAngle);
52 vbox->addLayout(hbox);
54 hbox = new QHBoxLayout();
55 label = new QLabel(QString::fromUtf8("Data &rate, Hz"), this);
56 hbox->addWidget(label);
57 editRate = new QLineEdit(this);
58 hbox->addWidget(editRate);
59 editRate->setInputMethodHints(Qt::ImhDigitsOnly);
60 editRate->setText(QString::number(data_rate));
61 label->setBuddy(editRate);
62 label = new QLabel(QString::fromUtf8("&Smoothing"), this);
63 hbox->addWidget(label);
64 comboSmoothing = new QComboBox(this);
65 comboSmoothing->addItem("None");
66 comboSmoothing->addItem("Light");
67 comboSmoothing->addItem("Medium");
68 comboSmoothing->addItem("Strong");
69 comboSmoothing->setCurrentIndex(smoothing);
70 hbox->addWidget(comboSmoothing);
71 label->setBuddy(comboSmoothing);
72 vbox->addLayout(hbox);
74 buttonOk = new QPushButton("Ok");
75 vbox->addWidget(buttonOk);
76 connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
80 layout()->setSizeConstraint(QLayout::SetFixedSize);
83 SettingsDialog::~SettingsDialog()
87 void SettingsDialog::accept()
89 g_n = editG->text().toDouble();
90 a_max = editMax->text().toDouble();
91 smoothing = comboSmoothing->currentIndex();
92 divisions = editDiv->text().toInt();
93 angle_step = editAngle->text().toInt();
94 data_rate = editRate->text().toInt();