diff --git a/src/qtgui/iq_tool.cpp b/src/qtgui/iq_tool.cpp index 8375db8e96..a5bc711757 100644 --- a/src/qtgui/iq_tool.cpp +++ b/src/qtgui/iq_tool.cpp @@ -46,10 +46,13 @@ CIqTool::CIqTool(QWidget *parent) : is_playing = false; bytes_per_sample = 8; sample_rate = 192000; + playback_sample_rate = 192000; rec_len = 0; center_freq = 1e8; //ui->recDirEdit->setText(QDir::currentPath()); + ui->sampleRateSpinBox->setValue(playback_sample_rate); + ui->centerFreqSpinBox->setValue(center_freq); recdir = new QDir(QDir::homePath(), "*.raw"); @@ -74,6 +77,8 @@ CIqTool::~CIqTool() void CIqTool::setSampleRate(qint64 sr) { sample_rate = sr; + playback_sample_rate = sr; + ui->sampleRateSpinBox->setValue(sr / 1000.0); if (!current_file.isEmpty()) { @@ -84,7 +89,6 @@ void CIqTool::setSampleRate(qint64 sr) } } - /*! \brief Slot activated when the user selects a file. */ void CIqTool::on_listWidget_currentTextChanged(const QString ¤tText) { @@ -93,7 +97,7 @@ void CIqTool::on_listWidget_currentTextChanged(const QString ¤tText) QFileInfo info(*recdir, current_file); parseFileName(currentText); - rec_len = (int)(info.size() / (sample_rate * bytes_per_sample)); + rec_len = (int)(info.size() / (playback_sample_rate * bytes_per_sample)); // Get duration of selected recording and update label refreshTimeWidgets(); @@ -128,7 +132,7 @@ void CIqTool::on_playButton_clicked(bool checked) ui->listWidget->setEnabled(false); ui->recButton->setEnabled(false); emit startPlayback(recdir->absoluteFilePath(current_file), - (float)sample_rate, center_freq); + (float)playback_sample_rate, center_freq); } } else @@ -160,7 +164,7 @@ void CIqTool::on_slider_valueChanged(int value) { refreshTimeWidgets(); - qint64 seek_pos = (qint64)(value)*sample_rate; + qint64 seek_pos = (qint64)(value)*playback_sample_rate; emit seek(seek_pos); } @@ -278,6 +282,16 @@ void CIqTool::on_recDirButton_clicked() ui->recDirEdit->setText(dir); } +void CIqTool::on_centerFreqSpinBox_valueChanged(double value) +{ + center_freq = value * 1000.0; +} + +void CIqTool::on_sampleRateSpinBox_valueChanged(double value) +{ + playback_sample_rate = value * 1000.0; +} + void CIqTool::timeoutFunction(void) { refreshDir(); @@ -373,7 +387,7 @@ void CIqTool::parseFileName(const QString &filename) center = list.at(3).toLongLong(¢er_ok); if (sr_ok) - sample_rate = sr; + ui->sampleRateSpinBox->setValue(sr / 1000.0); if (center_ok) - center_freq = center; + ui->centerFreqSpinBox->setValue(center / 1000.0); } diff --git a/src/qtgui/iq_tool.h b/src/qtgui/iq_tool.h index cb8da0f5b1..62c3f16b51 100644 --- a/src/qtgui/iq_tool.h +++ b/src/qtgui/iq_tool.h @@ -79,6 +79,8 @@ private slots: void on_playButton_clicked(bool checked); void on_slider_valueChanged(int value); void on_listWidget_currentTextChanged(const QString ¤tText); + void on_centerFreqSpinBox_valueChanged(double value); + void on_sampleRateSpinBox_valueChanged(double value); void timeoutFunction(void); private: @@ -98,6 +100,7 @@ private slots: bool is_recording; bool is_playing; int bytes_per_sample; /*!< Bytes per sample (fc = 4) */ + int playback_sample_rate; /*!< Playback sample rate. */ int sample_rate; /*!< Current sample rate. */ qint64 center_freq; /*!< Center frequency. */ int rec_len; /*!< Length of a recording in seconds */ diff --git a/src/qtgui/iq_tool.ui b/src/qtgui/iq_tool.ui index e28618dd1d..50d21f08fc 100644 --- a/src/qtgui/iq_tool.ui +++ b/src/qtgui/iq_tool.ui @@ -6,7 +6,7 @@ 0 0 - 482 + 499 327 @@ -209,6 +209,80 @@ + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Sample Rate, ksps + + + false + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + 3 + + + 999999.989999999990687 + + + + + + + + 0 + 0 + + + + Frequency, kHz + + + + + + + + 0 + 0 + + + + 3 + + + 99999999.989999994635582 + + + + +