Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BatchDrake committed Aug 22, 2019
2 parents 9964e4a + 3d544f1 commit c3b0418
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
14 changes: 14 additions & 0 deletions Components/ConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(step));
}

void
ConfigDialog::refreshProfileUi(void)
{
Expand Down Expand Up @@ -253,6 +264,7 @@ ConfigDialog::refreshProfileUi(void)

this->refreshUiState();
this->refreshAntennas();
this->updateBwStep();
}

void
Expand Down Expand Up @@ -553,6 +565,8 @@ ConfigDialog::onLineEditsChanged(const QString &)

if (sampRate < this->ui->bwSpin->value())
this->ui->bwSpin->setValue(sampRate);

this->updateBwStep();
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions Components/SourcePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(step));
}
}

Expand Down
1 change: 1 addition & 0 deletions include/ConfigDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 16 additions & 4 deletions ui/Config.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<height>431</height>
<width>551</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -351,11 +351,23 @@
</item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="bwSpin">
<property name="minimumSize">
<size>
<width>132</width>
<height>0</height>
</size>
</property>
<property name="suffix">
<string> Hz</string>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000000.000000000000000</double>
<double>10000000.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
Expand Down Expand Up @@ -935,7 +947,7 @@
</connection>
</connections>
<buttongroups>
<buttongroup name="windowButtonGroup"/>
<buttongroup name="sourceTypeGroup"/>
<buttongroup name="windowButtonGroup"/>
</buttongroups>
</ui>

0 comments on commit c3b0418

Please sign in to comment.