diff --git a/plugins/samplesource/soapysdrinput/CMakeLists.txt b/plugins/samplesource/soapysdrinput/CMakeLists.txt
index ec5f14670..70e4553c9 100644
--- a/plugins/samplesource/soapysdrinput/CMakeLists.txt
+++ b/plugins/samplesource/soapysdrinput/CMakeLists.txt
@@ -9,6 +9,7 @@ set(soapysdrinput_SOURCES
soapysdrinputsettings.cpp
soapysdrinputthread.cpp
discreterangegui.cpp
+ intervalrangegui.cpp
)
set(soapysdrinput_HEADERS
@@ -18,11 +19,13 @@ set(soapysdrinput_HEADERS
soapysdrinputsettings.h
soapysdrinputthread.h
discreterangegui.h
+ intervalrangegui.h
)
set(soapysdrinput_FORMS
soapysdrinputgui.ui
discreterangegui.ui
+ intervalrangegui.ui
)
if (BUILD_DEBIAN)
diff --git a/plugins/samplesource/soapysdrinput/intervalrangegui.cpp b/plugins/samplesource/soapysdrinput/intervalrangegui.cpp
new file mode 100644
index 000000000..9e31b85ea
--- /dev/null
+++ b/plugins/samplesource/soapysdrinput/intervalrangegui.cpp
@@ -0,0 +1,95 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2018 Edouard Griffiths, F4EXB //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#include
+
+#include "ui_intervalrangegui.h"
+#include "intervalrangegui.h"
+
+IntervalRangeGUI::IntervalRangeGUI(QWidget* parent) :
+ QWidget(parent),
+ ui(new Ui::IntervalRangeGUI),
+ m_nbDigits(7)
+{
+ ui->setupUi(this);
+ ui->value->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
+}
+
+IntervalRangeGUI::~IntervalRangeGUI()
+{
+ delete ui;
+}
+
+void IntervalRangeGUI::setLabel(const QString& text)
+{
+ ui->rangeLabel->setText(text);
+}
+
+void IntervalRangeGUI::setUnits(const QString& units)
+{
+ ui->rangeUnits->setText(units);
+}
+
+void IntervalRangeGUI::addInterval(double minimum, double maximum)
+{
+ ui->rangeInterval->blockSignals(true);
+ ui->rangeInterval->addItem(QString("%1").arg(m_minima.size()));
+ ui->rangeInterval->blockSignals(false);
+ m_minima.push_back(minimum);
+ m_maxima.push_back(maximum);
+}
+
+void IntervalRangeGUI::reset()
+{
+ if (m_minima.size() > 0)
+ {
+ double maxLog = 0.0;
+
+ for (const auto &it : m_maxima)
+ {
+ if (log10(it) > maxLog) {
+ maxLog = log10(it);
+ }
+ }
+
+ m_nbDigits = maxLog;
+ m_nbDigits++;
+ ui->rangeInterval->blockSignals(true);
+ ui->rangeInterval->setCurrentIndex(0);
+ ui->rangeInterval->blockSignals(false);
+ ui->value->setValueRange(m_nbDigits, m_minima[0], m_maxima[0]);
+ }
+
+ if (m_minima.size() == 1) {
+ ui->rangeInterval->setDisabled(true);
+ }
+}
+
+double IntervalRangeGUI::getCurrentValue()
+{
+ return ui->value->getValue();
+}
+
+void IntervalRangeGUI::on_value_changed(quint64 value)
+{
+ emit valueChanged(value);
+}
+
+void IntervalRangeGUI::on_rangeInterval_currentIndexChanged(int index)
+{
+ ui->value->setValueRange(m_nbDigits, m_minima[index], m_maxima[index]);
+}
+
diff --git a/plugins/samplesource/soapysdrinput/intervalrangegui.h b/plugins/samplesource/soapysdrinput/intervalrangegui.h
new file mode 100644
index 000000000..f858b7b1a
--- /dev/null
+++ b/plugins/samplesource/soapysdrinput/intervalrangegui.h
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2018 Edouard Griffiths, F4EXB //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef PLUGINS_SAMPLESOURCE_SOAPYSDRINPUT_INTERVALRANGEGUI_H_
+#define PLUGINS_SAMPLESOURCE_SOAPYSDRINPUT_INTERVALRANGEGUI_H_
+
+#include
+#include
+
+namespace Ui {
+ class IntervalRangeGUI;
+}
+
+class IntervalRangeGUI : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit IntervalRangeGUI(QWidget* parent = 0);
+ ~IntervalRangeGUI();
+
+ void setLabel(const QString& text);
+ void setUnits(const QString& units);
+ void addInterval(double minimum, double maximum);
+ void reset();
+ double getCurrentValue();
+
+signals:
+ void valueChanged(double value);
+
+private slots:
+ void on_value_changed(quint64 value);
+ void on_rangeInterval_currentIndexChanged(int index);
+
+private:
+ Ui::IntervalRangeGUI* ui;
+ std::vector m_minima;
+ std::vector m_maxima;
+ int m_nbDigits;
+};
+
+#endif /* PLUGINS_SAMPLESOURCE_SOAPYSDRINPUT_INTERVALRANGEGUI_H_ */
diff --git a/plugins/samplesource/soapysdrinput/intervalrangegui.ui b/plugins/samplesource/soapysdrinput/intervalrangegui.ui
new file mode 100644
index 000000000..f7dc19a5e
--- /dev/null
+++ b/plugins/samplesource/soapysdrinput/intervalrangegui.ui
@@ -0,0 +1,91 @@
+
+
+ IntervalRangeGUI
+
+
+
+ 0
+ 0
+ 263
+ 30
+
+
+
+ Form
+
+
+
+
+ 0
+ 0
+ 262
+ 29
+
+
+
+ -
+
+
+ Label
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 16
+
+
+
+
+ Liberation Mono
+ 12
+
+
+
+ PointingHandCursor
+
+
+
+ -
+
+
+ Unit
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+ Range select
+
+
+
+
+
+
+
+
+ ValueDial
+ QWidget
+
+ 1
+
+
+
+
+
diff --git a/plugins/samplesource/soapysdrinput/soapysdrinputgui.cpp b/plugins/samplesource/soapysdrinput/soapysdrinputgui.cpp
index 7049039d5..ae218754e 100644
--- a/plugins/samplesource/soapysdrinput/soapysdrinputgui.cpp
+++ b/plugins/samplesource/soapysdrinput/soapysdrinputgui.cpp
@@ -22,6 +22,7 @@
#include "ui_soapysdrinputgui.h"
#include "discreterangegui.h"
+#include "intervalrangegui.h"
#include "soapysdrinputgui.h"
SoapySDRInputGui::SoapySDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
@@ -43,7 +44,7 @@ SoapySDRInputGui::SoapySDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_sampleSource->getFrequencyRange(f_min, f_max);
ui->centerFrequency->setValueRange(7, f_min/1000, f_max/1000);
- createRangesControl(m_sampleSource->getRateRanges(), "Sample Rate", "kS/s");
+ createRangesControl(m_sampleSource->getRateRanges(), "SR", "kS/s");
}
SoapySDRInputGui::~SoapySDRInputGui()
@@ -109,6 +110,18 @@ void SoapySDRInputGui::createRangesControl(const SoapySDR::RangeList& rangeList,
// //window->setStyleSheet("background-color:black;");
// window->setLayout(layout);
}
+ else if (rangeInterval)
+ {
+ IntervalRangeGUI *rangeGUI = new IntervalRangeGUI(ui->scrollAreaWidgetContents);
+ rangeGUI->setLabel(text);
+ rangeGUI->setUnits(unit);
+
+ for (const auto &it : rangeList) {
+ rangeGUI->addInterval(it.minimum(), it.maximum());
+ }
+
+ rangeGUI->reset();
+ }
}
void SoapySDRInputGui::setName(const QString& name)