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

Method refreshGains

Components/PanoramicDialog.cpp:807–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805}
806
807void
808PanoramicDialog::refreshGains(Suscan::Source::Device &device)
809{
810 DeviceGain *gain = nullptr;
811
812 this->clearGains();
813
814 for (auto p = device.getFirstGain();
815 p != device.getLastGain();
816 ++p) {
817 gain = new DeviceGain(nullptr, *p);
818 this->gainControls.push_back(gain);
819 this->ui->gainGridLayout->addWidget(
820 gain,
821 static_cast<int>(this->gainControls.size() - 1),
822 0,
823 1,
824 1);
825
826 connect(
827 gain,
828 SIGNAL(gainChanged(QString, float)),
829 this,
830 SLOT(onGainChanged(QString, float)));
831
832 if (this->dialogConfig->hasGain(device.getDriver(), p->getName()))
833 gain->setGain(this->dialogConfig->getGain(device.getDriver(), p->getName()));
834 else
835 gain->setGain(p->getDefault());
836 }
837
838 if (this->gainControls.size() == 0) {
839 this->ui->gainGridLayout->addWidget(
840 this->noGainLabel = new QLabel("(device has no gains)"),
841 0,
842 0,
843 Qt::AlignCenter | Qt::AlignVCenter);
844 } else {
845 this->ui->gainGridLayout->addItem(
846 new QSpacerItem(40, 20, QSizePolicy::Minimum, QSizePolicy::Minimum),
847 static_cast<int>(this->gainControls.size()),
848 0);
849 }
850}
851
852// Overriden methods
853Suscan::Serializable *

Callers 1

onDeviceChangedMethod · 0.95

Calls 10

clearGainsMethod · 0.95
getFirstGainMethod · 0.80
getLastGainMethod · 0.80
hasGainMethod · 0.80
getDefaultMethod · 0.80
sizeMethod · 0.45
getDriverMethod · 0.45
getNameMethod · 0.45
setGainMethod · 0.45
getGainMethod · 0.45

Tested by

no test coverage detected