Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow activate bookmark by doubleclik in plotter #1174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/applications/gqrx/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent)

// Bookmarks
connect(uiDockBookmarks, SIGNAL(newBookmarkActivated(qint64, QString, int)), this, SLOT(onBookmarkActivated(qint64, QString, int)));
connect(ui->plotter, SIGNAL(newBookmarkActivated(qint64, QString, int)), this, SLOT(onBookmarkActivated(qint64, QString, int)));
connect(uiDockBookmarks->actionAddBookmark, SIGNAL(triggered()), this, SLOT(on_actionAddBookmark_triggered()));

//DXC Spots
Expand Down
22 changes: 20 additions & 2 deletions src/qtgui/plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,23 @@ QSize CPlotter::sizeHint() const
return {180, 180};
}

void CPlotter::mouseDoubleClickEvent(QMouseEvent* event)
{
if (m_CursorCaptured == TAG)
{
for (auto & tag : m_Taglist)
{
if (tag.first.contains(event->pos()))
{
const BookmarkInfo &b = tag.second;

emit newBookmarkActivated(b.frequency, b.modulation, b.bandwidth);
break;
}
}
}
}

void CPlotter::mouseMoveEvent(QMouseEvent* event)
{

Expand Down Expand Up @@ -675,7 +692,8 @@ void CPlotter::mousePressEvent(QMouseEvent * event)
{
if (tag.first.contains(event->pos()))
{
m_DemodCenterFreq = tag.second;
m_DemodCenterFreq = tag.second.frequency;

emit newDemodFreq(m_DemodCenterFreq, m_DemodCenterFreq - m_CenterFreq);
break;
}
Expand Down Expand Up @@ -1346,7 +1364,7 @@ void CPlotter::drawOverlay()
const auto levelNHeightBottom = levelNHeight + fontHeight;
const auto levelNHeightBottomSlant = levelNHeightBottom + slant;

m_Taglist.append(qMakePair(QRect(x, levelNHeight, nameWidth + slant, fontHeight), tag.frequency));
m_Taglist.append(qMakePair(QRect(x, levelNHeight, nameWidth + slant, fontHeight), tag));

QColor color = QColor(tag.GetColor());
color.setAlpha(0x60);
Expand Down
6 changes: 5 additions & 1 deletion src/qtgui/plotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <vector>
#include <QMap>

#include "bookmarks.h"

#define HORZ_DIVS_MAX 12 //50
#define VERT_DIVS_MIN 5
#define MAX_SCREENSIZE 16384
Expand Down Expand Up @@ -131,6 +133,7 @@ class CPlotter : public QFrame
void pandapterRangeChanged(float min, float max);
void newZoomLevel(float level);
void newSize();
void newBookmarkActivated(qint64 frequency, const QString &modulation, int bandwidth);

public slots:
// zoom functions
Expand Down Expand Up @@ -162,6 +165,7 @@ public slots:
//re-implemented widget event handlers
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent* event) override;
void mouseDoubleClickEvent(QMouseEvent * event) override;
void mouseMoveEvent(QMouseEvent * event) override;
void mousePressEvent(QMouseEvent * event) override;
void mouseReleaseEvent(QMouseEvent * event) override;
Expand Down Expand Up @@ -278,7 +282,7 @@ public slots:
float m_PeakDetection{};
QMap<int,int> m_Peaks;

QList< QPair<QRect, qint64> > m_Taglist;
QList< QPair<QRect, BookmarkInfo> > m_Taglist;

// Waterfall averaging
quint64 tlast_wf_ms; // last time waterfall has been updated
Expand Down