1 /* -*- c++ -*- */ 2 /* 3 * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt 4 * https://gqrx.dk/ 5 * 6 * Copyright 2014 Alexandru Csete OZ9AEC. 7 * 8 * Gqrx is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 3, or (at your option) 11 * any later version. 12 * 13 * Gqrx is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with Gqrx; see the file COPYING. If not, write to 20 * the Free Software Foundation, Inc., 51 Franklin Street, 21 * Boston, MA 02110-1301, USA. 22 */ 23 #ifndef IQ_TOOL_H 24 #define IQ_TOOL_H 25 26 #include <QCloseEvent> 27 #include <QDialog> 28 #include <QDir> 29 #include <QPalette> 30 #include <QSettings> 31 #include <QShowEvent> 32 #include <QString> 33 #include <QTimer> 34 35 namespace Ui { 36 class CIqTool; 37 } 38 39 40 struct iqt_cplx 41 { 42 float re; 43 float im; 44 }; 45 46 47 /*! \brief User interface for I/Q recording and playback. */ 48 class CIqTool : public QDialog 49 { 50 Q_OBJECT 51 52 public: 53 explicit CIqTool(QWidget *parent = 0); 54 ~CIqTool(); 55 56 void setSampleRate(qint64 sr); 57 58 void closeEvent(QCloseEvent *event); 59 void showEvent(QShowEvent * event); 60 61 void saveSettings(QSettings *settings); 62 void readSettings(QSettings *settings); 63 64 signals: 65 void startRecording(const QString recdir); 66 void stopRecording(); 67 void startPlayback(const QString filename, float samprate); 68 void stopPlayback(); 69 void seek(qint64 seek_pos); 70 71 public slots: 72 void cancelRecording(); 73 void cancelPlayback(); 74 75 private slots: 76 void on_recDirEdit_textChanged(const QString &text); 77 void on_recDirButton_clicked(); 78 void on_recButton_clicked(bool checked); 79 void on_playButton_clicked(bool checked); 80 void on_slider_valueChanged(int value); 81 void on_listWidget_currentTextChanged(const QString ¤tText); 82 void timeoutFunction(void); 83 84 private: 85 void refreshDir(void); 86 void refreshTimeWidgets(void); 87 qint64 sampleRateFromFileName(const QString &filename); 88 89 90 private: 91 Ui::CIqTool *ui; 92 93 QDir *recdir; 94 QTimer *timer; 95 QPalette *error_palette; /*!< Palette used to indicate an error. */ 96 97 QString current_file; /*!< Selected file in file browser. */ 98 99 bool is_recording; 100 bool is_playing; 101 int bytes_per_sample; /*!< Bytes per sample (fc = 4) */ 102 int sample_rate; /*!< Current sample rate. */ 103 int rec_len; /*!< Length of a recording in seconds */ 104 }; 105 106 #endif // IQ_TOOL_H 107