2015-08-02 23:04:20 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2015 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 <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef INCLUDE_FILESOURCEGUI_H
|
|
|
|
#define INCLUDE_FILESOURCEGUI_H
|
|
|
|
|
2017-09-25 22:22:08 +00:00
|
|
|
#include <plugin/plugininstancegui.h>
|
2015-08-02 23:04:20 +00:00
|
|
|
#include <QTimer>
|
2017-09-03 15:26:32 +00:00
|
|
|
#include <QWidget>
|
|
|
|
|
2017-09-16 20:23:31 +00:00
|
|
|
#include "util/messagequeue.h"
|
|
|
|
|
2017-12-24 10:04:30 +00:00
|
|
|
#include "filesourcesettings.h"
|
2015-08-02 23:04:20 +00:00
|
|
|
#include "filesourceinput.h"
|
|
|
|
|
2017-10-29 23:02:28 +00:00
|
|
|
class DeviceUISet;
|
2015-08-02 23:04:20 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class FileSourceGui;
|
|
|
|
}
|
|
|
|
|
2017-09-25 22:22:08 +00:00
|
|
|
class FileSourceGui : public QWidget, public PluginInstanceGUI {
|
2015-08-02 23:04:20 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-10-29 23:45:23 +00:00
|
|
|
explicit FileSourceGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
|
2015-08-17 06:29:34 +00:00
|
|
|
virtual ~FileSourceGui();
|
2017-09-16 08:45:08 +00:00
|
|
|
virtual void destroy();
|
2015-08-02 23:04:20 +00:00
|
|
|
|
|
|
|
void setName(const QString& name);
|
|
|
|
QString getName() const;
|
|
|
|
|
|
|
|
void resetToDefaults();
|
2015-09-29 01:35:14 +00:00
|
|
|
virtual qint64 getCenterFrequency() const;
|
|
|
|
virtual void setCenterFrequency(qint64 centerFrequency);
|
2015-08-02 23:04:20 +00:00
|
|
|
QByteArray serialize() const;
|
|
|
|
bool deserialize(const QByteArray& data);
|
2017-09-16 20:23:31 +00:00
|
|
|
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
2015-08-17 06:29:34 +00:00
|
|
|
virtual bool handleMessage(const Message& message);
|
2015-08-02 23:04:20 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::FileSourceGui* ui;
|
|
|
|
|
2017-10-29 23:02:28 +00:00
|
|
|
DeviceUISet* m_deviceUISet;
|
2017-12-24 10:04:30 +00:00
|
|
|
FileSourceSettings m_settings;
|
2017-12-14 17:02:49 +00:00
|
|
|
bool m_doApplySettings;
|
2016-05-11 21:35:16 +00:00
|
|
|
QTimer m_statusTimer;
|
2015-08-02 23:04:20 +00:00
|
|
|
std::vector<int> m_gains;
|
2016-10-02 21:16:40 +00:00
|
|
|
DeviceSampleSource* m_sampleSource;
|
2015-08-04 02:17:24 +00:00
|
|
|
bool m_acquisition;
|
2015-08-05 01:25:06 +00:00
|
|
|
QString m_fileName;
|
2015-08-04 02:17:24 +00:00
|
|
|
int m_sampleRate;
|
2018-01-25 22:52:36 +00:00
|
|
|
quint32 m_sampleSize;
|
2015-08-04 02:17:24 +00:00
|
|
|
quint64 m_centerFrequency;
|
2016-02-25 01:30:50 +00:00
|
|
|
quint32 m_recordLength;
|
2015-08-04 02:17:24 +00:00
|
|
|
std::time_t m_startingTimeStamp;
|
|
|
|
int m_samplesCount;
|
2015-08-05 23:43:35 +00:00
|
|
|
std::size_t m_tickCount;
|
2016-02-25 13:07:39 +00:00
|
|
|
bool m_enableNavTime;
|
2016-05-12 10:29:12 +00:00
|
|
|
int m_deviceSampleRate;
|
|
|
|
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
2016-05-11 21:35:16 +00:00
|
|
|
int m_lastEngineState;
|
2017-09-16 20:23:31 +00:00
|
|
|
MessageQueue m_inputMessageQueue;
|
2015-08-02 23:04:20 +00:00
|
|
|
|
2017-12-14 17:02:49 +00:00
|
|
|
void blockApplySettings(bool block) { m_doApplySettings = !block; }
|
2015-08-02 23:04:20 +00:00
|
|
|
void displaySettings();
|
2015-08-04 02:17:24 +00:00
|
|
|
void displayTime();
|
2015-08-02 23:04:20 +00:00
|
|
|
void sendSettings();
|
2016-05-12 10:29:12 +00:00
|
|
|
void updateSampleRateAndFrequency();
|
2015-08-05 01:25:06 +00:00
|
|
|
void configureFileName();
|
|
|
|
void updateWithAcquisition();
|
|
|
|
void updateWithStreamData();
|
|
|
|
void updateWithStreamTime();
|
2015-08-02 23:04:20 +00:00
|
|
|
|
|
|
|
private slots:
|
2017-09-16 23:23:54 +00:00
|
|
|
void handleInputMessages();
|
2016-05-11 21:35:16 +00:00
|
|
|
void on_startStop_toggled(bool checked);
|
2015-08-02 23:04:20 +00:00
|
|
|
void on_playLoop_toggled(bool checked);
|
|
|
|
void on_play_toggled(bool checked);
|
2016-02-25 13:07:39 +00:00
|
|
|
void on_navTimeSlider_valueChanged(int value);
|
2015-08-04 23:43:30 +00:00
|
|
|
void on_showFileDialog_clicked(bool checked);
|
2016-05-11 21:35:16 +00:00
|
|
|
void updateStatus();
|
2015-08-05 23:43:35 +00:00
|
|
|
void tick();
|
2015-08-02 23:04:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_FILESOURCEGUI_H
|