mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-17 05:41:56 -05:00
Add support for displaying images broadcast in the DAB demodulator GUI
This commit is contained in:
parent
ec8cdc63f4
commit
6bc925ebab
@ -48,6 +48,7 @@ MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABProgramQuality, Message)
|
|||||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABFIBQuality, Message)
|
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABFIBQuality, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABSampleRate, Message)
|
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABSampleRate, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABData, Message)
|
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABData, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABMOTData, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABReset, Message)
|
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABReset, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABResetService, Message)
|
MESSAGE_CLASS_DEFINITION(DABDemod::MsgDABResetService, Message)
|
||||||
|
|
||||||
@ -232,6 +233,16 @@ bool DABDemod::handleMessage(const Message& cmd)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgDABMOTData::match(cmd))
|
||||||
|
{
|
||||||
|
MsgDABMOTData& report = (MsgDABMOTData&)cmd;
|
||||||
|
if (getMessageQueueToGUI())
|
||||||
|
{
|
||||||
|
getMessageQueueToGUI()->push(new MsgDABMOTData(report));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (MsgDABReset::match(cmd))
|
else if (MsgDABReset::match(cmd))
|
||||||
{
|
{
|
||||||
MsgDABReset& report = (MsgDABReset&)cmd;
|
MsgDABReset& report = (MsgDABReset&)cmd;
|
||||||
|
@ -250,6 +250,29 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MsgDABMOTData : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
const QString getFilename() const { return m_filename; }
|
||||||
|
int getContentSubType() const { return m_contentSubType; }
|
||||||
|
|
||||||
|
static MsgDABMOTData* create(const QString& filename, int contentSubType)
|
||||||
|
{
|
||||||
|
return new MsgDABMOTData(filename, contentSubType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_filename;
|
||||||
|
int m_contentSubType;
|
||||||
|
|
||||||
|
MsgDABMOTData(const QString& filename, int contentSubType) :
|
||||||
|
Message(),
|
||||||
|
m_filename(filename),
|
||||||
|
m_contentSubType(contentSubType)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
class MsgDABReset : public Message {
|
class MsgDABReset : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
@ -180,6 +180,8 @@ void DABDemodGUI::on_programs_cellDoubleClicked(int row, int column)
|
|||||||
double frequencyInHz = ui->programs->item(row, PROGRAMS_COL_FREQUENCY)->data(Qt::UserRole).toDouble();
|
double frequencyInHz = ui->programs->item(row, PROGRAMS_COL_FREQUENCY)->data(Qt::UserRole).toDouble();
|
||||||
ChannelWebAPIUtils::setCenterFrequency(m_dabDemod->getDeviceSetIndex(), frequencyInHz-m_settings.m_inputFrequencyOffset);
|
ChannelWebAPIUtils::setCenterFrequency(m_dabDemod->getDeviceSetIndex(), frequencyInHz-m_settings.m_inputFrequencyOffset);
|
||||||
|
|
||||||
|
clearProgram();
|
||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +263,16 @@ bool DABDemodGUI::handleMessage(const Message& message)
|
|||||||
ui->data->setText(report.getData());
|
ui->data->setText(report.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (DABDemod::MsgDABMOTData::match(message))
|
||||||
|
{
|
||||||
|
DABDemod::MsgDABMOTData& report = (DABDemod::MsgDABMOTData&) message;
|
||||||
|
QPixmap pixmap(report.getFilename());
|
||||||
|
ui->motImage->resize(ui->motImage->width(), pixmap.height());
|
||||||
|
ui->motImage->setVisible(true);
|
||||||
|
ui->motImage->setPixmap(pixmap, pixmap.size());
|
||||||
|
arrangeRollups();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -452,6 +464,8 @@ DABDemodGUI::DABDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
|||||||
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
||||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||||
|
|
||||||
|
ui->motImage->setVisible(false);
|
||||||
|
|
||||||
// Resize the table using dummy data
|
// Resize the table using dummy data
|
||||||
resizeTable();
|
resizeTable();
|
||||||
// Allow user to reorder columns
|
// Allow user to reorder columns
|
||||||
@ -557,11 +571,8 @@ void DABDemodGUI::enterEvent(QEvent*)
|
|||||||
m_channelMarker.setHighlighted(true);
|
m_channelMarker.setHighlighted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DABDemodGUI::resetService()
|
void DABDemodGUI::clearProgram()
|
||||||
{
|
{
|
||||||
// Reset DAB audio service, to avoid unpleasent noise when changing frequency
|
|
||||||
DABDemod::MsgDABResetService* message = DABDemod::MsgDABResetService::create();
|
|
||||||
m_dabDemod->getInputMessageQueue()->push(message);
|
|
||||||
// Clear current program
|
// Clear current program
|
||||||
ui->program->setText("-");
|
ui->program->setText("-");
|
||||||
ui->ensemble->setText("-");
|
ui->ensemble->setText("-");
|
||||||
@ -571,6 +582,17 @@ void DABDemodGUI::resetService()
|
|||||||
ui->bitrate->setText("-");
|
ui->bitrate->setText("-");
|
||||||
ui->sampleRate->setText("-");
|
ui->sampleRate->setText("-");
|
||||||
ui->data->setText("");
|
ui->data->setText("");
|
||||||
|
ui->motImage->setPixmap(QPixmap());
|
||||||
|
ui->motImage->setVisible(false);
|
||||||
|
arrangeRollups();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DABDemodGUI::resetService()
|
||||||
|
{
|
||||||
|
// Reset DAB audio service, to avoid unpleasent noise when changing frequency
|
||||||
|
DABDemod::MsgDABResetService* message = DABDemod::MsgDABResetService::create();
|
||||||
|
m_dabDemod->getInputMessageQueue()->push(message);
|
||||||
|
clearProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DABDemodGUI::on_channel_currentIndexChanged(int index)
|
void DABDemodGUI::on_channel_currentIndexChanged(int index)
|
||||||
|
@ -85,6 +85,7 @@ private:
|
|||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*);
|
||||||
void enterEvent(QEvent*);
|
void enterEvent(QEvent*);
|
||||||
void resetService();
|
void resetService();
|
||||||
|
void clearProgram();
|
||||||
void resizeTable();
|
void resizeTable();
|
||||||
QAction *createCheckableItem(QString& text, int idx, bool checked);
|
QAction *createCheckableItem(QString& text, int idx, bool checked);
|
||||||
|
|
||||||
|
@ -825,6 +825,22 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ScaledImage" name="motImage">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="statistics" native="true">
|
<widget class="QWidget" name="statistics" native="true">
|
||||||
@ -1006,6 +1022,11 @@
|
|||||||
<header>gui/levelmeter.h</header>
|
<header>gui/levelmeter.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ScaledImage</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>gui/scaledimage.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>programs</tabstop>
|
<tabstop>programs</tabstop>
|
||||||
|
@ -274,11 +274,10 @@ void programQualityHandler(int16_t frames, int16_t rs, int16_t aac, void *ctx)
|
|||||||
sink->programQuality(frames, rs, aac);
|
sink->programQuality(frames, rs, aac);
|
||||||
}
|
}
|
||||||
|
|
||||||
void motDataHandler(std::string data, int a, void *ctx)
|
void motDataHandler(std::string filename, int contentsubType, void *ctx)
|
||||||
{
|
{
|
||||||
(void)data;
|
DABDemodSink *sink = (DABDemodSink *)ctx;
|
||||||
(void)a;
|
sink->motData(filename.c_str(), contentsubType);
|
||||||
(void)ctx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DABDemodSink::systemData(bool sync, int16_t snr, int32_t freqOffset)
|
void DABDemodSink::systemData(bool sync, int16_t snr, int32_t freqOffset)
|
||||||
@ -343,6 +342,15 @@ void DABDemodSink::data(const QString& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DABDemodSink::motData(const QString& filename, int contentSubType)
|
||||||
|
{
|
||||||
|
if (getMessageQueueToChannel())
|
||||||
|
{
|
||||||
|
DABDemod::MsgDABMOTData *msg = DABDemod::MsgDABMOTData::create(filename, contentSubType);
|
||||||
|
getMessageQueueToChannel()->push(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int16_t scale(int16_t sample, float factor)
|
static int16_t scale(int16_t sample, float factor)
|
||||||
{
|
{
|
||||||
int32_t prod = (int32_t)(((int32_t)sample) * factor);
|
int32_t prod = (int32_t)(((int32_t)sample) * factor);
|
||||||
|
@ -89,6 +89,7 @@ public:
|
|||||||
void programQuality(int16_t frames, int16_t rs, int16_t aac);
|
void programQuality(int16_t frames, int16_t rs, int16_t aac);
|
||||||
void fibQuality(int16_t percent);
|
void fibQuality(int16_t percent);
|
||||||
void data(const QString& data);
|
void data(const QString& data);
|
||||||
|
void motData(const QString& filename, int contentSubType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct MagSqLevelsStore
|
struct MagSqLevelsStore
|
||||||
|
Loading…
Reference in New Issue
Block a user