| 805 | } |
| 806 | |
| 807 | void |
| 808 | PanoramicDialog::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 |
| 853 | Suscan::Serializable * |
no test coverage detected