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

Method onDeviceChanged

Settings/ProfileConfigTab.cpp:877–920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875}
876
877void
878ProfileConfigTab::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
922void
923ProfileConfigTab::onFormatChanged(int index)

Callers 3

populateCombosMethod · 0.95
saveMethod · 0.95
onAnalyzerTypeChangedMethod · 0.95

Calls 14

remoteSelectedMethod · 0.95
shouldDisregardTweaksMethod · 0.95
refreshUiMethod · 0.95
configChangedMethod · 0.95
getSelectedSampleRateMethod · 0.95
getDeviceAtMethod · 0.80
getFirstAntennaMethod · 0.80
getLastAntennaMethod · 0.80
findAntennaMethod · 0.80
valueMethod · 0.80
setValueMethod · 0.80
setDeviceMethod · 0.45

Tested by

no test coverage detected