diff --git a/Components/ConfigDialog.cpp b/Components/ConfigDialog.cpp index d21b9d9a..c443e597 100644 --- a/Components/ConfigDialog.cpp +++ b/Components/ConfigDialog.cpp @@ -185,6 +185,17 @@ ConfigDialog::refreshColorUi(void) CCREFRESH(histogramModelColor, histogramModel); } +void +ConfigDialog::updateBwStep(void) +{ + float step = SU_POW(10., SU_FLOOR(SU_LOG(this->profile.getSampleRate()))); + + if (step >= 10.f) + step /= 10.f; + + this->ui->bwSpin->setSingleStep(static_cast(step)); +} + void ConfigDialog::refreshProfileUi(void) { @@ -253,6 +264,7 @@ ConfigDialog::refreshProfileUi(void) this->refreshUiState(); this->refreshAntennas(); + this->updateBwStep(); } void @@ -553,6 +565,8 @@ ConfigDialog::onLineEditsChanged(const QString &) if (sampRate < this->ui->bwSpin->value()) this->ui->bwSpin->setValue(sampRate); + + this->updateBwStep(); } } } diff --git a/Components/SourcePanel.cpp b/Components/SourcePanel.cpp index 2be53605..d06797aa 100644 --- a/Components/SourcePanel.cpp +++ b/Components/SourcePanel.cpp @@ -192,13 +192,22 @@ void SourcePanel::setSampleRate(unsigned int rate) { if (this->rate != rate) { + float step; this->rate = rate; if (rate == 0) { this->ui->sampleRateLabel->setText("N/A"); } else { this->ui->sampleRateLabel->setText(formatSampleRate(rate)); } + this->ui->bwSpin->setMaximum(this->rate); + + step = SU_POW(10., SU_FLOOR(SU_LOG(this->rate))); + + if (step >= 10.f) + step /= 10.f; + + this->ui->bwSpin->setSingleStep(static_cast(step)); } } diff --git a/include/ConfigDialog.h b/include/ConfigDialog.h index cbcfdc27..61db24ac 100644 --- a/include/ConfigDialog.h +++ b/include/ConfigDialog.h @@ -51,6 +51,7 @@ namespace SigDigger { void refreshProfileUi(void); void refreshUi(void); void refreshUiState(void); + void updateBwStep(void); void loadProfile(Suscan::Source::Config &config); void saveAnalyzerParams(void); void saveColors(void); diff --git a/ui/Config.ui b/ui/Config.ui index 82eca82d..f9bf1080 100644 --- a/ui/Config.ui +++ b/ui/Config.ui @@ -6,8 +6,8 @@ 0 0 - 528 - 431 + 551 + 300 @@ -351,11 +351,23 @@ + + + 132 + 0 + + + + Hz + + + 0 + 0.000000000000000 - 1000000.000000000000000 + 10000000.000000000000000 0.000000000000000 @@ -935,7 +947,7 @@ - +