Skip to content

Commit

Permalink
multi_vfo: add bookmarks actions
Browse files Browse the repository at this point in the history
1. To tune current demod to a frequency
2. To tune current demod to a frequency and load params from the
bookmark
3. To create a new demod with the bookmark params
  • Loading branch information
vladisslav2011 committed Nov 5, 2022
1 parent ff69939 commit f8c7856
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/applications/gqrx/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent)

// Bookmarks
connect(uiDockBookmarks, SIGNAL(newBookmarkActivated(qint64, QString, int)), this, SLOT(onBookmarkActivated(qint64, QString, int)));
//FIXME: create a new slot that would avoid changing hw frequency if the bookmark is in the current bandwidth
connect(uiDockBookmarks, SIGNAL(newBookmarkActivated(qint64)), this, SLOT(setNewFrequency(qint64)));
connect(uiDockBookmarks, SIGNAL(newBookmarkActivatedAddDemod(qint64, QString, int)), this, SLOT(onBookmarkActivatedAddDemod(qint64, QString, int)));
connect(uiDockBookmarks->actionAddBookmark, SIGNAL(triggered()), this, SLOT(on_actionAddBookmark_triggered()));

//DXC Spots
Expand Down Expand Up @@ -2793,6 +2796,12 @@ void MainWindow::onBookmarkActivated(qint64 freq, const QString& demod, int band
on_plotter_newFilterFreq(lo, hi);
}

void MainWindow::onBookmarkActivatedAddDemod(qint64 freq, const QString& demod, int bandwidth)
{
on_actionAddDemodulator_triggered();
onBookmarkActivated(freq, demod, bandwidth);
}

void MainWindow::setPassband(int bandwidth)
{
/* Check if filter is symmetric or not by checking the presets */
Expand Down
1 change: 1 addition & 0 deletions src/applications/gqrx/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ private slots:

/* Bookmarks */
void onBookmarkActivated(qint64 freq, const QString& demod, int bandwidth);
void onBookmarkActivatedAddDemod(qint64 freq, const QString& demod, int bandwidth);

/* DXC Spots */
void updateClusterSpots();
Expand Down
48 changes: 48 additions & 0 deletions src/qtgui/dockbookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ DockBookmarks::DockBookmarks(QWidget *parent) :
contextmenu->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(DeleteSelectedBookmark()));
}
// MenuItem Tune
{
QAction* action = new QAction("Tune", this);
contextmenu->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(tuneHere()));
}
// MenuItem Tune and load
{
QAction* action = new QAction("Tune and load settings", this);
contextmenu->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(tuneAndLoad()));
}
// MenuItem New demodulator
{
QAction* action = new QAction("New demodulator", this);
contextmenu->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(newDemod()));
}
// MenuItem Add
{
actionAddBookmark = new QAction("Add Bookmark", this);
Expand Down Expand Up @@ -187,6 +205,36 @@ bool DockBookmarks::DeleteSelectedBookmark()
return true;
}

bool DockBookmarks::tuneHere()
{
QModelIndexList selected = ui->tableViewFrequencyList->selectionModel()->selectedRows();
if (selected.empty())
return true;
BookmarkInfo *info = bookmarksTableModel->getBookmarkAtRow(selected.first().row());
emit newBookmarkActivated(info->frequency);
return true;
}

bool DockBookmarks::tuneAndLoad()
{
QModelIndexList selected = ui->tableViewFrequencyList->selectionModel()->selectedRows();
if (selected.empty())
return true;
BookmarkInfo *info = bookmarksTableModel->getBookmarkAtRow(selected.first().row());
emit newBookmarkActivated(info->frequency, info->modulation, info->bandwidth);
return true;
}

bool DockBookmarks::newDemod()
{
QModelIndexList selected = ui->tableViewFrequencyList->selectionModel()->selectedRows();
if (selected.empty())
return true;
BookmarkInfo *info = bookmarksTableModel->getBookmarkAtRow(selected.first().row());
emit newBookmarkActivatedAddDemod(info->frequency, info->modulation, info->bandwidth);
return true;
}

void DockBookmarks::ShowContextMenu(const QPoint& pos)
{
contextmenu->popup(ui->tableViewFrequencyList->viewport()->mapToGlobal(pos));
Expand Down
5 changes: 5 additions & 0 deletions src/qtgui/dockbookmarks.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class DockBookmarks : public QDockWidget

signals:
void newBookmarkActivated(qint64, QString, int);
void newBookmarkActivated(qint64);
void newBookmarkActivatedAddDemod(qint64, QString, int);

public slots:
void setNewFrequency(qint64 rx_freq);
Expand All @@ -83,5 +85,8 @@ private slots:
void on_tableWidgetTagList_itemChanged(QTableWidgetItem* item);
void ShowContextMenu(const QPoint&pos);
bool DeleteSelectedBookmark();
bool tuneHere();
bool tuneAndLoad();
bool newDemod();
void doubleClicked(const QModelIndex & index);
};

0 comments on commit f8c7856

Please sign in to comment.