diff --git a/plugins/samplesource/filesource/filesourcegui.cpp b/plugins/samplesource/filesource/filesourcegui.cpp index 09aabe75a..f7e96716b 100644 --- a/plugins/samplesource/filesource/filesourcegui.cpp +++ b/plugins/samplesource/filesource/filesourcegui.cpp @@ -51,6 +51,7 @@ FileSourceGui::FileSourceGui(PluginAPI* pluginAPI, QWidget* parent) : displaySettings(); m_sampleSource = new FileSourceInput(m_pluginAPI->getMainWindow()->getMasterTimer()); + connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); DSPEngine::instance()->setSource(m_sampleSource); } @@ -105,13 +106,13 @@ bool FileSourceGui::deserialize(const QByteArray& data) bool FileSourceGui::handleMessage(const Message& message) { - if(FileSourceInput::MsgReportFileSourceAcquisition::match(message)) + if (FileSourceInput::MsgReportFileSourceAcquisition::match(message)) { m_acquisition = ((FileSourceInput::MsgReportFileSourceAcquisition&)message).getAcquisition(); updateWithAcquisition(); return true; } - else if(FileSourceInput::MsgReportFileSourceStreamData::match(message)) + else if (FileSourceInput::MsgReportFileSourceStreamData::match(message)) { m_sampleRate = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getSampleRate(); m_centerFrequency = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getCenterFrequency(); @@ -119,7 +120,7 @@ bool FileSourceGui::handleMessage(const Message& message) updateWithStreamData(); return true; } - else if(FileSourceInput::MsgReportFileSourceStreamTiming::match(message)) + else if (FileSourceInput::MsgReportFileSourceStreamTiming::match(message)) { m_samplesCount = ((FileSourceInput::MsgReportFileSourceStreamTiming&)message).getSamplesCount(); updateWithStreamTime(); @@ -131,6 +132,21 @@ bool FileSourceGui::handleMessage(const Message& message) } } +void FileSourceGui::handleSourceMessages() +{ + Message* message; + + while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0) + { + qDebug("FileSourceGui::handleSourceMessages: message: %s", message->getIdentifier()); + + if (handleMessage(*message)) + { + delete message; + } + } +} + void FileSourceGui::displaySettings() { } diff --git a/plugins/samplesource/filesource/filesourcegui.h b/plugins/samplesource/filesource/filesourcegui.h index b907eef91..1f4503609 100644 --- a/plugins/samplesource/filesource/filesourcegui.h +++ b/plugins/samplesource/filesource/filesourcegui.h @@ -71,6 +71,7 @@ private: void updateWithStreamTime(); private slots: + void handleSourceMessages(); void on_playLoop_toggled(bool checked); void on_play_toggled(bool checked); void on_showFileDialog_clicked(bool checked); diff --git a/plugins/samplesource/filesource/filesourceinput.cpp b/plugins/samplesource/filesource/filesourceinput.cpp index 55f331bab..d2fbabebe 100644 --- a/plugins/samplesource/filesource/filesourceinput.cpp +++ b/plugins/samplesource/filesource/filesourceinput.cpp @@ -106,7 +106,7 @@ void FileSourceInput::openFileStream() m_startingTimeStamp = header.startTimeStamp; MsgReportFileSourceStreamData *report = MsgReportFileSourceStreamData::create(m_sampleRate, m_centerFrequency, m_startingTimeStamp); // file stream data - getOutputMessageQueue()->push(report); + getOutputMessageQueueToGUI()->push(report); } bool FileSourceInput::init(const Message& message) @@ -147,7 +147,7 @@ bool FileSourceInput::start(int device) qDebug("FileSourceInput::startInput: started"); MsgReportFileSourceAcquisition *report = MsgReportFileSourceAcquisition::create(true); // acquisition on - getOutputMessageQueue()->push(report); + getOutputMessageQueueToGUI()->push(report); return true; } @@ -167,7 +167,7 @@ void FileSourceInput::stop() m_deviceDescription.clear(); MsgReportFileSourceAcquisition *report = MsgReportFileSourceAcquisition::create(false); // acquisition off - getOutputMessageQueue()->push(report); + getOutputMessageQueueToGUI()->push(report); } const QString& FileSourceInput::getDeviceDescription() const @@ -217,7 +217,7 @@ bool FileSourceInput::handleMessage(const Message& message) MsgReportFileSourceStreamTiming *report = MsgReportFileSourceStreamTiming::create(m_fileSourceThread->getSamplesCount()); - getOutputMessageQueue()->push(report); + getOutputMessageQueueToGUI()->push(report); } return true; @@ -235,7 +235,7 @@ bool FileSourceInput::handleMessage(const Message& message) report = MsgReportFileSourceStreamTiming::create(0); } - getOutputMessageQueue()->push(report); + getOutputMessageQueueToGUI()->push(report); } else { diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.cpp b/plugins/samplesource/rtlsdr/rtlsdrgui.cpp index c17cbbefb..93a78c16f 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrgui.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrgui.cpp @@ -19,7 +19,7 @@ RTLSDRGui::RTLSDRGui(PluginAPI* pluginAPI, QWidget* parent) : displaySettings(); m_sampleSource = new RTLSDRInput(); - connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(HandleSourceMessages())); + connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); DSPEngine::instance()->setSource(m_sampleSource); } @@ -90,7 +90,7 @@ bool RTLSDRGui::handleMessage(const Message& message) } } -void RTLSDRGui::HandleSourceMessages() +void RTLSDRGui::handleSourceMessages() { Message* message; diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.h b/plugins/samplesource/rtlsdr/rtlsdrgui.h index a06aba748..bd4004233 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrgui.h +++ b/plugins/samplesource/rtlsdr/rtlsdrgui.h @@ -49,7 +49,7 @@ private slots: void on_samplerate_valueChanged(int value); void on_checkBox_stateChanged(int state); void updateHardware(); - void HandleSourceMessages(); + void handleSourceMessages(); }; class RTLSDRSampleRates {