1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Deep redesign: Fixed file source reporting to its GUI

This commit is contained in:
f4exb 2015-08-26 09:25:02 +02:00
parent b185ef0558
commit 03004b2eb9
5 changed files with 28 additions and 11 deletions

View File

@ -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()
{
}

View File

@ -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);

View File

@ -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
{

View File

@ -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;

View File

@ -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 {