MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / OpenRGBDevicePage

Method OpenRGBDevicePage

qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp:48–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
49 QFrame(parent),
50 ui(new Ui::OpenRGBDevicePageUi)
51{
52 ui->setupUi(this);
53
54 /*-----------------------------------------------------*\
55 | Store device pointer |
56 \*-----------------------------------------------------*/
57 device = dev;
58
59 /*-----------------------------------------------------*\
60 | Register update callback with the device |
61 \*-----------------------------------------------------*/
62 device->RegisterUpdateCallback(UpdateCallback, this);
63
64 /*-----------------------------------------------------*\
65 | Set up the device view |
66 \*-----------------------------------------------------*/
67 connect(ui->DeviceViewBox, &DeviceView::selectionChanged, this, &OpenRGBDevicePage::on_DeviceViewBox_selectionChanged);
68
69 /*-----------------------------------------------------*\
70 | Get the UserInterface settings and check the |
71 | numerical labels setting |
72 \*-----------------------------------------------------*/
73 SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
74 std::string ui_string = "UserInterface";
75 json ui_settings;
76
77 ui_settings = settings_manager->GetSettings(ui_string);
78
79 if(ui_settings.contains("numerical_labels"))
80 {
81 bool numerical_labels = ui_settings["numerical_labels"];
82
83 ui->DeviceViewBox->setNumericalLabels(numerical_labels);
84 }
85
86 ui->DeviceViewBox->setController(device);
87 ui->DeviceViewBoxFrame->hide();
88
89 /*-----------------------------------------------------*\
90 | Fill in the mode selection box |
91 \*-----------------------------------------------------*/
92 ui->ModeBox->blockSignals(true);
93 ui->ModeBox->clear();
94
95 for(std::size_t i = 0; i < device->modes.size(); i++)
96 {
97 ui->ModeBox->addItem(device->modes[i].name.c_str());
98 ui->ModeBox->setItemData((int)i, ModeDescription(device->modes[i]), Qt::ToolTipRole);
99 }
100
101 ui->ModeBox->setCurrentIndex(device->GetMode());
102 ui->ModeBox->blockSignals(false);
103
104 /*-----------------------------------------------------*\
105 | Update mode user interface elements |

Callers

nothing calls this directly

Calls 9

GetSettingsManagerMethod · 0.80
GetSettingsMethod · 0.80
containsMethod · 0.80
setNumericalLabelsMethod · 0.80
setControllerMethod · 0.80
getFunction · 0.50
sizeMethod · 0.45
GetModeMethod · 0.45

Tested by

no test coverage detected