| 875 | } |
| 876 | |
| 877 | void |
| 878 | ProfileConfigTab::onDeviceChanged(int index) |
| 879 | { |
| 880 | // Remember: only set device if the analyzer type is local |
| 881 | if (!this->refreshing |
| 882 | && index != -1 |
| 883 | && !this->remoteSelected()) { |
| 884 | Suscan::Singleton *sus = Suscan::Singleton::get_instance(); |
| 885 | const Suscan::Source::Device *device; |
| 886 | |
| 887 | if (!this->shouldDisregardTweaks()) { |
| 888 | this->refreshUi(); |
| 889 | return; |
| 890 | } |
| 891 | |
| 892 | SU_ATTEMPT( |
| 893 | device = sus->getDeviceAt( |
| 894 | static_cast<unsigned int>( |
| 895 | this->ui->deviceCombo->itemData(index).value<long>()))); |
| 896 | |
| 897 | this->configChanged(true); |
| 898 | this->profile.setDevice(*device); |
| 899 | this->hasTweaks = false; |
| 900 | |
| 901 | auto begin = device->getFirstAntenna(); |
| 902 | auto end = device->getLastAntenna(); |
| 903 | |
| 904 | // We check whether we can keep the current antenna configuration. If we |
| 905 | // cannot, just set the first antenna in the list. |
| 906 | if (device->findAntenna(this->profile.getAntenna()) == end |
| 907 | && begin != end) |
| 908 | this->profile.setAntenna(*begin); |
| 909 | |
| 910 | this->refreshUi(); |
| 911 | |
| 912 | unsigned sampRate = this->getSelectedSampleRate(); |
| 913 | unsigned decimation = static_cast<unsigned>(this->ui->decimationSpin->value()); |
| 914 | qreal maxBandwidth = static_cast<qreal>(sampRate) |
| 915 | / static_cast<qreal>(decimation); |
| 916 | |
| 917 | if (this->ui->bandwidthSpinBox->value() > maxBandwidth) |
| 918 | this->ui->bandwidthSpinBox->setValue(maxBandwidth); |
| 919 | } |
| 920 | } |
| 921 | |
| 922 | void |
| 923 | ProfileConfigTab::onFormatChanged(int index) |
no test coverage detected