17 QString title = QString(
"SliderOptions");
18 setWindowTitle(title);
20 QSettings settings(
"YARP",
"yarpmotorgui");
21 val_pos_choice = settings.value(
"val_pos_choice", 0).toInt();
22 val_trq_choice = settings.value(
"val_trq_choice", 0).toInt();
23 val_vel_choice = settings.value(
"val_vel_choice", 0).toInt();
24 val_pos_digits = settings.value(
"num_of_pos_decimals", 3).toInt();
25 val_pos_custom_step = settings.value(
"val_pos_custom_step", 1.0).toDouble();
26 val_trq_custom_step = settings.value(
"val_trq_custom_step", 1.0).toDouble();
27 val_vel_custom_step = settings.value(
"val_vel_custom_step", 1.0).toDouble();
28 val_vel_limit = settings.value(
"velocity_slider_limit", 100.0).toDouble();
30 pos_digits_validator =
new QIntValidator(
this);
31 pos_step_validator =
new QDoubleValidator(
this);
32 vel_step_validator =
new QDoubleValidator(
this);
33 trq_step_validator =
new QDoubleValidator(
this);
34 vel_lims_validator =
new QDoubleValidator(
this);
35 vel_lims_validator->setRange(0 , 100);
37 ui->pos_decimal_digits->setValidator(pos_digits_validator);
38 ui->pos_step->setValidator(pos_step_validator);
39 ui->vel_step->setValidator(vel_step_validator);
40 ui->trq_step->setValidator(trq_step_validator);
41 ui->vel_limiter->setValidator(vel_lims_validator);
43 ui->pos_decimal_digits->setText(QString(
"%1").arg(val_pos_digits));
44 ui->pos_step->setText(QString(
"%1").arg(val_pos_custom_step));
45 ui->trq_step->setText(QString(
"%1").arg(val_trq_custom_step));
46 ui->vel_step->setText(QString(
"%1").arg(val_vel_custom_step));
47 ui->vel_limiter->setText(QString(
"%1").arg(val_vel_limit));
53 switch (val_pos_choice)
56 ui->radio_pos_auto->setChecked(
true);
59 ui->radio_pos_user->setChecked(
true);
62 ui->radio_pos_one->setChecked(
true);
65 ui->radio_pos_auto->setChecked(
true);
68 switch (val_vel_choice)
71 ui->radio_vel_auto->setChecked(
true);
74 ui->radio_vel_user->setChecked(
true);
77 ui->radio_vel_one->setChecked(
true);
80 ui->radio_vel_auto->setChecked(
true);
83 switch (val_trq_choice)
86 ui->radio_trq_auto->setChecked(
true);
89 ui->radio_trq_user->setChecked(
true);
92 ui->radio_trq_one->setChecked(
true);
95 ui->radio_trq_auto->setChecked(
true);
102 if (ui->radio_pos_auto->isChecked()) {
104 }
else if (ui->radio_pos_user->isChecked()) {
106 }
else if (ui->radio_pos_one->isChecked()) {
110 if (ui->radio_vel_auto->isChecked()) {
112 }
else if (ui->radio_vel_user->isChecked()) {
114 }
else if (ui->radio_vel_one->isChecked()) {
118 if (ui->radio_trq_auto->isChecked()) {
120 }
else if (ui->radio_trq_user->isChecked()) {
122 }
else if (ui->radio_trq_one->isChecked()) {
126 val_pos_custom_step = ui->pos_step->text().toDouble();
127 val_vel_custom_step = ui->vel_step->text().toDouble();
128 val_trq_custom_step = ui->trq_step->text().toDouble();
129 val_vel_limit = ui->vel_limiter->text().toDouble();
130 val_pos_digits = ui->pos_decimal_digits->text().toInt();
132 QSettings settings(
"YARP",
"yarpmotorgui");
133 settings.setValue(
"val_pos_choice", val_pos_choice);
134 settings.setValue(
"val_trq_choice", val_trq_choice);
135 settings.setValue(
"val_vel_choice", val_vel_choice);
136 settings.setValue(
"val_pos_custom_step", val_pos_custom_step);
137 settings.setValue(
"val_trq_custom_step", val_trq_custom_step);
138 settings.setValue(
"val_vel_custom_step", val_vel_custom_step);
139 settings.setValue(
"velocity_slider_limit", val_vel_limit);
140 settings.setValue(
"num_of_pos_decimals", val_pos_digits);
148 delete pos_digits_validator;
149 delete pos_step_validator;
150 delete vel_step_validator;
151 delete trq_step_validator;
152 delete vel_lims_validator;