1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Add menu to enable/disable all rows.

This commit is contained in:
srcejon 2023-10-22 10:01:29 +01:00
parent bb88296b15
commit ce6b08b15e
3 changed files with 37 additions and 1 deletions

View File

@ -784,7 +784,13 @@ void FreqScannerGUI::updateAnnotation(int row)
const SpectrumAnnotationMarker* closest = nullptr;
for (const auto& marker : markers)
{
if ((marker.m_startFrequency <= frequency) && (frequency < marker.m_startFrequency + marker.m_bandwidth))
qint64 start1 = marker.m_startFrequency;
qint64 stop1 = marker.m_startFrequency + marker.m_bandwidth;
qint64 start2 = frequency - m_settings.m_channelBandwidth / 2;
qint64 stop2 = frequency + m_settings.m_channelBandwidth / 2;
if ( ((start2 >= start1) && (start2 <= stop1))
|| ((stop2 >= start1) && (stop2 <= stop1))
)
{
if (marker.m_bandwidth == (unsigned)m_settings.m_channelBandwidth) {
// Exact match
@ -816,6 +822,13 @@ void FreqScannerGUI::updateAnnotations()
}
}
void FreqScannerGUI::setAllEnabled(bool enable)
{
for (int i = 0; i < ui->table->rowCount(); i++) {
ui->table->item(i, COL_ENABLE)->setCheckState(enable ? Qt::Checked : Qt::Unchecked);
}
}
void FreqScannerGUI::table_customContextMenuRequested(QPoint pos)
{
QTableWidgetItem* item = ui->table->itemAt(pos);
@ -836,6 +849,24 @@ void FreqScannerGUI::table_customContextMenuRequested(QPoint pos)
});
tableContextMenu->addAction(copyAction);
tableContextMenu->addSeparator();
// Enable all
QAction* enableAllAction = new QAction("Enable all", tableContextMenu);
connect(enableAllAction, &QAction::triggered, this, [this]()->void {
setAllEnabled(true);
});
tableContextMenu->addAction(enableAllAction);
// Disable all
QAction* disableAllAction = new QAction("Disable all", tableContextMenu);
connect(disableAllAction, &QAction::triggered, this, [this]()->void {
setAllEnabled(false);
});
tableContextMenu->addAction(disableAllAction);
// Remove selected rows
QAction* removeAction = new QAction("Remove", tableContextMenu);

View File

@ -96,6 +96,7 @@ private:
void updateAnnotation(int row);
void updateAnnotations();
void updateChannelsList(const QList<FreqScannerSettings::AvailableChannel>& channels);
void setAllEnabled(bool enable);
void leaveEvent(QEvent*);
void enterEvent(EnterEventType*);

View File

@ -4,6 +4,8 @@
This plugin can be used to scan a range of frequencies looking for a transmission and then tune another channel (such as an AM or DSD Demod) to that frequency.
[Tutorial Video](https://www.youtube.com/watch?v=IpKP3t4Bmmg)
<h2>Interface</h2>
The top and bottom bars of the channel window are described [here](../../../sdrgui/channel/readme.md)
@ -101,6 +103,8 @@ When an active frequency is found after a scan, the corresponding row in the tab
Right clicking on a cell will display a popup menu:
- Copy contents of cell to clipboard.
- Enable all rows.
- Disable all rows.
- Remove selected rows.
- Tune selected channel (1) to the frequency in the row clicked on.