| 1043 | } |
| 1044 | |
| 1045 | void |
| 1046 | ProfileConfigTab::setSelectedSampleRate(unsigned int rate) |
| 1047 | { |
| 1048 | // Set sample rate in both places |
| 1049 | qreal dist = std::numeric_limits<qreal>::infinity(); |
| 1050 | int bestIndex = -1; |
| 1051 | for (auto i = 0; i < this->ui->sampleRateCombo->count(); ++i) { |
| 1052 | qreal value = this->ui->sampleRateCombo->itemData(i).value<qreal>(); |
| 1053 | if (fabs(value - rate) < dist) { |
| 1054 | bestIndex = i; |
| 1055 | dist = fabs(value - rate); |
| 1056 | } |
| 1057 | } |
| 1058 | |
| 1059 | if (bestIndex != -1) |
| 1060 | this->ui->sampleRateCombo->setCurrentIndex(bestIndex); |
| 1061 | |
| 1062 | this->ui->sampleRateSpinBox->setValue(rate); |
| 1063 | } |
| 1064 | |
| 1065 | void |
| 1066 | ProfileConfigTab::onSpinsChanged(void) |
no test coverage detected