From ff69939426af331e53925e4c4a6b1302a45719ff Mon Sep 17 00:00:00 2001 From: Vladisslav P Date: Fri, 11 Feb 2022 01:23:22 +0300 Subject: [PATCH] multi_vfo: make it possible to load setting... ...from a bookmark/create demodulator by right-clicking/middle-clicking a tag marker on the plotter --- src/applications/gqrx/mainwindow.cpp | 29 ++++++++++++++++++++++++++++ src/applications/gqrx/mainwindow.h | 4 +++- src/qtgui/plotter.cpp | 24 ++++++++++++++++++++--- src/qtgui/plotter.h | 2 ++ 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/applications/gqrx/mainwindow.cpp b/src/applications/gqrx/mainwindow.cpp index b402ab576..0c16f90e6 100644 --- a/src/applications/gqrx/mainwindow.cpp +++ b/src/applications/gqrx/mainwindow.cpp @@ -2575,6 +2575,35 @@ void MainWindow::on_plotter_newDemodFreq(qint64 freq, qint64 delta) } +/* CPlotter::NewDemodFreqLoad() is emitted */ +/* tune and load demodulator settings */ +void MainWindow::on_plotter_newDemodFreqLoad(qint64 freq, qint64 delta) +{ + // set RX filter + if (delta != qint64(rx->get_filter_offset())) + { + rx->set_filter_offset((double) delta); + updateFrequencyRange(); + } + + QList tags = + Bookmarks::Get().getBookmarksInRange(freq, freq); + if(tags.size() > 0) + { + BookmarkInfo & first = tags.first(); + onBookmarkActivated(freq, first.modulation, first.bandwidth); + }else + setNewFrequency(freq); +} + +/* CPlotter::NewDemodFreqLoad() is emitted */ +/* new demodulator here */ +void MainWindow::on_plotter_newDemodFreqAdd(qint64 freq, qint64 delta) +{ + on_actionAddDemodulator_triggered(); + on_plotter_newDemodFreqLoad(freq, delta); +} + /* CPlotter::NewfilterFreq() is emitted or bookmark activated */ void MainWindow::on_plotter_newFilterFreq(int low, int high) { /* parameter correctness will be checked in receiver class */ diff --git a/src/applications/gqrx/mainwindow.h b/src/applications/gqrx/mainwindow.h index da0c4195e..c9e8e3903 100644 --- a/src/applications/gqrx/mainwindow.h +++ b/src/applications/gqrx/mainwindow.h @@ -225,7 +225,9 @@ private slots: void setWfSize(); /* FFT plot */ - void on_plotter_newDemodFreq(qint64 freq, qint64 delta); /*! New demod freq (aka. filter offset). */ + void on_plotter_newDemodFreq(qint64 freq, qint64 delta); /*! New demod freq (aka. filter offset). */ + void on_plotter_newDemodFreqLoad(qint64 freq, qint64 delta);/* tune and load demodulator settings */ + void on_plotter_newDemodFreqAdd(qint64 freq, qint64 delta); /* new demodulator here */ void on_plotter_newFilterFreq(int low, int high); /*! New filter width */ void on_plotter_selectVfo(int i); diff --git a/src/qtgui/plotter.cpp b/src/qtgui/plotter.cpp index 4327e22cc..60a7a99d5 100644 --- a/src/qtgui/plotter.cpp +++ b/src/qtgui/plotter.cpp @@ -752,9 +752,27 @@ void CPlotter::mousePressEvent(QMouseEvent * event) { if (tag.first.contains(event->pos())) { - m_DemodCenterFreq = tag.second; - emit newDemodFreq(m_DemodCenterFreq, m_DemodCenterFreq - m_CenterFreq); - break; + if (event->buttons() == Qt::LeftButton) + { + //just tune + m_DemodCenterFreq = tag.second; + emit newDemodFreq(m_DemodCenterFreq, m_DemodCenterFreq - m_CenterFreq); + break; + } + else if (event->buttons() == Qt::MidButton) + { + //tune and load settings + m_DemodCenterFreq = tag.second; + emit newDemodFreqAdd(m_DemodCenterFreq, m_DemodCenterFreq - m_CenterFreq); + break; + } + else if (event->buttons() == Qt::RightButton) + { + //new demod here + m_DemodCenterFreq = tag.second; + emit newDemodFreqLoad(m_DemodCenterFreq, m_DemodCenterFreq - m_CenterFreq); + break; + } } } } diff --git a/src/qtgui/plotter.h b/src/qtgui/plotter.h index a6f380e06..5d42e5627 100644 --- a/src/qtgui/plotter.h +++ b/src/qtgui/plotter.h @@ -132,6 +132,8 @@ class CPlotter : public QFrame signals: void newDemodFreq(qint64 freq, qint64 delta); /* delta is the offset from the center */ + void newDemodFreqLoad(qint64 freq, qint64 delta);/* tune and load demodulator settings */ + void newDemodFreqAdd(qint64 freq, qint64 delta);/* new demodulator here */ void newLowCutFreq(int f); void newHighCutFreq(int f); void newFilterFreq(int low, int high); /* substitute for NewLow / NewHigh */