From 71e65c4e9c67440295b8461b6dd2434853a926fe Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 1 Apr 2020 08:44:51 +0200 Subject: [PATCH] RTLSDR GUI file record: right click to choose file --- plugins/samplesource/rtlsdr/rtlsdrgui.cpp | 30 +++++++++++++++++++++++ plugins/samplesource/rtlsdr/rtlsdrgui.h | 1 + plugins/samplesource/rtlsdr/rtlsdrgui.ui | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.cpp b/plugins/samplesource/rtlsdr/rtlsdrgui.cpp index 842f061cf..ffa7e6fd1 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrgui.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrgui.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "rtlsdrgui.h" @@ -69,6 +70,9 @@ RTLSDRGui::RTLSDRGui(DeviceUISet *deviceUISet, QWidget* parent) : CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop); connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &))); + + CRightClickEnabler *fileRecordRightClickEnabler = new CRightClickEnabler(ui->record); + connect(fileRecordRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openFileRecordDialog(const QPoint &))); } RTLSDRGui::~RTLSDRGui() @@ -576,3 +580,29 @@ void RTLSDRGui::openDeviceSettingsDialog(const QPoint& p) sendSettings(); } + +void RTLSDRGui::openFileRecordDialog(const QPoint& p) +{ + QFileDialog fileDialog( + this, + tr("Save I/Q record file"), + m_settings.m_fileRecordName, + tr("SDR I/Q Files (*.sdriq)") + ); + + fileDialog.setOptions(QFileDialog::DontUseNativeDialog); + fileDialog.setFileMode(QFileDialog::AnyFile); + fileDialog.move(p); + QStringList fileNames; + + if (fileDialog.exec()) + { + fileNames = fileDialog.selectedFiles(); + + if (fileNames.size() > 0) + { + m_settings.m_fileRecordName = fileNames.at(0); + sendSettings(); + } + } +} diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.h b/plugins/samplesource/rtlsdr/rtlsdrgui.h index fd6178bdb..28f16cdfd 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrgui.h +++ b/plugins/samplesource/rtlsdr/rtlsdrgui.h @@ -98,6 +98,7 @@ private slots: void on_transverter_clicked(); void on_sampleRateMode_toggled(bool checked); void openDeviceSettingsDialog(const QPoint& p); + void openFileRecordDialog(const QPoint& p); void updateHardware(); void updateStatus(); }; diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.ui b/plugins/samplesource/rtlsdr/rtlsdrgui.ui index 4dff70c54..2b4c55c55 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrgui.ui +++ b/plugins/samplesource/rtlsdr/rtlsdrgui.ui @@ -74,7 +74,7 @@ - Toggle record I/Q samples from device + Left: toggle record I/Q samples from device - Right: select output file