FT8 demod: filter messages

pull/1569/head
f4exb 2023-01-23 07:20:41 +01:00
rodzic 9fb41b2e81
commit a6a43633e8
5 zmienionych plików z 87 dodań i 1 usunięć

Wyświetl plik

@ -219,6 +219,15 @@ void FT8DemodGUI::on_moveToBottom_clicked()
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()
{
int bandPresetIndex = ui->bandPreset->currentIndex();
@ -358,7 +367,8 @@ FT8DemodGUI::FT8DemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
m_audioFlipChannels(false),
m_audioMute(false),
m_squelchOpen(false),
m_audioSampleRate(-1)
m_audioSampleRate(-1),
m_filterMessages(false)
{
setAttribute(Qt::WA_DeleteOnClose, true);
m_helpURL = "plugins/channelrx/demodssb/readme.md";
@ -422,6 +432,8 @@ FT8DemodGUI::FT8DemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
// Resize the table using dummy data
resizeMessageTable();
populateBandPresets();
connect(ui->messages, &QTableWidget::cellClicked, this, &FT8DemodGUI::messageCellClicked);
}
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->filterIndex, &QDial::valueChanged, this, &FT8DemodGUI::on_filterIndex_valueChanged);
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->clearMessages, &QPushButton::clicked, this, &FT8DemodGUI::on_clearMessages_clicked);
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);
infoItem->setText(message.decoderInfo);
filterMessageRow(row);
row++;
}
@ -741,3 +756,46 @@ void FT8DemodGUI::populateBandPresets()
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);
}

Wyświetl plik

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

Wyświetl plik

@ -878,6 +878,23 @@
</property>
</widget>
</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>
<widget class="QLabel" name="bandPresetLabel">
<property name="text">
@ -893,6 +910,9 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Band frequency presets</string>
</property>
</widget>
</item>
<item>

Wyświetl plik

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

Wyświetl plik

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