[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/08: qtgui: added trigger line and contro
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/08: qtgui: added trigger line and controlpanel settings. |
Date: |
Mon, 6 Apr 2015 06:03:45 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 2f8035215160ab0840020d85063302e90fa3351d
Author: Tom Rondeau <address@hidden>
Date: Sat Apr 4 18:37:12 2015 -0400
qtgui: added trigger line and controlpanel settings.
---
.../include/gnuradio/qtgui/FrequencyDisplayPlot.h | 5 ++
gr-qtgui/include/gnuradio/qtgui/freqcontrolpanel.h | 9 +++
gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h | 9 ++-
gr-qtgui/lib/FrequencyDisplayPlot.cc | 23 +++++++
gr-qtgui/lib/freqcontrolpanel.cc | 41 ++++++++++++
gr-qtgui/lib/freqdisplayform.cc | 73 +++++++++++++++++++++-
6 files changed, 158 insertions(+), 2 deletions(-)
diff --git a/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h
b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h
index 3a8f1f3..c947892 100644
--- a/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h
+++ b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h
@@ -121,6 +121,9 @@ public slots:
void clearMaxData();
void clearMinData();
+ void attachTriggerLine(bool en);
+ void setTriggerLine(double value);
+
private:
void _resetXAxisPoints();
void _autoScale(double bottom, double top);
@@ -167,6 +170,8 @@ private:
double d_noise_floor_amplitude;
bool d_autoscale_shot;
+
+ QwtPlotMarker *d_trigger_line;
};
#endif /* FREQUENCY_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/include/gnuradio/qtgui/freqcontrolpanel.h
b/gr-qtgui/include/gnuradio/qtgui/freqcontrolpanel.h
index fe7636f..b2d90cc 100644
--- a/gr-qtgui/include/gnuradio/qtgui/freqcontrolpanel.h
+++ b/gr-qtgui/include/gnuradio/qtgui/freqcontrolpanel.h
@@ -51,6 +51,8 @@ public slots:
void toggleFFTSize(int val);
void toggleFFTWindow(const gr::filter::firdes::win_type win);
+ void toggleTriggerMode(gr::qtgui::trigger_mode mode);
+
signals:
void signalAvgSlider(float val);
void signalAvg(bool en);
@@ -89,6 +91,13 @@ private:
QComboBox *d_fft_win_combo;
int d_slider_max, d_slider_min, d_slider_step;
+
+ QGroupBox *d_trigger_box;
+ QVBoxLayout *d_trigger_layout;
+ QHBoxLayout *d_trigger_level_layout;
+ QLabel *d_trigger_level_label;
+ QComboBox *d_trigger_mode_combo;
+ QPushButton *d_trigger_level_plus, *d_trigger_level_minus;
};
#endif /* FREQ_CONTROL_PANEL_H */
diff --git a/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
index 1f866ba..e7b95cb 100644
--- a/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
@@ -104,15 +104,22 @@ public slots:
void notifyFFTWindow(const QString &s);
void notifyMaxHold(bool en);
void notifyMinHold(bool en);
+ void notifyTriggerMode(const QString &mode);
+ void notifyTriggerLevelPlus();
+ void notifyTriggerLevelMinus();
+
signals:
void signalFFTSize(int size);
void signalFFTWindow(gr::filter::firdes::win_type win);
- void signalReplot();
void signalClearMaxData();
void signalClearMinData();
void signalSetMaxFFTVisible(bool en);
void signalSetMinFFTVisible(bool en);
+ void signalTriggerMode(gr::qtgui::trigger_mode mode);
+ void signalTriggerLevel(float level);
+ void signalReplot();
+
private slots:
void newData(const QEvent *updateEvent);
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc
b/gr-qtgui/lib/FrequencyDisplayPlot.cc
index 2c7f3ef..f70e8a1 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc
@@ -234,6 +234,12 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots,
QWidget* parent)
#endif /* QWT_VERSION < 0x060100 */
+ d_trigger_line = new QwtPlotMarker();
+ d_trigger_line->setLineStyle(QwtPlotMarker::HLine);
+ d_trigger_line->setLinePen(QPen(Qt::red, 0.6, Qt::DashLine));
+ d_trigger_line->setRenderHint(QwtPlotItem::RenderAntialiased);
+ d_trigger_line->setXValue(0.0);
+ d_trigger_line->setYValue(0.0);
replot();
}
@@ -736,4 +742,21 @@ FrequencyDisplayPlot::getMarkerCFColor() const
return d_marker_cf_color;
}
+void
+FrequencyDisplayPlot::attachTriggerLine(bool en)
+{
+ if(en) {
+ d_trigger_line->attach(this);
+ }
+ else {
+ d_trigger_line->detach();
+ }
+}
+
+void
+FrequencyDisplayPlot::setTriggerLine(double level)
+{
+ d_trigger_line->setYValue(level);
+}
+
#endif /* FREQUENCY_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/lib/freqcontrolpanel.cc b/gr-qtgui/lib/freqcontrolpanel.cc
index d33e010..fa3e924 100644
--- a/gr-qtgui/lib/freqcontrolpanel.cc
+++ b/gr-qtgui/lib/freqcontrolpanel.cc
@@ -99,6 +99,25 @@ FreqControlPanel::FreqControlPanel(FreqDisplayForm *form)
d_fft_win_combo->addItem("Kaiser");
d_fft_win_combo->addItem("Flat-top");
+ // Trigger box setup
+ d_trigger_box = new QGroupBox("Trigger");
+ d_trigger_layout = new QVBoxLayout;
+ d_trigger_mode_combo = new QComboBox();
+ d_trigger_mode_combo->addItem("Free");
+ d_trigger_mode_combo->addItem("Auto");
+ d_trigger_mode_combo->addItem("Normal");
+ d_trigger_mode_combo->addItem("Tag");
+
+ d_trigger_level_layout = new QHBoxLayout;
+ d_trigger_level_label = new QLabel("Level:");
+ d_trigger_level_plus = new QPushButton("+");
+ d_trigger_level_minus = new QPushButton("-");
+ d_trigger_level_plus->setMaximumWidth(30);
+ d_trigger_level_minus->setMaximumWidth(30);
+ d_trigger_level_layout->addWidget(d_trigger_level_label);
+ d_trigger_level_layout->addWidget(d_trigger_level_plus);
+ d_trigger_level_layout->addWidget(d_trigger_level_minus);
+
// Set up the boxes into the layout
d_trace_layout->addWidget(d_maxhold_check);
@@ -116,9 +135,14 @@ FreqControlPanel::FreqControlPanel(FreqDisplayForm *form)
d_fft_layout->addWidget(d_fft_win_combo);
d_fft_box->setLayout(d_fft_layout);
+ d_trigger_layout->addWidget(d_trigger_mode_combo);
+ d_trigger_layout->addLayout(d_trigger_level_layout);
+ d_trigger_box->setLayout(d_trigger_layout);
+
addWidget(d_trace_box);
addWidget(d_axes_box);
addWidget(d_fft_box);
+ addWidget(d_trigger_box);
addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum,
QSizePolicy::Expanding));
@@ -152,14 +176,25 @@ FreqControlPanel::FreqControlPanel(FreqDisplayForm *form)
d_parent, SLOT(notifyFFTSize(const QString&)));
connect(d_fft_win_combo, SIGNAL(currentIndexChanged(const QString&)),
d_parent, SLOT(notifyFFTWindow(const QString&)));
+
+ connect(d_trigger_mode_combo, SIGNAL(currentIndexChanged(const QString&)),
+ d_parent, SLOT(notifyTriggerMode(const QString&)));
+ connect(d_trigger_level_plus, SIGNAL(pressed(void)),
+ d_parent, SLOT(notifyTriggerLevelPlus()));
+ connect(d_trigger_level_minus, SIGNAL(pressed(void)),
+ d_parent, SLOT(notifyTriggerLevelMinus()));
}
FreqControlPanel::~FreqControlPanel()
{
removeWidget(d_axes_box);
removeWidget(d_trace_box);
+ removeWidget(d_fft_box);
+ removeWidget(d_trigger_box);
delete d_axes_box;
delete d_trace_box;
+ delete d_fft_box;
+ delete d_trigger_box;
// All other children of the boxes are automatically deleted.
}
@@ -217,3 +252,9 @@ FreqControlPanel::toggleFFTWindow(const
gr::filter::firdes::win_type win)
else if(win == gr::filter::firdes::WIN_FLATTOP)
d_fft_win_combo->setCurrentIndex(7);
}
+
+void
+FreqControlPanel::toggleTriggerMode(gr::qtgui::trigger_mode mode)
+{
+ d_trigger_mode_combo->setCurrentIndex(static_cast<int>(mode));
+}
diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc
index bdd3a0d..457699c 100644
--- a/gr-qtgui/lib/freqdisplayform.cc
+++ b/gr-qtgui/lib/freqdisplayform.cc
@@ -110,6 +110,8 @@ FreqDisplayForm::FreqDisplayForm(int nplots, QWidget*
parent)
setTriggerLevel(0);
connect(d_tr_level_act, SIGNAL(whichTrigger(QString)),
this, SLOT(setTriggerLevel(QString)));
+ connect(this, SIGNAL(signalTriggerLevel(float)),
+ this, SLOT(setTriggerLevel(float)));
setTriggerChannel(0);
connect(d_tr_channel_menu, SIGNAL(whichTrigger(int)),
@@ -182,11 +184,16 @@ FreqDisplayForm::setupControlPanel()
d_controlpanel, SLOT(toggleMaxHold(bool)));
connect(d_minhold_act, SIGNAL(triggered(bool)),
d_controlpanel, SLOT(toggleMinHold(bool)));
+ connect(d_tr_mode_menu, SIGNAL(whichTrigger(gr::qtgui::trigger_mode)),
+ d_controlpanel, SLOT(toggleTriggerMode(gr::qtgui::trigger_mode)));
+ connect(this, SIGNAL(signalTriggerMode(gr::qtgui::trigger_mode)),
+ d_controlpanel, SLOT(toggleTriggerMode(gr::qtgui::trigger_mode)));
d_layout->addLayout(d_controlpanel, 0, 1);
d_controlpanel->toggleGrid(d_grid_act->isChecked());
d_controlpanelmenu->setChecked(true);
+ d_controlpanel->toggleTriggerMode(getTriggerMode());
emit signalFFTSize(getFFTSize());
emit signalFFTWindow(getFFTWindowType());
@@ -401,18 +408,36 @@ FreqDisplayForm::setTriggerMode(gr::qtgui::trigger_mode
mode)
{
d_trig_mode = mode;
d_tr_mode_menu->getAction(mode)->setChecked(true);
+
+ if((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) || (d_trig_mode ==
gr::qtgui::TRIG_MODE_NORM)) {
+ getPlot()->attachTriggerLine(true);
+ }
+ else {
+ getPlot()->attachTriggerLine(false);
+ }
+
+ emit signalReplot();
+ emit signalTriggerMode(mode);
}
void
FreqDisplayForm::updateTrigger(gr::qtgui::trigger_mode mode)
{
// If auto or normal mode, popup trigger level box to set
- if((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) || (d_trig_mode ==
gr::qtgui::TRIG_MODE_NORM))
+ if((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) || (d_trig_mode ==
gr::qtgui::TRIG_MODE_NORM)) {
d_tr_level_act->activate(QAction::Trigger);
+ getPlot()->attachTriggerLine(true);
+ }
+ else {
+ getPlot()->attachTriggerLine(false);
+ }
// if tag mode, popup tag key box to set
if(d_trig_mode == gr::qtgui::TRIG_MODE_TAG)
d_tr_tag_key_act->activate(QAction::Trigger);
+
+ emit signalReplot();
+ emit signalTriggerMode(mode);
}
gr::qtgui::trigger_mode
@@ -425,6 +450,12 @@ void
FreqDisplayForm::setTriggerLevel(QString s)
{
d_trig_level = s.toFloat();
+
+ if((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) || (d_trig_mode ==
gr::qtgui::TRIG_MODE_NORM)) {
+ getPlot()->setTriggerLine(d_trig_level);
+ }
+
+ emit signalReplot();
}
void
@@ -432,6 +463,12 @@ FreqDisplayForm::setTriggerLevel(float level)
{
d_trig_level = level;
d_tr_level_act->setText(QString().setNum(d_trig_level));
+
+ if((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) || (d_trig_mode ==
gr::qtgui::TRIG_MODE_NORM)) {
+ getPlot()->setTriggerLine(d_trig_level);
+ }
+
+ emit signalReplot();
}
float
@@ -445,6 +482,7 @@ FreqDisplayForm::setTriggerChannel(int channel)
{
d_trig_channel = channel;
d_tr_channel_menu->getAction(d_trig_channel)->setChecked(true);
+ emit signalReplot();
}
int
@@ -464,6 +502,7 @@ FreqDisplayForm::setTriggerTagKey(const std::string &key)
{
d_trig_tag_key = key;
d_tr_tag_key_act->setText(QString().fromStdString(d_trig_tag_key));
+ emit signalReplot();
}
std::string
@@ -606,3 +645,35 @@ FreqDisplayForm::notifyMinHold(bool en)
emit signalClearMinData();
emit signalSetMinFFTVisible(en);
}
+
+
+void
+FreqDisplayForm::notifyTriggerMode(const QString &mode)
+{
+ if(mode == "Free") {
+ setTriggerMode(gr::qtgui::TRIG_MODE_FREE);
+ }
+ else if(mode == "Auto") {
+ setTriggerMode(gr::qtgui::TRIG_MODE_AUTO);
+ }
+ else if(mode == "Normal") {
+ setTriggerMode(gr::qtgui::TRIG_MODE_NORM);
+ }
+ else if(mode == "Tag") {
+ setTriggerMode(gr::qtgui::TRIG_MODE_TAG);
+ updateTrigger(gr::qtgui::TRIG_MODE_TAG);
+ }
+}
+
+
+void
+FreqDisplayForm::notifyTriggerLevelPlus()
+{
+ emit signalTriggerLevel(getTriggerLevel() + 1);
+}
+
+void
+FreqDisplayForm::notifyTriggerLevelMinus()
+{
+ emit signalTriggerLevel(getTriggerLevel() - 1);
+}
- [Commit-gnuradio] [gnuradio] branch master updated (cce2347 -> 93c25bc), git, 2015/04/06
- [Commit-gnuradio] [gnuradio] 04/08: qtgui: fixed an issue setting up control panel at runtime., git, 2015/04/06
- [Commit-gnuradio] [gnuradio] 06/08: qtgui: fixed stray variable; also problem between qwt 6.0 and 6.1., git, 2015/04/06
- [Commit-gnuradio] [gnuradio] 07/08: qtgui: added stop button to freq control panel., git, 2015/04/06
- [Commit-gnuradio] [gnuradio] 02/08: qtgui: toggle legend off in GRC properties., git, 2015/04/06
- [Commit-gnuradio] [gnuradio] 05/08: qtgui: enable/disable waterfall legend., git, 2015/04/06
- [Commit-gnuradio] [gnuradio] 03/08: qtgui: added trigger line and controlpanel settings.,
git <=
- [Commit-gnuradio] [gnuradio] 08/08: Merge remote-tracking branch 'tom/qtgui/freq_control_panel', git, 2015/04/06
- [Commit-gnuradio] [gnuradio] 01/08: qtgui: adds control panel to frequency sinks., git, 2015/04/06