| 491 | } |
| 492 | |
| 493 | void |
| 494 | SourceWidget::refreshUi() |
| 495 | { |
| 496 | bool gainPresetEnabled = this->panelConfig->gainPresetEnabled; |
| 497 | bool haveAGC = this->currAutoGainSet != nullptr; |
| 498 | |
| 499 | if (this->profile != nullptr) { |
| 500 | bool isRemote = this->profile->isRemote(); |
| 501 | |
| 502 | this->setThrottleable( |
| 503 | this->profile->getType() != SUSCAN_SOURCE_TYPE_SDR |
| 504 | || isRemote); |
| 505 | |
| 506 | this->ui->antennaCombo->setEnabled( |
| 507 | this->profile->getType() == SUSCAN_SOURCE_TYPE_SDR); |
| 508 | |
| 509 | this->ui->bwSpin->setEnabled( |
| 510 | this->profile->getType() == SUSCAN_SOURCE_TYPE_SDR); |
| 511 | |
| 512 | this->ui->ppmSpinBox->setEnabled( |
| 513 | this->profile->getType() == SUSCAN_SOURCE_TYPE_SDR |
| 514 | || isRemote); |
| 515 | |
| 516 | this->saverUI->setEnabled(!isRemote); |
| 517 | } |
| 518 | |
| 519 | // These depend on the source info only |
| 520 | this->ui->dcRemoveCheck->setEnabled( |
| 521 | m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_SET_DC_REMOVE)); |
| 522 | this->ui->swapIQCheck->setEnabled( |
| 523 | m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_SET_IQ_REVERSE)); |
| 524 | this->ui->agcEnabledCheck->setEnabled( |
| 525 | m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_SET_AGC)); |
| 526 | |
| 527 | // These depend both the profile and source info |
| 528 | this->ui->bwSpin->setEnabled( |
| 529 | this->ui->bwSpin->isEnabled() |
| 530 | && m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_SET_BW)); |
| 531 | this->ui->ppmSpinBox->setEnabled( |
| 532 | this->ui->ppmSpinBox->isEnabled() |
| 533 | && m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_SET_PPM)); |
| 534 | this->ui->throttleCheck->setEnabled( |
| 535 | this->ui->throttleCheck->isEnabled() |
| 536 | && m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_THROTTLE)); |
| 537 | this->ui->throttleSpin->setEnabled( |
| 538 | this->ui->throttleCheck->isChecked() |
| 539 | && this->ui->throttleCheck->isEnabled()); |
| 540 | this->ui->antennaCombo->setEnabled( |
| 541 | this->ui->antennaCombo->isEnabled() |
| 542 | && m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_SET_ANTENNA)); |
| 543 | this->ui->gainsFrame->setEnabled( |
| 544 | (!gainPresetEnabled || !haveAGC) |
| 545 | && m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_SET_GAIN)); |
| 546 | this->ui->autoGainFrame->setEnabled( |
| 547 | m_sourceInfo.testPermission(SUSCAN_ANALYZER_PERM_SET_GAIN)); |
| 548 | |
| 549 | this->ui->autoGainCombo->setEnabled(gainPresetEnabled); |
| 550 | this->ui->autoGainSlider->setEnabled(gainPresetEnabled); |
no test coverage detected