SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Slots | Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
FileSourceGUI Class Reference

#include <filesourcegui.h>

+ Inheritance diagram for FileSourceGUI:
+ Collaboration diagram for FileSourceGUI:

Public Slots

void channelMarkerChangedByCursor ()
 

Public Member Functions

virtual void destroy ()
 
void setName (const QString &name)
 
QString getName () const
 
virtual qint64 getCenterFrequency () const
 
virtual void setCenterFrequency (qint64 centerFrequency)
 
void resetToDefaults ()
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 
virtual MessageQueuegetInputMessageQueue ()
 
virtual bool handleMessage (const Message &message)
 
- Public Member Functions inherited from RollupWidget
 RollupWidget (QWidget *parent=NULL)
 
void setTitleColor (const QColor &c)
 
void setHighlighted (bool highlighted)
 
- Public Member Functions inherited from PluginInstanceGUI
 PluginInstanceGUI ()
 
virtual ~PluginInstanceGUI ()
 

Static Public Member Functions

static FileSourceGUIcreate (PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
 

Private Slots

void handleSourceMessages ()
 
void onWidgetRolled (QWidget *widget, bool rollDown)
 
void onMenuDialogCalled (const QPoint &p)
 
void on_interpolationFactor_currentIndexChanged (int index)
 
void on_position_valueChanged (int value)
 
void on_gain_valueChanged (int value)
 
void on_showFileDialog_clicked (bool checked)
 
void on_playLoop_toggled (bool checked)
 
void on_play_toggled (bool checked)
 
void on_navTime_valueChanged (int value)
 
void tick ()
 

Private Member Functions

 FileSourceGUI (PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget *parent=nullptr)
 
virtual ~FileSourceGUI ()
 
void blockApplySettings (bool block)
 
void applySettings (bool force=false)
 
void applyChannelSettings ()
 
void configureFileName ()
 
void updateWithAcquisition ()
 
void updateWithStreamData ()
 
void updateWithStreamTime ()
 
void displaySettings ()
 
void displayRateAndShift ()
 
void leaveEvent (QEvent *)
 
void enterEvent (QEvent *)
 
void applyInterpolation ()
 
void applyPosition ()
 

Private Attributes

Ui::FileSourceGUI * ui
 
PluginAPIm_pluginAPI
 
DeviceUISetm_deviceUISet
 
ChannelMarker m_channelMarker
 
FileSourceSettings m_settings
 
int m_sampleRate
 
double m_shiftFrequencyFactor
 Channel frequency shift factor. More...
 
QString m_fileName
 
int m_fileSampleRate
 
quint32 m_fileSampleSize
 
quint64 m_recordLength
 
quint64 m_startingTimeStamp
 
quint64 m_samplesCount
 
bool m_acquisition
 
bool m_enableNavTime
 
bool m_doApplySettings
 
FileSourcem_fileSource
 
MessageQueue m_inputMessageQueue
 
QTime m_time
 
uint32_t m_tickCount
 

Additional Inherited Members

- Signals inherited from RollupWidget
void widgetRolled (QWidget *widget, bool rollDown)
 
- Protected Types inherited from RollupWidget
enum  { VersionMarker = 0xff }
 
enum  ContextMenuType { ContextMenuNone, ContextMenuChannelSettings, ContextMenuStreamSettings }
 
- Protected Member Functions inherited from RollupWidget
int arrangeRollups ()
 
QByteArray saveState (int version=0) const
 
bool restoreState (const QByteArray &state, int version=0)
 
void paintEvent (QPaintEvent *)
 
int paintRollup (QWidget *rollup, int pos, QPainter *p, bool last, const QColor &frame)
 
void resizeEvent (QResizeEvent *size)
 
void mousePressEvent (QMouseEvent *event)
 
bool event (QEvent *event)
 
bool eventFilter (QObject *object, QEvent *event)
 
void resetContextMenuType ()
 
void setStreamIndicator (const QString &indicator)
 
- Protected Attributes inherited from RollupWidget
QColor m_titleColor
 
QColor m_titleTextColor
 
bool m_highlighted
 
ContextMenuType m_contextMenuType
 
QString m_streamIndicator
 

Detailed Description

Definition at line 39 of file filesourcegui.h.

Constructor & Destructor Documentation

◆ FileSourceGUI()

FileSourceGUI::FileSourceGUI ( PluginAPI pluginAPI,
DeviceUISet deviceUISet,
BasebandSampleSource channelTx,
QWidget *  parent = nullptr 
)
explicitprivate

Definition at line 156 of file filesourcegui.cpp.

References DeviceUISet::addChannelMarker(), DeviceUISet::addRollupWidget(), applySettings(), channelMarkerChangedByCursor(), LevelMeterSignalDB::ColorGreenAndBlue, displaySettings(), getInputMessageQueue(), DeviceAPI::getMasterTimer(), handleSourceMessages(), FileSource::m_channelIdURI, m_channelMarker, DeviceUISet::m_deviceAPI, m_deviceUISet, m_fileSource, FileSourceSettings::m_rgbColor, m_settings, m_time, onMenuDialogCalled(), onWidgetRolled(), DeviceUISet::registerTxChannelInstance(), ChannelMarker::setCenterFrequency(), FileSourceSettings::setChannelMarker(), ChannelMarker::setColor(), BasebandSampleSource::setMessageQueueToGUI(), ChannelMarker::setMovable(), ChannelMarker::setSourceOrSinkStream(), ChannelMarker::setTitle(), ChannelMarker::setVisible(), tick(), ui, and RollupWidget::widgetRolled().

Referenced by create().

156  :
157  RollupWidget(parent),
158  ui(new Ui::FileSourceGUI),
159  m_pluginAPI(pluginAPI),
160  m_deviceUISet(deviceUISet),
161  m_sampleRate(0),
163  m_fileSampleRate(0),
164  m_fileSampleSize(0),
165  m_recordLength(0),
167  m_samplesCount(0),
168  m_acquisition(false),
169  m_enableNavTime(false),
170  m_doApplySettings(true),
171  m_tickCount(0)
172 {
173  (void) channelTx;
174 
175  ui->setupUi(this);
176  ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
177 
178  setAttribute(Qt::WA_DeleteOnClose, true);
179  connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
180  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
181 
182  m_fileSource = (FileSource*) channelTx;
184 
185  connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
186 
187  m_channelMarker.blockSignals(true);
190  m_channelMarker.setTitle("File source");
191  m_channelMarker.setMovable(false); // do not let user move the center arbitrarily
193  m_channelMarker.blockSignals(false);
194  m_channelMarker.setVisible(true); // activate signal on the last setting only
195 
197 
201 
202  connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
203  connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
204 
205  m_time.start();
206 
207  displaySettings();
208  applySettings(true);
209 }
void applySettings(bool force=false)
void registerTxChannelInstance(const QString &channelName, PluginInstanceGUI *pluginGUI)
Definition: deviceuiset.cpp:88
void channelMarkerChangedByCursor()
quint64 m_startingTimeStamp
Definition: filesourcegui.h:72
const QTimer & getMasterTimer() const
This is the DSPEngine master timer.
Definition: deviceapi.h:173
void addChannelMarker(ChannelMarker *channelMarker)
Add channel marker to spectrum.
Definition: deviceuiset.cpp:72
quint32 m_fileSampleSize
Definition: filesourcegui.h:70
void onWidgetRolled(QWidget *widget, bool rollDown)
RollupWidget(QWidget *parent=NULL)
Definition: rollupwidget.cpp:7
DeviceAPI * m_deviceAPI
Definition: deviceuiset.h:48
void displaySettings()
void setSourceOrSinkStream(bool sourceOrSinkStream)
Definition: channelmarker.h:75
void onMenuDialogCalled(const QPoint &p)
uint32_t m_tickCount
Definition: filesourcegui.h:82
void setMovable(bool movable)
Definition: channelmarker.h:66
quint64 m_samplesCount
Definition: filesourcegui.h:73
FileSourceSettings m_settings
Definition: filesourcegui.h:65
quint64 m_recordLength
Definition: filesourcegui.h:71
void addRollupWidget(QWidget *widget)
Add rollup widget to channel window.
Definition: deviceuiset.cpp:77
virtual void setMessageQueueToGUI(MessageQueue *queue)
void handleSourceMessages()
bool m_enableNavTime
Definition: filesourcegui.h:75
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
bool m_doApplySettings
Definition: filesourcegui.h:76
FileSource * m_fileSource
Definition: filesourcegui.h:78
ChannelMarker m_channelMarker
Definition: filesourcegui.h:64
void setColor(const QColor &color)
double m_shiftFrequencyFactor
Channel frequency shift factor.
Definition: filesourcegui.h:67
virtual MessageQueue * getInputMessageQueue()
Definition: filesourcegui.h:54
void setVisible(bool visible)
void setTitle(const QString &title)
PluginAPI * m_pluginAPI
Definition: filesourcegui.h:62
void setCenterFrequency(int centerFrequency)
void setChannelMarker(Serializable *channelMarker)
void widgetRolled(QWidget *widget, bool rollDown)
static const QString m_channelIdURI
Definition: filesource.h:377
DeviceUISet * m_deviceUISet
Definition: filesourcegui.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~FileSourceGUI()

FileSourceGUI::~FileSourceGUI ( )
privatevirtual

Definition at line 211 of file filesourcegui.cpp.

References m_deviceUISet, m_fileSource, DeviceUISet::removeTxChannelInstance(), and ui.

212 {
214  delete m_fileSource;
215  delete ui;
216 }
void removeTxChannelInstance(PluginInstanceGUI *pluginGUI)
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
FileSource * m_fileSource
Definition: filesourcegui.h:78
DeviceUISet * m_deviceUISet
Definition: filesourcegui.h:63
+ Here is the call graph for this function:

Member Function Documentation

◆ applyChannelSettings()

void FileSourceGUI::applyChannelSettings ( )
private

Definition at line 234 of file filesourcegui.cpp.

References FileSource::MsgConfigureChannelizer::create(), BasebandSampleSource::getInputMessageQueue(), m_doApplySettings, m_fileSource, FileSourceSettings::m_filterChainHash, FileSourceSettings::m_log2Interp, m_settings, and MessageQueue::push().

Referenced by applyPosition().

235 {
236  if (m_doApplySettings)
237  {
242  }
243 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
FileSourceSettings m_settings
Definition: filesourcegui.h:65
bool m_doApplySettings
Definition: filesourcegui.h:76
static MsgConfigureChannelizer * create(unsigned int m_log2Interp, unsigned int m_filterChainHash)
Definition: filesource.h:55
FileSource * m_fileSource
Definition: filesourcegui.h:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyInterpolation()

void FileSourceGUI::applyInterpolation ( )
private

Definition at line 454 of file filesourcegui.cpp.

References applyPosition(), i, FileSourceSettings::m_filterChainHash, FileSourceSettings::m_log2Interp, m_settings, and ui.

Referenced by displaySettings(), and on_interpolationFactor_currentIndexChanged().

455 {
456  uint32_t maxHash = 1;
457 
458  for (uint32_t i = 0; i < m_settings.m_log2Interp; i++) {
459  maxHash *= 3;
460  }
461 
462  ui->position->setMaximum(maxHash-1);
463  ui->position->setValue(m_settings.m_filterChainHash);
464  m_settings.m_filterChainHash = ui->position->value();
465  applyPosition();
466 }
unsigned int uint32_t
Definition: rtptypes_win.h:46
FileSourceSettings m_settings
Definition: filesourcegui.h:65
int32_t i
Definition: decimators.h:244
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyPosition()

void FileSourceGUI::applyPosition ( )
private

Definition at line 468 of file filesourcegui.cpp.

References applyChannelSettings(), arg(), HBFilterChainConverter::convertToString(), displayRateAndShift(), FileSourceSettings::m_filterChainHash, FileSourceSettings::m_log2Interp, m_settings, m_shiftFrequencyFactor, and ui.

Referenced by applyInterpolation(), and on_position_valueChanged().

469 {
470  ui->filterChainIndex->setText(tr("%1").arg(m_settings.m_filterChainHash));
471  QString s;
473  ui->filterChainText->setText(s);
474 
477 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
static double convertToString(unsigned int log2, unsigned int chainHash, QString &chainString)
void displayRateAndShift()
FileSourceSettings m_settings
Definition: filesourcegui.h:65
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
double m_shiftFrequencyFactor
Channel frequency shift factor.
Definition: filesourcegui.h:67
void applyChannelSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applySettings()

void FileSourceGUI::applySettings ( bool  force = false)
private

Definition at line 223 of file filesourcegui.cpp.

References FileSource::MsgConfigureFileSource::create(), ChannelMarker::getColor(), BasebandSampleSource::getInputMessageQueue(), m_channelMarker, m_doApplySettings, m_fileSource, m_settings, MessageQueue::push(), and RollupWidget::setTitleColor().

Referenced by deserialize(), FileSourceGUI(), on_gain_valueChanged(), onMenuDialogCalled(), and resetToDefaults().

224 {
225  if (m_doApplySettings)
226  {
228 
231  }
232 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgConfigureFileSource * create(const FileSourceSettings &settings, bool force)
Definition: filesource.h:77
void setTitleColor(const QColor &c)
FileSourceSettings m_settings
Definition: filesourcegui.h:65
bool m_doApplySettings
Definition: filesourcegui.h:76
FileSource * m_fileSource
Definition: filesourcegui.h:78
ChannelMarker m_channelMarker
Definition: filesourcegui.h:64
const QColor & getColor() const
Definition: channelmarker.h:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blockApplySettings()

void FileSourceGUI::blockApplySettings ( bool  block)
private

Definition at line 218 of file filesourcegui.cpp.

References m_doApplySettings.

Referenced by displaySettings(), and handleMessage().

219 {
220  m_doApplySettings = !block;
221 }
bool m_doApplySettings
Definition: filesourcegui.h:76
+ Here is the caller graph for this function:

◆ channelMarkerChangedByCursor

void FileSourceGUI::channelMarkerChangedByCursor ( )
slot

Definition at line 504 of file filesourcegui.cpp.

Referenced by FileSourceGUI().

505 {
506 }
+ Here is the caller graph for this function:

◆ configureFileName()

void FileSourceGUI::configureFileName ( )
private

Definition at line 245 of file filesourcegui.cpp.

References FileSource::MsgConfigureFileSourceName::create(), BasebandSampleSource::getInputMessageQueue(), m_fileName, m_fileSource, and MessageQueue::push().

Referenced by on_showFileDialog_clicked().

246 {
247  qDebug() << "FileSourceGui::configureFileName: " << m_fileName.toStdString().c_str();
250 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
FileSource * m_fileSource
Definition: filesourcegui.h:78
QString m_fileName
Definition: filesourcegui.h:68
static MsgConfigureFileSourceName * create(const QString &fileName)
Definition: filesource.h:119
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

FileSourceGUI * FileSourceGUI::create ( PluginAPI pluginAPI,
DeviceUISet deviceUISet,
BasebandSampleSource channelTx 
)
static

Definition at line 35 of file filesourcegui.cpp.

References FileSourceGUI().

Referenced by FileSourcePlugin::createTxChannelGUI().

36 {
37  FileSourceGUI* gui = new FileSourceGUI(pluginAPI, deviceUISet, channelTx);
38  return gui;
39 }
FileSourceGUI(PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget *parent=nullptr)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserialize()

bool FileSourceGUI::deserialize ( const QByteArray &  data)
virtual

Implements PluginInstanceGUI.

Definition at line 77 of file filesourcegui.cpp.

References applySettings(), FileSourceSettings::deserialize(), displaySettings(), m_settings, and resetToDefaults().

78 {
79  if(m_settings.deserialize(data)) {
81  applySettings(true);
82  return true;
83  } else {
85  return false;
86  }
87 }
void applySettings(bool force=false)
bool deserialize(const QByteArray &data)
void displaySettings()
FileSourceSettings m_settings
Definition: filesourcegui.h:65
void resetToDefaults()
+ Here is the call graph for this function:

◆ destroy()

void FileSourceGUI::destroy ( )
virtual

Implements PluginInstanceGUI.

Definition at line 41 of file filesourcegui.cpp.

42 {
43  delete this;
44 }

◆ displayRateAndShift()

void FileSourceGUI::displayRateAndShift ( )
private

Definition at line 322 of file filesourcegui.cpp.

References arg(), m_channelMarker, FileSourceSettings::m_log2Interp, m_sampleRate, m_settings, m_shiftFrequencyFactor, ChannelMarker::setBandwidth(), ChannelMarker::setCenterFrequency(), and ui.

Referenced by applyPosition(), and handleMessage().

323 {
324  int shift = m_shiftFrequencyFactor * m_sampleRate;
325  double channelSampleRate = ((double) m_sampleRate) / (1<<m_settings.m_log2Interp);
326  QLocale loc;
327  ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
328  ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
330  m_channelMarker.setBandwidth(channelSampleRate);
331 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
FileSourceSettings m_settings
Definition: filesourcegui.h:65
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
ChannelMarker m_channelMarker
Definition: filesourcegui.h:64
double m_shiftFrequencyFactor
Channel frequency shift factor.
Definition: filesourcegui.h:67
void setBandwidth(int bandwidth)
void setCenterFrequency(int centerFrequency)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displaySettings()

void FileSourceGUI::displaySettings ( )
private

Definition at line 302 of file filesourcegui.cpp.

References applyInterpolation(), arg(), blockApplySettings(), ChannelMarker::getTitle(), m_channelMarker, FileSourceSettings::m_gainDB, FileSourceSettings::m_log2Interp, FileSourceSettings::m_rgbColor, m_sampleRate, m_settings, FileSourceSettings::m_title, ChannelMarker::setBandwidth(), ChannelMarker::setCenterFrequency(), ChannelMarker::setColor(), ChannelMarker::setTitle(), RollupWidget::setTitleColor(), and ui.

Referenced by deserialize(), FileSourceGUI(), handleMessage(), and resetToDefaults().

303 {
304  m_channelMarker.blockSignals(true);
308  m_channelMarker.blockSignals(false);
309  m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
310 
312  setWindowTitle(m_channelMarker.getTitle());
313 
314  blockApplySettings(true);
315  ui->gain->setValue(m_settings.m_gainDB);
316  ui->gainText->setText(tr("%1 dB").arg(m_settings.m_gainDB));
317  ui->interpolationFactor->setCurrentIndex(m_settings.m_log2Interp);
319  blockApplySettings(false);
320 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
void blockApplySettings(bool block)
void setTitleColor(const QColor &c)
FileSourceSettings m_settings
Definition: filesourcegui.h:65
const QString & getTitle() const
Definition: channelmarker.h:38
void applyInterpolation()
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
ChannelMarker m_channelMarker
Definition: filesourcegui.h:64
void setColor(const QColor &color)
void setBandwidth(int bandwidth)
void setTitle(const QString &title)
void setCenterFrequency(int centerFrequency)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterEvent()

void FileSourceGUI::enterEvent ( QEvent *  )
private

Definition at line 338 of file filesourcegui.cpp.

References m_channelMarker, and ChannelMarker::setHighlighted().

339 {
341 }
void setHighlighted(bool highlighted)
ChannelMarker m_channelMarker
Definition: filesourcegui.h:64
+ Here is the call graph for this function:

◆ getCenterFrequency()

qint64 FileSourceGUI::getCenterFrequency ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 56 of file filesourcegui.cpp.

56  {
57  return 0;
58 }

◆ getInputMessageQueue()

virtual MessageQueue* FileSourceGUI::getInputMessageQueue ( )
inlinevirtual

Implements PluginInstanceGUI.

Definition at line 54 of file filesourcegui.h.

Referenced by FileSourceGUI(), and handleSourceMessages().

54 { return &m_inputMessageQueue; }
MessageQueue m_inputMessageQueue
Definition: filesourcegui.h:79
+ Here is the caller graph for this function:

◆ getName()

QString FileSourceGUI::getName ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 51 of file filesourcegui.cpp.

52 {
53  return objectName();
54 }

◆ handleMessage()

bool FileSourceGUI::handleMessage ( const Message message)
virtual

Implements PluginInstanceGUI.

Definition at line 89 of file filesourcegui.cpp.

References blockApplySettings(), displayRateAndShift(), displaySettings(), FileSource::MsgPlayPause::getPlayPause(), FileSource::MsgSampleRateNotification::getSampleRate(), FileSource::MsgConfigureFileSource::getSettings(), FileSource::MsgReportHeaderCRC::isOK(), m_acquisition, m_enableNavTime, m_fileSampleRate, m_fileSampleSize, m_recordLength, m_sampleRate, m_samplesCount, m_settings, m_startingTimeStamp, Message::match(), ui, updateWithAcquisition(), updateWithStreamData(), and updateWithStreamTime().

Referenced by handleSourceMessages().

90 {
92  {
94  m_sampleRate = notif.getSampleRate();
96  return true;
97  }
99  {
101  m_settings = cfg.getSettings();
102  blockApplySettings(true);
103  displaySettings();
104  blockApplySettings(false);
105  return true;
106  }
108  {
109  m_acquisition = ((FileSource::MsgReportFileSourceAcquisition&)message).getAcquisition();
111  return true;
112  }
114  {
115  m_fileSampleRate = ((FileSource::MsgReportFileSourceStreamData&)message).getSampleRate();
116  m_fileSampleSize = ((FileSource::MsgReportFileSourceStreamData&)message).getSampleSize();
117  m_startingTimeStamp = ((FileSource::MsgReportFileSourceStreamData&)message).getStartingTimeStamp();
118  m_recordLength = ((FileSource::MsgReportFileSourceStreamData&)message).getRecordLength();
120  return true;
121  }
123  {
124  m_samplesCount = ((FileSource::MsgReportFileSourceStreamTiming&)message).getSamplesCount();
126  return true;
127  }
128  else if (FileSource::MsgPlayPause::match(message))
129  {
131  bool checked = notif.getPlayPause();
132  ui->play->setChecked(checked);
133  ui->navTime->setEnabled(!checked);
134  m_enableNavTime = !checked;
135 
136  return true;
137  }
138  else if (FileSource::MsgReportHeaderCRC::match(message))
139  {
141 
142  if (notif.isOK()) {
143  ui->crcLabel->setStyleSheet("QLabel { background-color : green; }");
144  } else {
145  ui->crcLabel->setStyleSheet("QLabel { background-color : red; }");
146  }
147 
148  return true;
149  }
150  else
151  {
152  return false;
153  }
154 }
void updateWithStreamData()
bool getPlayPause() const
Definition: filesource.h:214
quint64 m_startingTimeStamp
Definition: filesourcegui.h:72
quint32 m_fileSampleSize
Definition: filesourcegui.h:70
void updateWithStreamTime()
void displaySettings()
void blockApplySettings(bool block)
void displayRateAndShift()
quint64 m_samplesCount
Definition: filesourcegui.h:73
FileSourceSettings m_settings
Definition: filesourcegui.h:65
quint64 m_recordLength
Definition: filesourcegui.h:71
static bool match(const Message *message)
Definition: message.cpp:45
void updateWithAcquisition()
bool m_enableNavTime
Definition: filesourcegui.h:75
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
const FileSourceSettings & getSettings() const
Definition: filesource.h:74
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleSourceMessages

void FileSourceGUI::handleSourceMessages ( )
privateslot

Definition at line 343 of file filesourcegui.cpp.

References getInputMessageQueue(), and handleMessage().

Referenced by FileSourceGUI().

344 {
345  Message* message;
346 
347  while ((message = getInputMessageQueue()->pop()) != 0)
348  {
349  if (handleMessage(*message))
350  {
351  delete message;
352  }
353  }
354 }
virtual MessageQueue * getInputMessageQueue()
Definition: filesourcegui.h:54
virtual bool handleMessage(const Message &message)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leaveEvent()

void FileSourceGUI::leaveEvent ( QEvent *  )
private

Definition at line 333 of file filesourcegui.cpp.

References m_channelMarker, and ChannelMarker::setHighlighted().

334 {
336 }
void setHighlighted(bool highlighted)
ChannelMarker m_channelMarker
Definition: filesourcegui.h:64
+ Here is the call graph for this function:

◆ on_gain_valueChanged

void FileSourceGUI::on_gain_valueChanged ( int  value)
privateslot

Definition at line 405 of file filesourcegui.cpp.

References applySettings(), arg(), FileSourceSettings::m_gainDB, m_settings, and ui.

406 {
407  ui->gainText->setText(tr("%1 dB").arg(value));
408  m_settings.m_gainDB = value;
409  applySettings();
410 }
void applySettings(bool force=false)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
FileSourceSettings m_settings
Definition: filesourcegui.h:65
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
+ Here is the call graph for this function:

◆ on_interpolationFactor_currentIndexChanged

void FileSourceGUI::on_interpolationFactor_currentIndexChanged ( int  index)
privateslot

Definition at line 393 of file filesourcegui.cpp.

References applyInterpolation(), FileSourceSettings::m_log2Interp, and m_settings.

394 {
395  m_settings.m_log2Interp = index;
397 }
FileSourceSettings m_settings
Definition: filesourcegui.h:65
void applyInterpolation()
+ Here is the call graph for this function:

◆ on_navTime_valueChanged

void FileSourceGUI::on_navTime_valueChanged ( int  value)
privateslot

Definition at line 445 of file filesourcegui.cpp.

References FileSource::MsgConfigureFileSourceSeek::create(), BasebandSampleSource::getInputMessageQueue(), m_enableNavTime, m_fileSource, and MessageQueue::push().

446 {
447  if (m_enableNavTime && ((value >= 0) && (value <= 1000)))
448  {
451  }
452 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgConfigureFileSourceSeek * create(int seekMillis)
Definition: filesource.h:176
bool m_enableNavTime
Definition: filesourcegui.h:75
FileSource * m_fileSource
Definition: filesourcegui.h:78
+ Here is the call graph for this function:

◆ on_play_toggled

void FileSourceGUI::on_play_toggled ( bool  checked)
privateslot

Definition at line 437 of file filesourcegui.cpp.

References FileSource::MsgConfigureFileSourceWork::create(), BasebandSampleSource::getInputMessageQueue(), m_enableNavTime, m_fileSource, MessageQueue::push(), and ui.

438 {
441  ui->navTime->setEnabled(!checked);
442  m_enableNavTime = !checked;
443 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
bool m_enableNavTime
Definition: filesourcegui.h:75
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
FileSource * m_fileSource
Definition: filesourcegui.h:78
static MsgConfigureFileSourceWork * create(bool working)
Definition: filesource.h:139
+ Here is the call graph for this function:

◆ on_playLoop_toggled

void FileSourceGUI::on_playLoop_toggled ( bool  checked)
privateslot

Definition at line 427 of file filesourcegui.cpp.

References FileSource::MsgConfigureFileSource::create(), BasebandSampleSource::getInputMessageQueue(), m_doApplySettings, m_fileSource, FileSourceSettings::m_loop, m_settings, and MessageQueue::push().

428 {
429  if (m_doApplySettings)
430  {
431  m_settings.m_loop = checked;
434  }
435 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgConfigureFileSource * create(const FileSourceSettings &settings, bool force)
Definition: filesource.h:77
FileSourceSettings m_settings
Definition: filesourcegui.h:65
bool m_doApplySettings
Definition: filesourcegui.h:76
FileSource * m_fileSource
Definition: filesourcegui.h:78
+ Here is the call graph for this function:

◆ on_position_valueChanged

void FileSourceGUI::on_position_valueChanged ( int  value)
privateslot

Definition at line 399 of file filesourcegui.cpp.

References applyPosition(), FileSourceSettings::m_filterChainHash, and m_settings.

400 {
402  applyPosition();
403 }
FileSourceSettings m_settings
Definition: filesourcegui.h:65
+ Here is the call graph for this function:

◆ on_showFileDialog_clicked

void FileSourceGUI::on_showFileDialog_clicked ( bool  checked)
privateslot

Definition at line 412 of file filesourcegui.cpp.

References configureFileName(), m_fileName, and ui.

413 {
414  (void) checked;
415  QString fileName = QFileDialog::getOpenFileName(this,
416  tr("Open I/Q record file"), ".", tr("SDR I/Q Files (*.sdriq)"), 0, QFileDialog::DontUseNativeDialog);
417 
418  if (fileName != "")
419  {
420  m_fileName = fileName;
421  ui->fileNameText->setText(m_fileName);
422  ui->crcLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
424  }
425 }
void configureFileName()
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
QString m_fileName
Definition: filesourcegui.h:68
+ Here is the call graph for this function:

◆ onMenuDialogCalled

void FileSourceGUI::onMenuDialogCalled ( const QPoint &  p)
privateslot

Definition at line 362 of file filesourcegui.cpp.

References applySettings(), RollupWidget::ContextMenuChannelSettings, ChannelMarker::getColor(), BasicChannelSettingsDialog::getReverseAPIAddress(), BasicChannelSettingsDialog::getReverseAPIChannelIndex(), BasicChannelSettingsDialog::getReverseAPIDeviceIndex(), BasicChannelSettingsDialog::getReverseAPIPort(), ChannelMarker::getTitle(), m_channelMarker, RollupWidget::m_contextMenuType, FileSourceSettings::m_reverseAPIAddress, FileSourceSettings::m_reverseAPIChannelIndex, FileSourceSettings::m_reverseAPIDeviceIndex, FileSourceSettings::m_reverseAPIPort, FileSourceSettings::m_rgbColor, m_settings, FileSourceSettings::m_title, FileSourceSettings::m_useReverseAPI, RollupWidget::resetContextMenuType(), BasicChannelSettingsDialog::setReverseAPIAddress(), BasicChannelSettingsDialog::setReverseAPIChannelIndex(), BasicChannelSettingsDialog::setReverseAPIDeviceIndex(), BasicChannelSettingsDialog::setReverseAPIPort(), RollupWidget::setTitleColor(), BasicChannelSettingsDialog::setUseReverseAPI(), and BasicChannelSettingsDialog::useReverseAPI().

Referenced by FileSourceGUI().

363 {
365  {
367  dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
368  dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
369  dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
370  dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
371  dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
372 
373  dialog.move(p);
374  dialog.exec();
375 
378  m_settings.m_useReverseAPI = dialog.useReverseAPI();
379  m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
380  m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
381  m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
382  m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
383 
384  setWindowTitle(m_settings.m_title);
386 
387  applySettings();
388  }
389 
391 }
void applySettings(bool force=false)
void resetContextMenuType()
Definition: rollupwidget.h:50
ContextMenuType m_contextMenuType
Definition: rollupwidget.h:33
void setTitleColor(const QColor &c)
FileSourceSettings m_settings
Definition: filesourcegui.h:65
const QString & getTitle() const
Definition: channelmarker.h:38
uint16_t m_reverseAPIChannelIndex
uint16_t m_reverseAPIDeviceIndex
ChannelMarker m_channelMarker
Definition: filesourcegui.h:64
const QColor & getColor() const
Definition: channelmarker.h:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onWidgetRolled

void FileSourceGUI::onWidgetRolled ( QWidget *  widget,
bool  rollDown 
)
privateslot

Definition at line 356 of file filesourcegui.cpp.

Referenced by FileSourceGUI().

357 {
358  (void) widget;
359  (void) rollDown;
360 }
+ Here is the caller graph for this function:

◆ resetToDefaults()

void FileSourceGUI::resetToDefaults ( )
virtual

Implements PluginInstanceGUI.

Definition at line 65 of file filesourcegui.cpp.

References applySettings(), displaySettings(), m_settings, and FileSourceSettings::resetToDefaults().

Referenced by deserialize().

66 {
69  applySettings(true);
70 }
void applySettings(bool force=false)
void displaySettings()
FileSourceSettings m_settings
Definition: filesourcegui.h:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

QByteArray FileSourceGUI::serialize ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 72 of file filesourcegui.cpp.

References m_settings, and FileSourceSettings::serialize().

73 {
74  return m_settings.serialize();
75 }
QByteArray serialize() const
FileSourceSettings m_settings
Definition: filesourcegui.h:65
+ Here is the call graph for this function:

◆ setCenterFrequency()

void FileSourceGUI::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements PluginInstanceGUI.

Definition at line 60 of file filesourcegui.cpp.

61 {
62  (void) centerFrequency;
63 }

◆ setName()

void FileSourceGUI::setName ( const QString &  name)
virtual

Implements PluginInstanceGUI.

Definition at line 46 of file filesourcegui.cpp.

47 {
48  setObjectName(name);
49 }

◆ tick

void FileSourceGUI::tick ( )
privateslot

Definition at line 479 of file filesourcegui.cpp.

References FileSource::MsgConfigureFileSourceStreamTiming::create(), CalcDb::dbPower(), BasebandSampleSource::getInputMessageQueue(), FileSource::getMagSqLevels(), m_fileSource, m_tickCount, MessageQueue::push(), and ui.

Referenced by FileSourceGUI().

480 {
481  double magsqAvg, magsqPeak;
482  int nbMagsqSamples;
483  m_fileSource->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
484  double powDbAvg = CalcDb::dbPower(magsqAvg);
485  double powDbPeak = CalcDb::dbPower(magsqPeak);
486 
487  ui->channelPowerMeter->levelChanged(
488  (100.0f + powDbAvg) / 100.0f,
489  (100.0f + powDbPeak) / 100.0f,
490  nbMagsqSamples);
491 
492  if (m_tickCount % 4 == 0) {
493  ui->channelPower->setText(QString::number(powDbAvg, 'f', 1));
494  }
495 
496  if (++m_tickCount == 20) // once per second
497  {
500  m_tickCount = 0;
501  }
502 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static double dbPower(double magsq, double floor=1e-12)
Definition: db.cpp:22
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
void getMagSqLevels(double &avg, double &peak, int &nbSamples)
Definition: filesource.h:359
uint32_t m_tickCount
Definition: filesourcegui.h:82
static MsgConfigureFileSourceStreamTiming * create()
Definition: filesource.h:158
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
FileSource * m_fileSource
Definition: filesourcegui.h:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateWithAcquisition()

void FileSourceGUI::updateWithAcquisition ( )
private

Definition at line 252 of file filesourcegui.cpp.

References m_acquisition, and ui.

Referenced by handleMessage().

253 {
254  ui->play->blockSignals(true);
255  ui->play->setChecked(m_acquisition);
256  ui->play->blockSignals(false);
257  ui->showFileDialog->setEnabled(!m_acquisition);
258 }
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
+ Here is the caller graph for this function:

◆ updateWithStreamData()

void FileSourceGUI::updateWithStreamData ( )
private

Definition at line 260 of file filesourcegui.cpp.

References arg(), m_fileSampleRate, m_fileSampleSize, m_recordLength, ui, and updateWithStreamTime().

Referenced by handleMessage().

261 {
262  ui->sampleRateText->setText(tr("%1k").arg((float) m_fileSampleRate / 1000));
263  ui->sampleSizeText->setText(tr("%1b").arg(m_fileSampleSize));
264  QTime recordLength(0, 0, 0, 0);
265  recordLength = recordLength.addSecs(m_recordLength);
266  QString s_time = recordLength.toString("HH:mm:ss");
267  ui->recordLengthText->setText(s_time);
269 }
quint32 m_fileSampleSize
Definition: filesourcegui.h:70
void updateWithStreamTime()
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
quint64 m_recordLength
Definition: filesourcegui.h:71
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateWithStreamTime()

void FileSourceGUI::updateWithStreamTime ( )
private

Definition at line 271 of file filesourcegui.cpp.

References m_enableNavTime, m_fileSampleRate, m_recordLength, m_samplesCount, m_startingTimeStamp, and ui.

Referenced by handleMessage(), and updateWithStreamData().

272 {
273  qint64 t_sec = 0;
274  qint64 t_msec = 0;
275 
276  if (m_fileSampleRate > 0)
277  {
279  t_msec = (m_samplesCount - (t_sec * m_fileSampleRate)) * 1000LL / m_fileSampleRate;
280  }
281 
282  QTime t(0, 0, 0, 0);
283  t = t.addSecs(t_sec);
284  t = t.addMSecs(t_msec);
285  QString s_timems = t.toString("HH:mm:ss.zzz");
286  ui->relTimeText->setText(s_timems);
287 
288  qint64 startingTimeStampMsec = m_startingTimeStamp * 1000LL;
289  QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec);
290  dt = dt.addSecs(t_sec);
291  dt = dt.addMSecs(t_msec);
292  QString s_date = dt.toString("yyyy-MM-dd HH:mm:ss.zzz");
293  ui->absTimeText->setText(s_date);
294 
295  if (!m_enableNavTime)
296  {
297  float posRatio = (float) t_sec / (float) m_recordLength;
298  ui->navTime->setValue((int) (posRatio * 1000.0));
299  }
300 }
quint64 m_startingTimeStamp
Definition: filesourcegui.h:72
quint64 m_samplesCount
Definition: filesourcegui.h:73
quint64 m_recordLength
Definition: filesourcegui.h:71
bool m_enableNavTime
Definition: filesourcegui.h:75
Ui::FileSourceGUI * ui
Definition: filesourcegui.h:61
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_acquisition

bool FileSourceGUI::m_acquisition
private

Definition at line 74 of file filesourcegui.h.

Referenced by handleMessage(), and updateWithAcquisition().

◆ m_channelMarker

ChannelMarker FileSourceGUI::m_channelMarker
private

◆ m_deviceUISet

DeviceUISet* FileSourceGUI::m_deviceUISet
private

Definition at line 63 of file filesourcegui.h.

Referenced by FileSourceGUI(), and ~FileSourceGUI().

◆ m_doApplySettings

bool FileSourceGUI::m_doApplySettings
private

◆ m_enableNavTime

bool FileSourceGUI::m_enableNavTime
private

◆ m_fileName

QString FileSourceGUI::m_fileName
private

Definition at line 68 of file filesourcegui.h.

Referenced by configureFileName(), and on_showFileDialog_clicked().

◆ m_fileSampleRate

int FileSourceGUI::m_fileSampleRate
private

Definition at line 69 of file filesourcegui.h.

Referenced by handleMessage(), updateWithStreamData(), and updateWithStreamTime().

◆ m_fileSampleSize

quint32 FileSourceGUI::m_fileSampleSize
private

Definition at line 70 of file filesourcegui.h.

Referenced by handleMessage(), and updateWithStreamData().

◆ m_fileSource

FileSource* FileSourceGUI::m_fileSource
private

◆ m_inputMessageQueue

MessageQueue FileSourceGUI::m_inputMessageQueue
private

Definition at line 79 of file filesourcegui.h.

◆ m_pluginAPI

PluginAPI* FileSourceGUI::m_pluginAPI
private

Definition at line 62 of file filesourcegui.h.

◆ m_recordLength

quint64 FileSourceGUI::m_recordLength
private

Definition at line 71 of file filesourcegui.h.

Referenced by handleMessage(), updateWithStreamData(), and updateWithStreamTime().

◆ m_sampleRate

int FileSourceGUI::m_sampleRate
private

Definition at line 66 of file filesourcegui.h.

Referenced by displayRateAndShift(), displaySettings(), and handleMessage().

◆ m_samplesCount

quint64 FileSourceGUI::m_samplesCount
private

Definition at line 73 of file filesourcegui.h.

Referenced by handleMessage(), and updateWithStreamTime().

◆ m_settings

FileSourceSettings FileSourceGUI::m_settings
private

◆ m_shiftFrequencyFactor

double FileSourceGUI::m_shiftFrequencyFactor
private

Channel frequency shift factor.

Definition at line 67 of file filesourcegui.h.

Referenced by applyPosition(), and displayRateAndShift().

◆ m_startingTimeStamp

quint64 FileSourceGUI::m_startingTimeStamp
private

Definition at line 72 of file filesourcegui.h.

Referenced by handleMessage(), and updateWithStreamTime().

◆ m_tickCount

uint32_t FileSourceGUI::m_tickCount
private

Definition at line 82 of file filesourcegui.h.

Referenced by tick().

◆ m_time

QTime FileSourceGUI::m_time
private

Definition at line 81 of file filesourcegui.h.

Referenced by FileSourceGUI().

◆ ui

Ui::FileSourceGUI* FileSourceGUI::ui
private

The documentation for this class was generated from the following files: