| 170 | } |
| 171 | |
| 172 | static void formatProperties() |
| 173 | { |
| 174 | auto formatSetting = settings.get<std::string>("format.selected", "ibm"); |
| 175 | auto selectedFormat = findOrDefault(formats, (std::string)formatSetting); |
| 176 | if (!selectedFormat) |
| 177 | { |
| 178 | formatSetting = "ibm"; |
| 179 | selectedFormat = formats.at(formatSetting); |
| 180 | } |
| 181 | ImGui::TableNextRow(); |
| 182 | ImGui::TableNextColumn(); |
| 183 | ImGui::AlignTextToFramePadding(); |
| 184 | ImGui::TextWrapped("Format"); |
| 185 | ImGui::TableNextColumn(); |
| 186 | ImGui::SetNextItemWidth(-FLT_MIN); |
| 187 | if (ImGui::BeginCombo("##formats", |
| 188 | selectedFormat->shortname().c_str(), |
| 189 | ImGuiComboFlags_HeightLargest)) |
| 190 | { |
| 191 | ON_SCOPE_EXIT |
| 192 | { |
| 193 | ImGui::EndCombo(); |
| 194 | }; |
| 195 | |
| 196 | for (auto& [name, format] : formats) |
| 197 | if (!format->is_extension()) |
| 198 | { |
| 199 | auto label = format->shortname(); |
| 200 | if (label.empty()) |
| 201 | label = name; |
| 202 | if (ImGui::Selectable( |
| 203 | fmt::format("{}##{}", label, name).c_str(), false)) |
| 204 | { |
| 205 | formatSetting = name; |
| 206 | Datastore::reset(); |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | auto formatOptionsSetting = DynamicSetting<std::string>( |
| 212 | "fluxengine.settings", (std::string)formatSetting); |
| 213 | emitOptions(formatOptionsSetting, selectedFormat, {}); |
| 214 | } |
| 215 | |
| 216 | static void deviceProperties() |
| 217 | { |
no test coverage detected