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

Method UpdateSources

src/gui/idlepanel.cc:445–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443 }
444
445 void UpdateSources()
446 {
447 sourceBook->DeleteAllPages();
448 sourceIconPanel->DestroyChildren();
449
450 int page = 0;
451 bool switched = false;
452 for (auto& device : _devices)
453 {
454 for (int drive = 0; drive <= 1; drive++)
455 {
456 auto* panel = new HardwareSourcePanelGen(sourceBook);
457 sourceBook->AddPage(panel, "");
458 panel->label->SetLabel(
459 fmt::format("{}; serial number {}; drive:{}",
460 getDeviceName(device->type),
461 device->serial,
462 drive));
463
464 auto* button = AddIcon(ICON_HARDWARE,
465 fmt::format(
466 "{}\ndrive:{}", device->serial.substr(0, 10), drive));
467 button->Bind(wxEVT_BUTTON,
468 [=](auto& e)
469 {
470 SwitchToPage(page);
471
472 _selectedSource = SELECTEDSOURCE_REAL;
473 _selectedDevice = device->serial;
474 _selectedDrive = drive;
475 OnControlsChanged(e);
476 });
477
478 panel->highDensityToggle->SetValue(_selectedHighDensity);
479 panel->highDensityToggle->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED,
480 [=](wxCommandEvent& e)
481 {
482 _selectedHighDensity =
483 panel->highDensityToggle->GetValue();
484 OnControlsChanged(e);
485 });
486
487 int i = 0;
488 for (auto& driveConfig : drivetypes)
489 {
490 panel->driveTypeChoice->Append(
491 driveConfig.second->comment());
492 if (driveConfig.second == _selectedDriveType)
493 panel->driveTypeChoice->SetSelection(i);
494 i++;
495 }
496
497 panel->driveTypeChoice->Bind(wxEVT_CHOICE,
498 [=](wxCommandEvent& e)
499 {
500 auto it = drivetypes.begin();
501 std::advance(
502 it, panel->driveTypeChoice->GetSelection());

Callers

nothing calls this directly

Calls 8

getDeviceNameFunction · 0.85
LayoutClass · 0.85
SetValueMethod · 0.80
GetValueMethod · 0.80
beginMethod · 0.45
ClearMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected