MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / update_device_info

Method update_device_info

DSView/pv/dialogs/calibration.cpp:130–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void Calibration::update_device_info()
131{
132 if (_device_agent->have_instance() == false){
133 assert(false);
134 }
135
136 for(std::list<QSlider *>::const_iterator i = _slider_list.begin();
137 i != _slider_list.end(); i++) {
138 (*i)->setParent(NULL);
139 _flayout->removeWidget((*i));
140 delete (*i);
141 }
142
143 _slider_list.clear();
144 for(std::list<QLabel *>::const_iterator i = _label_list.begin();
145 i != _label_list.end(); i++) {
146 (*i)->setParent(NULL);
147 _flayout->removeWidget((*i));
148 delete (*i);
149 }
150 _label_list.clear();
151
152 _flayout->setSpacing(15);
153
154 for (const GSList *l = _device_agent->get_channels(); l; l = l->next) {
155 sr_channel *const probe = (sr_channel*)l->data;
156 assert(probe);
157
158 uint64_t vgain = 0, vgain_default = 0;
159 int vgain_range = 0;
160
161 _device_agent->get_config_uint64(SR_CONF_PROBE_VGAIN, vgain, probe, NULL);
162 _device_agent->get_config_uint64(SR_CONF_PROBE_VGAIN_DEFAULT, vgain_default, probe, NULL);
163 _device_agent->get_config_uint16(SR_CONF_PROBE_VGAIN_RANGE, vgain_range, probe, NULL);
164
165 QSlider *gain_slider = new QSlider(Qt::Horizontal, this);
166 gain_slider->setRange(-vgain_range/2, vgain_range/2);
167 gain_slider->setValue(vgain - vgain_default);
168 gain_slider->setObjectName(VGAIN+probe->index);
169 QString gain_string = CHANNEL_LABEL + QString::number(probe->index) + VGAIN;
170 QLabel *gain_label = new QLabel(gain_string, this);
171 ui::adjust_label_size(gain_label, ui::ADJUST_HEIGHT);
172 gain_slider->setFixedHeight(gain_label->size().height());
173 gain_label->setAlignment(Qt::AlignVCenter);
174 _flayout->addRow(gain_label, gain_slider);
175 _slider_list.push_back(gain_slider);
176 _label_list.push_back(gain_label);
177
178 uint64_t voff = 0;
179 uint16_t voff_range = 0;
180 int v;
181
182 if (_device_agent->get_config_uint16(SR_CONF_PROBE_PREOFF, v, probe, NULL)) {
183 voff = (uint64_t)v;
184 }
185 if (_device_agent->get_config_uint16(SR_CONF_PROBE_PREOFF_MARGIN, v, probe, NULL)) {
186 voff_range = (uint16_t)v;
187 }

Callers 2

show_calibrationMethod · 0.80
vDial_updatedMethod · 0.80

Calls 12

adjust_label_sizeFunction · 0.85
have_instanceMethod · 0.80
get_channelsMethod · 0.80
get_config_uint64Method · 0.80
get_config_uint16Method · 0.80
setRangeMethod · 0.80
setValueMethod · 0.80
sizeMethod · 0.80
get_config_boolMethod · 0.80
get_config_int16Method · 0.80
endMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected