MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / deviceProperties

Function deviceProperties

src/gui2/configview.cc:216–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216static void deviceProperties()
217{
218 /* Device name */
219
220 std::set<int> applicableOptions = {ANY_SOURCESINK};
221 auto deviceNameSetting = settings.get<std::string>("device");
222 auto selectedDevice = findOrDefault(Datastore::getDevices(),
223 (std::string)deviceNameSetting,
224 {.label = "No device configured"});
225 ImGui::TableNextRow();
226 ImGui::TableNextColumn();
227 ImGui::AlignTextToFramePadding();
228 ImGui::Text("Device");
229
230 if ((std::string)deviceNameSetting == DEVICE_FLUXFILE)
231 applicableOptions.insert(FLUXFILE_SOURCESINK);
232 else if ((std::string)deviceNameSetting == DEVICE_MANUAL)
233 {
234 applicableOptions.insert(MANUAL_SOURCESINK);
235 applicableOptions.insert(HARDWARE_SOURCESINK);
236 }
237 else
238 applicableOptions.insert(HARDWARE_SOURCESINK);
239
240 ImGui::TableNextColumn();
241 ImGui::SetNextItemWidth(-FLT_MIN);
242 if (ImGui::BeginCombo("##devices",
243 selectedDevice.label.c_str(),
244 ImGuiComboFlags_HeightLargest))
245 {
246 ON_SCOPE_EXIT
247 {
248 ImGui::EndCombo();
249 };
250
251 for (auto& [name, device] : Datastore::getDevices())
252 if (ImGui::Selectable(device.label.c_str(), false))
253 deviceNameSetting = name;
254 }
255
256 /* The rescan button. */
257
258 ImGui::TableNextRow();
259 ImGui::TableNextColumn();
260 ImGui::TableNextColumn();
261 if (ImGui::Button("fluxengine.view.config.rescan"_lang))
262 {
263 Datastore::probeDevices();
264 }
265
266 ImGui::SameLine();
267 if (ImGui::Button("fluxengine.view.config.setupFluxFile"_lang))
268 {
269 fs::openFileBrowser(fs::DialogMode::Open,
270 {},
271 [](const auto& path)
272 {
273 settings.get<std::string>("device") = DEVICE_FLUXFILE;

Callers 1

drawContentMethod · 0.85

Calls 2

TextFunction · 0.85
emitOptionsFunction · 0.85

Tested by

no test coverage detected