| 167 | } |
| 168 | |
| 169 | void EditableParameter::draw() |
| 170 | { |
| 171 | ImGui::TableNextRow(); |
| 172 | ImGui::TableSetColumnIndex(0); |
| 173 | ImGui::Text("%s", d_name.c_str()); |
| 174 | if (ImGui::IsItemHovered() && d_description.size() > 0) |
| 175 | ImGui::SetTooltip("%s", d_description.c_str()); |
| 176 | ImGui::TableSetColumnIndex(1); |
| 177 | |
| 178 | if (d_type == PARAM_STRING) |
| 179 | ImGui::InputText(d_id.c_str(), &p_string); |
| 180 | else if (d_type == PARAM_PASSWORD) |
| 181 | ImGui::InputText(d_id.c_str(), &p_string, ImGuiInputTextFlags_Password); |
| 182 | else if (d_type == PARAM_INT) |
| 183 | ImGui::InputInt(d_id.c_str(), &p_int, 0); |
| 184 | else if (d_type == PARAM_FLOAT) |
| 185 | ImGui::InputDouble(d_id.c_str(), &p_float); |
| 186 | else if (d_type == PARAM_BOOL) |
| 187 | ImGui::Checkbox(d_id.c_str(), &p_bool); |
| 188 | else if (d_type == PARAM_OPTIONS) |
| 189 | ImGui::Combo(d_id.c_str(), &d_option, d_options_str.c_str()); |
| 190 | else if (d_type == PARAM_PATH) |
| 191 | file_select->draw(); |
| 192 | else if (d_type == PARAM_TIMESTAMP) |
| 193 | date_time_picker->draw(); |
| 194 | else if (d_type == PARAM_NOTATED_INT) |
| 195 | notated_int->draw(); |
| 196 | else if (d_type == PARAM_COLOR) |
| 197 | ImGui::ColorEdit3(d_id.c_str(), (float *)p_color, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel); |
| 198 | else if (d_type == PARAM_BASEBAND_TYPE) |
| 199 | baseband_type.draw_playback_combo(d_id.c_str()); |
| 200 | else if (d_type == PARAM_LABELED_OPTIONS) |
| 201 | { |
| 202 | if (ImGui::Combo(d_id.c_str(), &d_option, d_options_str.c_str()) && d_option != (int)d_labeled_opts.size()) |
| 203 | p_string = d_labeled_opts[d_option].first; |
| 204 | |
| 205 | if (p_bool) // Allow Manual |
| 206 | { |
| 207 | if (d_option != (int)d_labeled_opts.size()) |
| 208 | ImGui::BeginDisabled(); |
| 209 | ImGui::InputText(std::string(d_id + "_custom").c_str(), &p_string); |
| 210 | if (d_option != (int)d_labeled_opts.size()) |
| 211 | ImGui::EndDisabled(); |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | nlohmann::json EditableParameter::getValue() |
| 217 | { |
no test coverage detected