1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012,2014 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #include <gnuradio/qtgui/freqdisplayform.h>
24 
25 #include <gnuradio/qtgui/freqcontrolpanel.h>
26 #include <QMessageBox>
27 #include <QSpacerItem>
28 #include <cmath>
29 #include <iostream>
30 
FreqDisplayForm(int nplots,QWidget * parent)31 FreqDisplayForm::FreqDisplayForm(int nplots, QWidget* parent)
32     : DisplayForm(nplots, parent)
33 {
34     d_int_validator = new QIntValidator(this);
35     d_int_validator->setBottom(0);
36 
37     d_layout = new QGridLayout(this);
38     d_display_plot = new FrequencyDisplayPlot(nplots, this);
39     d_layout->addWidget(d_display_plot, 0, 0);
40 
41     d_layout->setColumnStretch(0, 1);
42     setLayout(d_layout);
43 
44     d_controlpanel = NULL;
45 
46     d_num_real_data_points = 1024;
47     d_fftsize = 1024;
48     d_fftavg = 1.0;
49     d_clicked = false;
50     d_clicked_freq = 0;
51 
52     d_trig_mode = gr::qtgui::TRIG_MODE_FREE;
53     d_trig_level = 0;
54     d_trig_channel = 0;
55     d_trig_tag_key = "";
56 
57     d_sizemenu = new FFTSizeMenu(this);
58     d_avgmenu = new FFTAverageMenu(this);
59     d_winmenu = new FFTWindowMenu(this);
60     d_menu->addMenu(d_sizemenu);
61     d_menu->addMenu(d_avgmenu);
62     d_menu->addMenu(d_winmenu);
63     connect(d_sizemenu, SIGNAL(whichTrigger(int)), this, SLOT(setFFTSize(const int)));
64     connect(
65         d_avgmenu, SIGNAL(whichTrigger(float)), this, SLOT(setFFTAverage(const float)));
66     connect(d_winmenu,
67             SIGNAL(whichTrigger(gr::filter::firdes::win_type)),
68             this,
69             SLOT(setFFTWindowType(const gr::filter::firdes::win_type)));
70 
71     PopupMenu* maxymenu = new PopupMenu("Y Max", this);
72     d_menu->addAction(maxymenu);
73     connect(maxymenu, SIGNAL(whichTrigger(QString)), this, SLOT(setYMax(QString)));
74 
75     PopupMenu* minymenu = new PopupMenu("Y Min", this);
76     d_menu->addAction(minymenu);
77     connect(minymenu, SIGNAL(whichTrigger(QString)), this, SLOT(setYMin(QString)));
78 
79     d_maxhold_act = new QAction("Max Hold", this);
80     d_maxhold_act->setCheckable(true);
81     d_menu->addAction(d_maxhold_act);
82     connect(d_maxhold_act, SIGNAL(triggered(bool)), this, SLOT(notifyMaxHold(bool)));
83     d_minhold_act = new QAction("Min Hold", this);
84     d_minhold_act->setCheckable(true);
85     d_menu->addAction(d_minhold_act);
86     connect(d_minhold_act, SIGNAL(triggered(bool)), this, SLOT(notifyMinHold(bool)));
87 
88     // Set up the trigger menu
89     d_triggermenu = new QMenu("Trigger", this);
90     d_tr_mode_menu = new TriggerModeMenu(this);
91     d_tr_level_act = new PopupMenu("Level", this);
92     d_tr_channel_menu = new TriggerChannelMenu(nplots, this);
93     d_tr_tag_key_act = new PopupMenu("Tag Key", this);
94     d_triggermenu->addMenu(d_tr_mode_menu);
95     d_triggermenu->addAction(d_tr_level_act);
96     d_triggermenu->addMenu(d_tr_channel_menu);
97     d_triggermenu->addAction(d_tr_tag_key_act);
98     d_menu->addMenu(d_triggermenu);
99 
100     d_controlpanelmenu = new QAction("Control Panel", this);
101     d_controlpanelmenu->setCheckable(true);
102     d_menu->addAction(d_controlpanelmenu);
103     connect(
104         d_controlpanelmenu, SIGNAL(triggered(bool)), this, SLOT(setupControlPanel(bool)));
105 
106     setTriggerMode(gr::qtgui::TRIG_MODE_FREE);
107     connect(d_tr_mode_menu,
108             SIGNAL(whichTrigger(gr::qtgui::trigger_mode)),
109             this,
110             SLOT(setTriggerMode(gr::qtgui::trigger_mode)));
111     // updates trigger state by calling set level or set tag key.
112     connect(d_tr_mode_menu,
113             SIGNAL(whichTrigger(gr::qtgui::trigger_mode)),
114             this,
115             SLOT(updateTrigger(gr::qtgui::trigger_mode)));
116 
117     setTriggerLevel(0);
118     connect(d_tr_level_act,
119             SIGNAL(whichTrigger(QString)),
120             this,
121             SLOT(setTriggerLevel(QString)));
122     connect(this, SIGNAL(signalTriggerLevel(float)), this, SLOT(setTriggerLevel(float)));
123 
124     setTriggerChannel(0);
125     connect(
126         d_tr_channel_menu, SIGNAL(whichTrigger(int)), this, SLOT(setTriggerChannel(int)));
127 
128     setTriggerTagKey(std::string(""));
129     connect(d_tr_tag_key_act,
130             SIGNAL(whichTrigger(QString)),
131             this,
132             SLOT(setTriggerTagKey(QString)));
133 
134     connect(this, SIGNAL(signalClearMaxData()), getPlot(), SLOT(clearMaxData()));
135     connect(this, SIGNAL(signalClearMinData()), getPlot(), SLOT(clearMinData()));
136     connect(this,
137             SIGNAL(signalSetMaxFFTVisible(bool)),
138             getPlot(),
139             SLOT(setMaxFFTVisible(bool)));
140     connect(this,
141             SIGNAL(signalSetMinFFTVisible(bool)),
142             getPlot(),
143             SLOT(setMinFFTVisible(bool)));
144 
145     Reset();
146 
147     connect(d_display_plot,
148             SIGNAL(plotPointSelected(const QPointF)),
149             this,
150             SLOT(onPlotPointSelected(const QPointF)));
151 
152     connect(this, SIGNAL(signalReplot()), getPlot(), SLOT(replot()));
153 }
154 
~FreqDisplayForm()155 FreqDisplayForm::~FreqDisplayForm()
156 {
157     // Qt deletes children when parent is deleted
158 
159     // Don't worry about deleting Display Plots - they are deleted when parents are
160     // deleted
161     delete d_int_validator;
162 
163     teardownControlPanel();
164 }
165 
setupControlPanel(bool en)166 void FreqDisplayForm::setupControlPanel(bool en)
167 {
168     if (en) {
169         setupControlPanel();
170     } else {
171         teardownControlPanel();
172     }
173 }
174 
setupControlPanel()175 void FreqDisplayForm::setupControlPanel()
176 {
177     if (d_controlpanel)
178         delete d_controlpanel;
179 
180     // Create the control panel layout
181     d_controlpanel = new FreqControlPanel(this);
182 
183     // Connect action items in menu to controlpanel widgets
184     connect(d_grid_act, SIGNAL(triggered(bool)), d_controlpanel, SLOT(toggleGrid(bool)));
185     connect(d_axislabelsmenu,
186             SIGNAL(triggered(bool)),
187             d_controlpanel,
188             SLOT(toggleAxisLabels(bool)));
189     connect(
190         d_sizemenu, SIGNAL(whichTrigger(int)), d_controlpanel, SLOT(toggleFFTSize(int)));
191     connect(d_winmenu,
192             SIGNAL(whichTrigger(gr::filter::firdes::win_type)),
193             d_controlpanel,
194             SLOT(toggleFFTWindow(gr::filter::firdes::win_type)));
195     connect(this, SIGNAL(signalFFTSize(int)), d_controlpanel, SLOT(toggleFFTSize(int)));
196     connect(this,
197             SIGNAL(signalFFTWindow(gr::filter::firdes::win_type)),
198             d_controlpanel,
199             SLOT(toggleFFTWindow(gr::filter::firdes::win_type)));
200     connect(d_maxhold_act,
201             SIGNAL(triggered(bool)),
202             d_controlpanel,
203             SLOT(toggleMaxHold(bool)));
204     connect(d_minhold_act,
205             SIGNAL(triggered(bool)),
206             d_controlpanel,
207             SLOT(toggleMinHold(bool)));
208     connect(d_avgmenu,
209             SIGNAL(whichTrigger(float)),
210             d_controlpanel,
211             SLOT(setFFTAverage(float)));
212     connect(d_tr_mode_menu,
213             SIGNAL(whichTrigger(gr::qtgui::trigger_mode)),
214             d_controlpanel,
215             SLOT(toggleTriggerMode(gr::qtgui::trigger_mode)));
216     connect(this,
217             SIGNAL(signalTriggerMode(gr::qtgui::trigger_mode)),
218             d_controlpanel,
219             SLOT(toggleTriggerMode(gr::qtgui::trigger_mode)));
220     connect(d_stop_act, SIGNAL(triggered()), d_controlpanel, SLOT(toggleStopButton()));
221 
222     d_layout->addLayout(d_controlpanel, 0, 1);
223 
224     d_controlpanel->toggleGrid(d_grid_act->isChecked());
225     d_controlpanel->toggleAxisLabels(d_axislabelsmenu->isChecked());
226     d_controlpanelmenu->setChecked(true);
227     d_controlpanel->toggleTriggerMode(getTriggerMode());
228     d_controlpanel->toggleMaxHold(d_maxhold_act->isChecked());
229     d_controlpanel->toggleMinHold(d_minhold_act->isChecked());
230     d_controlpanel->setFFTAverage(getFFTAverage());
231 
232     emit signalFFTSize(getFFTSize());
233     emit signalFFTWindow(getFFTWindowType());
234 }
235 
teardownControlPanel()236 void FreqDisplayForm::teardownControlPanel()
237 {
238     if (d_controlpanel) {
239         d_layout->removeItem(d_controlpanel);
240         delete d_controlpanel;
241         d_controlpanel = NULL;
242     }
243     d_controlpanelmenu->setChecked(false);
244 }
245 
getPlot()246 FrequencyDisplayPlot* FreqDisplayForm::getPlot()
247 {
248     return ((FrequencyDisplayPlot*)d_display_plot);
249 }
250 
newData(const QEvent * updateEvent)251 void FreqDisplayForm::newData(const QEvent* updateEvent)
252 {
253     FreqUpdateEvent* fevent = (FreqUpdateEvent*)updateEvent;
254     const std::vector<double*> dataPoints = fevent->getPoints();
255     const uint64_t numDataPoints = fevent->getNumDataPoints();
256 
257     getPlot()->plotNewData(dataPoints, numDataPoints, 0, 0, 0, d_update_time);
258 }
259 
customEvent(QEvent * e)260 void FreqDisplayForm::customEvent(QEvent* e)
261 {
262     if (e->type() == FreqUpdateEvent::Type()) {
263         newData(e);
264     } else if (e->type() == SpectrumFrequencyRangeEventType) {
265         SetFreqEvent* fevent = (SetFreqEvent*)e;
266         setFrequencyRange(fevent->getCenterFrequency(), fevent->getBandwidth());
267     }
268 }
269 
getFFTSize() const270 int FreqDisplayForm::getFFTSize() const { return d_fftsize; }
271 
getFFTAverage() const272 float FreqDisplayForm::getFFTAverage() const { return d_fftavg; }
273 
getFFTWindowType() const274 gr::filter::firdes::win_type FreqDisplayForm::getFFTWindowType() const
275 {
276     return d_fftwintype;
277 }
278 
setSampleRate(const QString & samprate)279 void FreqDisplayForm::setSampleRate(const QString& samprate)
280 {
281     setFrequencyRange(d_center_freq, samprate.toDouble());
282 }
283 
setFFTSize(const int newsize)284 void FreqDisplayForm::setFFTSize(const int newsize)
285 {
286     d_fftsize = newsize;
287     d_sizemenu->getActionFromSize(newsize)->setChecked(true);
288 
289     emit signalReplot();
290     emit signalFFTSize(newsize);
291 }
292 
setFFTAverage(const float newavg)293 void FreqDisplayForm::setFFTAverage(const float newavg)
294 {
295     d_fftavg = newavg;
296     d_avgmenu->getActionFromAvg(newavg)->setChecked(true);
297     emit signalReplot();
298     // emit signalFFTAverage(newavg);
299 }
300 
setFFTWindowType(const gr::filter::firdes::win_type newwin)301 void FreqDisplayForm::setFFTWindowType(const gr::filter::firdes::win_type newwin)
302 {
303     d_fftwintype = newwin;
304     d_winmenu->getActionFromWindow(newwin)->setChecked(true);
305     emit signalReplot();
306     emit signalFFTWindow(newwin);
307 }
308 
setFrequencyRange(const double centerfreq,const double bandwidth)309 void FreqDisplayForm::setFrequencyRange(const double centerfreq, const double bandwidth)
310 {
311     std::string strunits[4] = { "Hz", "kHz", "MHz", "GHz" };
312     double units10 = floor(log10(bandwidth));
313     double units3 = std::max(floor(units10 / 3.0), 0.0);
314     d_units = pow(10, (units10 - fmod(units10, 3.0)));
315     int iunit = static_cast<int>(units3);
316 
317     d_center_freq = centerfreq;
318     d_samp_rate = bandwidth;
319 
320     getPlot()->setFrequencyRange(centerfreq, bandwidth, d_units, strunits[iunit]);
321 }
322 
setYaxis(double min,double max)323 void FreqDisplayForm::setYaxis(double min, double max) { getPlot()->setYaxis(min, max); }
324 
setYLabel(const std::string & label,const std::string & unit)325 void FreqDisplayForm::setYLabel(const std::string& label, const std::string& unit)
326 {
327     getPlot()->setYLabel(label, unit);
328 }
329 
setYMax(const QString & m)330 void FreqDisplayForm::setYMax(const QString& m)
331 {
332     double new_max = m.toDouble();
333     double cur_ymin = getPlot()->getYMin();
334     if (new_max > cur_ymin)
335         setYaxis(cur_ymin, new_max);
336 }
337 
setYMin(const QString & m)338 void FreqDisplayForm::setYMin(const QString& m)
339 {
340     double new_min = m.toDouble();
341     double cur_ymax = getPlot()->getYMax();
342     if (new_min < cur_ymax)
343         setYaxis(new_min, cur_ymax);
344 }
345 
autoScale(bool en)346 void FreqDisplayForm::autoScale(bool en)
347 {
348     if (en) {
349         d_autoscale_state = true;
350     } else {
351         d_autoscale_state = false;
352     }
353 
354     d_autoscale_act->setChecked(en);
355     getPlot()->setAutoScale(d_autoscale_state);
356     emit signalReplot();
357 }
358 
autoScaleShot()359 void FreqDisplayForm::autoScaleShot()
360 {
361     getPlot()->setAutoScaleShot();
362     emit signalReplot();
363 }
364 
setPlotPosHalf(bool half)365 void FreqDisplayForm::setPlotPosHalf(bool half)
366 {
367     getPlot()->setPlotPosHalf(half);
368     emit signalReplot();
369 }
370 
clearMaxHold()371 void FreqDisplayForm::clearMaxHold() { getPlot()->clearMaxData(); }
372 
clearMinHold()373 void FreqDisplayForm::clearMinHold() { getPlot()->clearMinData(); }
374 
onPlotPointSelected(const QPointF p)375 void FreqDisplayForm::onPlotPointSelected(const QPointF p)
376 {
377     d_clicked = true;
378     d_clicked_freq = d_units * p.x();
379 }
380 
checkClicked()381 bool FreqDisplayForm::checkClicked()
382 {
383     if (d_clicked) {
384         d_clicked = false;
385         return true;
386     } else {
387         return false;
388     }
389 }
390 
getClickedFreq() const391 float FreqDisplayForm::getClickedFreq() const { return d_clicked_freq; }
392 
393 
394 /********************************************************************
395  * TRIGGER METHODS
396  *******************************************************************/
397 
setTriggerMode(gr::qtgui::trigger_mode mode)398 void FreqDisplayForm::setTriggerMode(gr::qtgui::trigger_mode mode)
399 {
400     d_trig_mode = mode;
401     d_tr_mode_menu->getAction(mode)->setChecked(true);
402 
403     if ((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) ||
404         (d_trig_mode == gr::qtgui::TRIG_MODE_NORM)) {
405         getPlot()->attachTriggerLine(true);
406     } else {
407         getPlot()->attachTriggerLine(false);
408     }
409 
410     emit signalReplot();
411     emit signalTriggerMode(mode);
412 }
413 
updateTrigger(gr::qtgui::trigger_mode mode)414 void FreqDisplayForm::updateTrigger(gr::qtgui::trigger_mode mode)
415 {
416     // If auto or normal mode, popup trigger level box to set
417     if ((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) ||
418         (d_trig_mode == gr::qtgui::TRIG_MODE_NORM)) {
419         d_tr_level_act->activate(QAction::Trigger);
420         getPlot()->attachTriggerLine(true);
421     } else {
422         getPlot()->attachTriggerLine(false);
423     }
424 
425     // if tag mode, popup tag key box to set
426     if ((d_trig_tag_key.empty()) && (d_trig_mode == gr::qtgui::TRIG_MODE_TAG))
427         d_tr_tag_key_act->activate(QAction::Trigger);
428 
429     emit signalReplot();
430     emit signalTriggerMode(mode);
431 }
432 
getTriggerMode() const433 gr::qtgui::trigger_mode FreqDisplayForm::getTriggerMode() const { return d_trig_mode; }
434 
setTriggerLevel(QString s)435 void FreqDisplayForm::setTriggerLevel(QString s)
436 {
437     d_trig_level = s.toFloat();
438 
439     if ((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) ||
440         (d_trig_mode == gr::qtgui::TRIG_MODE_NORM)) {
441         getPlot()->setTriggerLine(d_trig_level);
442     }
443 
444     emit signalReplot();
445 }
446 
setTriggerLevel(float level)447 void FreqDisplayForm::setTriggerLevel(float level)
448 {
449     d_trig_level = level;
450     d_tr_level_act->setText(QString().setNum(d_trig_level));
451 
452     if ((d_trig_mode == gr::qtgui::TRIG_MODE_AUTO) ||
453         (d_trig_mode == gr::qtgui::TRIG_MODE_NORM)) {
454         getPlot()->setTriggerLine(d_trig_level);
455     }
456 
457     emit signalReplot();
458 }
459 
getTriggerLevel() const460 float FreqDisplayForm::getTriggerLevel() const { return d_trig_level; }
461 
setTriggerChannel(int channel)462 void FreqDisplayForm::setTriggerChannel(int channel)
463 {
464     d_trig_channel = channel;
465     d_tr_channel_menu->getAction(d_trig_channel)->setChecked(true);
466     emit signalReplot();
467 }
468 
getTriggerChannel() const469 int FreqDisplayForm::getTriggerChannel() const { return d_trig_channel; }
470 
setTriggerTagKey(QString s)471 void FreqDisplayForm::setTriggerTagKey(QString s) { d_trig_tag_key = s.toStdString(); }
472 
setTriggerTagKey(const std::string & key)473 void FreqDisplayForm::setTriggerTagKey(const std::string& key)
474 {
475     d_trig_tag_key = key;
476     d_tr_tag_key_act->setText(QString().fromStdString(d_trig_tag_key));
477     emit signalReplot();
478 }
479 
getTriggerTagKey() const480 std::string FreqDisplayForm::getTriggerTagKey() const { return d_trig_tag_key; }
481 
482 
483 /********************************************************************
484  * Notification messages from the control panel
485  *******************************************************************/
486 
487 
notifyYAxisPlus()488 void FreqDisplayForm::notifyYAxisPlus()
489 {
490 #if QWT_VERSION < 0x060100
491     QwtScaleDiv* ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
492     double range = ax->upperBound() - ax->lowerBound();
493     double step = range / 20.0;
494     getPlot()->setYaxis(ax->lowerBound() + step, ax->upperBound() + step);
495 
496 #else
497 
498     QwtScaleDiv ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
499     double range = ax.upperBound() - ax.lowerBound();
500     double step = range / 20.0;
501     getPlot()->setYaxis(ax.lowerBound() + step, ax.upperBound() + step);
502 #endif
503 }
504 
notifyYAxisMinus()505 void FreqDisplayForm::notifyYAxisMinus()
506 {
507 #if QWT_VERSION < 0x060100
508     QwtScaleDiv* ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
509     double range = ax->upperBound() - ax->lowerBound();
510     double step = range / 20.0;
511     getPlot()->setYaxis(ax->lowerBound() - step, ax->upperBound() - step);
512 
513 #else
514 
515     QwtScaleDiv ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
516     double range = ax.upperBound() - ax.lowerBound();
517     double step = range / 20.0;
518     getPlot()->setYaxis(ax.lowerBound() - step, ax.upperBound() - step);
519 #endif
520 }
521 
notifyYRangePlus()522 void FreqDisplayForm::notifyYRangePlus()
523 {
524 #if QWT_VERSION < 0x060100
525     QwtScaleDiv* ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
526     double range = ax->upperBound() - ax->lowerBound();
527     double step = range / 20.0;
528     getPlot()->setYaxis(ax->lowerBound() - step, ax->upperBound() + step);
529 
530 #else
531 
532     QwtScaleDiv ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
533     double range = ax.upperBound() - ax.lowerBound();
534     double step = range / 20.0;
535     getPlot()->setYaxis(ax.lowerBound() - step, ax.upperBound() + step);
536 #endif
537 }
538 
notifyYRangeMinus()539 void FreqDisplayForm::notifyYRangeMinus()
540 {
541 #if QWT_VERSION < 0x060100
542     QwtScaleDiv* ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
543     double range = ax->upperBound() - ax->lowerBound();
544     double step = range / 20.0;
545     getPlot()->setYaxis(ax->lowerBound() + step, ax->upperBound() - step);
546 
547 #else
548 
549     QwtScaleDiv ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
550     double range = ax.upperBound() - ax.lowerBound();
551     double step = range / 20.0;
552     getPlot()->setYaxis(ax.lowerBound() + step, ax.upperBound() - step);
553 #endif
554 }
555 
556 
notifyFFTSize(const QString & s)557 void FreqDisplayForm::notifyFFTSize(const QString& s) { setFFTSize(s.toInt()); }
558 
notifyFFTWindow(const QString & s)559 void FreqDisplayForm::notifyFFTWindow(const QString& s)
560 {
561     if (s == "None") {
562         d_fftwintype = gr::filter::firdes::WIN_NONE;
563     } else if (s == "Hamming") {
564         d_fftwintype = gr::filter::firdes::WIN_HAMMING;
565     } else if (s == "Hann") {
566         d_fftwintype = gr::filter::firdes::WIN_HANN;
567     } else if (s == "Blackman") {
568         d_fftwintype = gr::filter::firdes::WIN_BLACKMAN;
569     } else if (s == "Blackman-harris") {
570         d_fftwintype = gr::filter::firdes::WIN_BLACKMAN_hARRIS;
571     } else if (s == "Rectangular") {
572         d_fftwintype = gr::filter::firdes::WIN_RECTANGULAR;
573     } else if (s == "Kaiser") {
574         d_fftwintype = gr::filter::firdes::WIN_KAISER;
575     } else if (s == "Flat-top") {
576         d_fftwintype = gr::filter::firdes::WIN_FLATTOP;
577     }
578 
579     d_winmenu->getActionFromWindow(d_fftwintype)->setChecked(true);
580     emit signalReplot();
581 }
582 
583 
notifyMaxHold(bool en)584 void FreqDisplayForm::notifyMaxHold(bool en)
585 {
586     d_maxhold_act->setChecked(en);
587     emit signalClearMaxData();
588     emit signalSetMaxFFTVisible(en);
589 }
590 
notifyMinHold(bool en)591 void FreqDisplayForm::notifyMinHold(bool en)
592 {
593     d_minhold_act->setChecked(en);
594     emit signalClearMinData();
595     emit signalSetMinFFTVisible(en);
596 }
597 
598 
notifyTriggerMode(const QString & mode)599 void FreqDisplayForm::notifyTriggerMode(const QString& mode)
600 {
601     if (mode == "Free") {
602         setTriggerMode(gr::qtgui::TRIG_MODE_FREE);
603     } else if (mode == "Auto") {
604         setTriggerMode(gr::qtgui::TRIG_MODE_AUTO);
605     } else if (mode == "Normal") {
606         setTriggerMode(gr::qtgui::TRIG_MODE_NORM);
607     } else if (mode == "Tag") {
608         setTriggerMode(gr::qtgui::TRIG_MODE_TAG);
609         updateTrigger(gr::qtgui::TRIG_MODE_TAG);
610     }
611 }
612 
613 
notifyTriggerLevelPlus()614 void FreqDisplayForm::notifyTriggerLevelPlus()
615 {
616     emit signalTriggerLevel(getTriggerLevel() + 1);
617 }
618 
notifyTriggerLevelMinus()619 void FreqDisplayForm::notifyTriggerLevelMinus()
620 {
621     emit signalTriggerLevel(getTriggerLevel() - 1);
622 }
623