56 : QWidget(parent), additional_fields_(additional_fields)
59 QVBoxLayout* layout =
new QVBoxLayout();
61 QGroupBox* controller_options_group =
new QGroupBox(
"Controller Options");
64 title_ =
new QLabel(
this);
65 QFont group_title_font(QFont().defaultFamily(), 12, QFont::Bold);
66 title_->setFont(group_title_font);
67 layout->addWidget(title_);
69 QFormLayout* form_layout =
new QFormLayout();
70 form_layout->setContentsMargins(0, 15, 0, 15);
73 controller_name_field_ =
new QLineEdit(
this);
74 controller_name_field_->setMaximumWidth(400);
75 form_layout->addRow(
"Controller Name:", controller_name_field_);
78 controller_type_field_ =
new QComboBox(
this);
79 controller_type_field_->setEditable(
false);
80 controller_type_field_->setMaximumWidth(400);
81 connect(controller_type_field_, SIGNAL(currentIndexChanged(
int)),
this, SLOT(typeChanged(
int)));
82 form_layout->addRow(
"Controller Type:", controller_type_field_);
84 for (
const auto& field : additional_fields_)
86 QLineEdit*
input =
new QLineEdit(
this);
87 input->setMaximumWidth(400);
88 form_layout->addRow(field->display_name_.c_str(),
input);
89 additional_fields_inputs_.push_back(
input);
92 controller_options_group->setLayout(form_layout);
94 layout->addWidget(controller_options_group);
96 layout->setAlignment(Qt::AlignTop);
99 new_buttons_widget_ =
new QWidget();
100 QVBoxLayout* new_buttons_layout =
new QVBoxLayout();
102 QLabel* save_and_add =
new QLabel(
"Next, Add Components To Controller:",
this);
103 QFont save_and_add_font(QFont().defaultFamily(), 12, QFont::Bold);
104 save_and_add->setFont(save_and_add_font);
105 new_buttons_layout->addWidget(save_and_add);
107 QLabel* add_subtitle =
new QLabel(
"Recommended: ",
this);
108 QFont add_subtitle_font(QFont().defaultFamily(), 10, QFont::Bold);
109 add_subtitle->setFont(add_subtitle_font);
110 new_buttons_layout->addWidget(add_subtitle);
113 QPushButton* btn_save_groups_joints =
new QPushButton(
"Add Planning Group Joints",
this);
114 btn_save_groups_joints->setMaximumWidth(200);
115 connect(btn_save_groups_joints, SIGNAL(clicked()),
this, SIGNAL(
saveJointsGroups()));
116 new_buttons_layout->addWidget(btn_save_groups_joints);
118 QLabel* add_subtitle2 =
new QLabel(
"Advanced Options:",
this);
119 add_subtitle2->setFont(add_subtitle_font);
120 new_buttons_layout->addWidget(add_subtitle2);
123 QPushButton* btn_save_joints =
new QPushButton(
"Add Individual Joints",
this);
124 btn_save_joints->setMaximumWidth(200);
125 connect(btn_save_joints, SIGNAL(clicked()),
this, SIGNAL(
saveJoints()));
126 new_buttons_layout->addWidget(btn_save_joints);
129 new_buttons_widget_->setLayout(new_buttons_layout);
130 layout->addWidget(new_buttons_widget_);
133 layout->addItem(
new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
136 QHBoxLayout* controls_layout =
new QHBoxLayout();
139 btn_delete_ =
new QPushButton(
"&Delete Controller",
this);
140 btn_delete_->setMaximumWidth(200);
142 controls_layout->addWidget(btn_delete_);
143 controls_layout->setAlignment(btn_delete_, Qt::AlignRight);
146 controls_layout->addItem(
new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
149 btn_save_ =
new QPushButton(
"&Save",
this);
150 btn_save_->setMaximumWidth(200);
151 connect(btn_save_, SIGNAL(clicked()),
this, SIGNAL(
save()));
152 controls_layout->addWidget(btn_save_);
153 controls_layout->setAlignment(btn_save_, Qt::AlignRight);
156 QPushButton* btn_cancel =
new QPushButton(
"&Cancel",
this);
157 btn_cancel->setMaximumWidth(200);
158 connect(btn_cancel, SIGNAL(clicked()),
this, SIGNAL(
cancelEditing()));
159 controls_layout->addWidget(btn_cancel);
160 controls_layout->setAlignment(btn_cancel, Qt::AlignRight);
163 layout->addLayout(controls_layout);
174 controller_name_field_->setText(QString(controller_name.c_str()));
175 if (searched_controller !=
nullptr)
177 const std::string controller_type = searched_controller->
type_;
178 int type_index = controller_type_field_->findText(controller_type.c_str());
181 if (type_index == -1)
183 QMessageBox::warning(
this,
"Missing Controller Type", QString(
"Setting controller type to the default value"));
188 controller_type_field_->setCurrentIndex(type_index);
191 for (
unsigned int i = 0; i < additional_fields_.size(); i++)
193 std::string key = additional_fields_[i]->parameter_name_;
194 const auto& it = searched_controller->
parameters_.find(key);
197 additional_fields_inputs_[i]->setText(it->second.c_str());
203 controller_type_field_->setCurrentIndex(0);