MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / refreshGains

Method refreshGains

Default/Source/SourceWidget.cpp:273–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271}
272
273void
274SourceWidget::refreshGains(Suscan::Source::Config &config)
275{
276 Suscan::Source::Device const &dev = config.getDevice();
277 DeviceGain *gain = nullptr;
278 bool presetEnabled = this->ui->gainPresetCheck->isChecked();
279
280 this->clearGains();
281
282 for (auto p = dev.getFirstGain();
283 p != dev.getLastGain();
284 ++p) {
285 gain = new DeviceGain(nullptr, *p);
286 this->gainControls.push_back(gain);
287 this->ui->gainGridLayout->addWidget(
288 gain,
289 static_cast<int>(this->gainControls.size() - 1),
290 0,
291 1,
292 1);
293
294 connect(
295 gain,
296 SIGNAL(gainChanged(QString, float)),
297 this,
298 SLOT(onGainChanged(QString, float)));
299 gain->setGain(config.getGain(p->getName()));
300 }
301
302 if (this->gainControls.size() == 0
303 || config.getType() != SUSCAN_SOURCE_TYPE_SDR)
304 this->ui->gainsFrame->hide();
305 else
306 this->ui->gainsFrame->show();
307
308 if (presetEnabled)
309 this->refreshCurrentAutoGain(dev.getDriver());
310 else
311 this->ui->gainsFrame->setEnabled(true);
312}
313
314bool
315SourceWidget::tryApplyGains(

Callers 1

setProfileMethod · 0.95

Calls 11

clearGainsMethod · 0.95
getFirstGainMethod · 0.80
getLastGainMethod · 0.80
sizeMethod · 0.45
setGainMethod · 0.45
getGainMethod · 0.45
getNameMethod · 0.45
getTypeMethod · 0.45
getDriverMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected