1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

FT8 demod: filter messages

This commit is contained in:
f4exb 2023-01-23 07:20:41 +01:00
parent 9fb41b2e81
commit a6a43633e8
5 changed files with 87 additions and 1 deletions

View File

@ -219,6 +219,15 @@ void FT8DemodGUI::on_moveToBottom_clicked()
ui->messages->scrollToBottom(); ui->messages->scrollToBottom();
} }
void FT8DemodGUI::on_filterMessages_toggled(bool checked)
{
m_filterMessages = checked;
for (int row = 0; row < ui->messages->rowCount(); row++) {
filterMessageRow(row);
}
}
void FT8DemodGUI::on_applyBandPreset_clicked() void FT8DemodGUI::on_applyBandPreset_clicked()
{ {
int bandPresetIndex = ui->bandPreset->currentIndex(); int bandPresetIndex = ui->bandPreset->currentIndex();
@ -358,7 +367,8 @@ FT8DemodGUI::FT8DemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
m_audioFlipChannels(false), m_audioFlipChannels(false),
m_audioMute(false), m_audioMute(false),
m_squelchOpen(false), m_squelchOpen(false),
m_audioSampleRate(-1) m_audioSampleRate(-1),
m_filterMessages(false)
{ {
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
m_helpURL = "plugins/channelrx/demodssb/readme.md"; m_helpURL = "plugins/channelrx/demodssb/readme.md";
@ -422,6 +432,8 @@ FT8DemodGUI::FT8DemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
// Resize the table using dummy data // Resize the table using dummy data
resizeMessageTable(); resizeMessageTable();
populateBandPresets(); populateBandPresets();
connect(ui->messages, &QTableWidget::cellClicked, this, &FT8DemodGUI::messageCellClicked);
} }
FT8DemodGUI::~FT8DemodGUI() FT8DemodGUI::~FT8DemodGUI()
@ -640,6 +652,7 @@ void FT8DemodGUI::makeUIConnections()
QObject::connect(ui->fftWindow, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FT8DemodGUI::on_fftWindow_currentIndexChanged); QObject::connect(ui->fftWindow, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FT8DemodGUI::on_fftWindow_currentIndexChanged);
QObject::connect(ui->filterIndex, &QDial::valueChanged, this, &FT8DemodGUI::on_filterIndex_valueChanged); QObject::connect(ui->filterIndex, &QDial::valueChanged, this, &FT8DemodGUI::on_filterIndex_valueChanged);
QObject::connect(ui->moveToBottom, &QPushButton::clicked, this, &FT8DemodGUI::on_moveToBottom_clicked); QObject::connect(ui->moveToBottom, &QPushButton::clicked, this, &FT8DemodGUI::on_moveToBottom_clicked);
QObject::connect(ui->filterMessages, &ButtonSwitch::toggled, this, &FT8DemodGUI::on_filterMessages_toggled);
QObject::connect(ui->applyBandPreset, &QPushButton::clicked, this, &FT8DemodGUI::on_applyBandPreset_clicked); QObject::connect(ui->applyBandPreset, &QPushButton::clicked, this, &FT8DemodGUI::on_applyBandPreset_clicked);
QObject::connect(ui->clearMessages, &QPushButton::clicked, this, &FT8DemodGUI::on_clearMessages_clicked); QObject::connect(ui->clearMessages, &QPushButton::clicked, this, &FT8DemodGUI::on_clearMessages_clicked);
QObject::connect(ui->recordWav, &ButtonSwitch::toggled, this, &FT8DemodGUI::on_recordWav_toggled); QObject::connect(ui->recordWav, &ButtonSwitch::toggled, this, &FT8DemodGUI::on_recordWav_toggled);
@ -720,6 +733,8 @@ void FT8DemodGUI::messagesReceived(const QList<FT8Message>& messages)
locItem->setText(message.loc); locItem->setText(message.loc);
infoItem->setText(message.decoderInfo); infoItem->setText(message.decoderInfo);
filterMessageRow(row);
row++; row++;
} }
@ -741,3 +756,46 @@ void FT8DemodGUI::populateBandPresets()
ui->bandPreset->blockSignals(false); ui->bandPreset->blockSignals(false);
} }
void FT8DemodGUI::messageCellClicked(int row, int col)
{
m_selectedColumn = col;
m_selectedValue = ui->messages->item(row, col)->text();
qDebug("FT8DemodGUI::messageCellChanged: %d %s", m_selectedColumn, qPrintable(m_selectedValue));
}
void FT8DemodGUI::filterMessageRow(int row)
{
if (!m_filterMessages)
{
ui->messages->setRowHidden(row, false);
return;
}
if ((m_selectedColumn == MESSAGE_COL_CALL1) || (m_selectedColumn == MESSAGE_COL_CALL2))
{
const QString& call1 = ui->messages->item(row, MESSAGE_COL_CALL1)->text();
const QString& call2 = ui->messages->item(row, MESSAGE_COL_CALL2)->text();
bool visible = ((call1 == m_selectedValue) || (call2 == m_selectedValue));
ui->messages->setRowHidden(row, !visible);
return;
}
if (m_selectedColumn == MESSAGE_COL_LOC)
{
const QString& loc = ui->messages->item(row, MESSAGE_COL_LOC)->text();
bool visible = (loc == m_selectedValue);
ui->messages->setRowHidden(row, !visible);
return;
}
if (m_selectedColumn == MESSAGE_COL_UTC)
{
const QString& utc = ui->messages->item(row, MESSAGE_COL_UTC)->text();
bool visible = (utc == m_selectedValue);
ui->messages->setRowHidden(row, !visible);
return;
}
ui->messages->setRowHidden(row, false);
}

View File

@ -81,6 +81,9 @@ private:
bool m_squelchOpen; bool m_squelchOpen;
int m_audioSampleRate; int m_audioSampleRate;
uint32_t m_tickCount; uint32_t m_tickCount;
bool m_filterMessages;
int m_selectedColumn;
QString m_selectedValue;
FT8Demod* m_ft8Demod; FT8Demod* m_ft8Demod;
SpectrumVis* m_spectrumVis; SpectrumVis* m_spectrumVis;
@ -104,6 +107,7 @@ private:
void resizeMessageTable(); void resizeMessageTable();
void messagesReceived(const QList<FT8Message>& messages); void messagesReceived(const QList<FT8Message>& messages);
void populateBandPresets(); void populateBandPresets();
void filterMessageRow(int row);
enum MessageCol { enum MessageCol {
MESSAGE_COL_UTC, MESSAGE_COL_UTC,
@ -128,6 +132,7 @@ private slots:
void on_fftWindow_currentIndexChanged(int index); void on_fftWindow_currentIndexChanged(int index);
void on_filterIndex_valueChanged(int value); void on_filterIndex_valueChanged(int value);
void on_moveToBottom_clicked(); void on_moveToBottom_clicked();
void on_filterMessages_toggled(bool checked);
void on_applyBandPreset_clicked(); void on_applyBandPreset_clicked();
void on_clearMessages_clicked(); void on_clearMessages_clicked();
void on_recordWav_toggled(bool checked); void on_recordWav_toggled(bool checked);
@ -137,6 +142,7 @@ private slots:
void onMenuDialogCalled(const QPoint& p); void onMenuDialogCalled(const QPoint& p);
void handleInputMessages(); void handleInputMessages();
void tick(); void tick();
void messageCellClicked(int row, int col);
}; };
#endif // INCLUDE_SSBDEMODGUI_H #endif // INCLUDE_SSBDEMODGUI_H

View File

@ -878,6 +878,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="ButtonSwitch" name="filterMessages">
<property name="toolTip">
<string>Filter messages</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/funnel.png</normaloff>:/funnel.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="bandPresetLabel"> <widget class="QLabel" name="bandPresetLabel">
<property name="text"> <property name="text">
@ -893,6 +910,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Band frequency presets</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>

View File

@ -144,6 +144,7 @@ void FT8DemodSettingsDialog::on_addBand_clicked()
ui->bands->blockSignals(true); ui->bands->blockSignals(true);
ui->bands->setRowCount(0); ui->bands->setRowCount(0);
populateBandsTable(); populateBandsTable();
ui->bands->scrollToBottom();
ui->bands->blockSignals(false); ui->bands->blockSignals(false);
if (!m_settingsKeys.contains("bandPresets")) { if (!m_settingsKeys.contains("bandPresets")) {

View File

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>funnel.png</file>
<file>arrow_2head_h.png</file> <file>arrow_2head_h.png</file>
<file>truncate.png</file> <file>truncate.png</file>
<file>caliper.png</file> <file>caliper.png</file>