File: freqdisplayform.cc

package info (click to toggle)
gnuradio 3.7.10.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 37,104 kB
  • ctags: 37,270
  • sloc: cpp: 150,156; python: 86,734; xml: 40,886; ansic: 19,461; fortran: 927; sh: 271; lisp: 31; makefile: 14
file content (700 lines) | stat: -rw-r--r-- 18,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
/* -*- c++ -*- */
/*
 * Copyright 2012,2014 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU Radio; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#include <cmath>
#include <QMessageBox>
#include <QSpacerItem>
#include <gnuradio/qtgui/freqdisplayform.h>
#include <gnuradio/qtgui/freqcontrolpanel.h>
#include <iostream>

FreqDisplayForm::FreqDisplayForm(int nplots, QWidget* parent)
  : DisplayForm(nplots, parent)
{
  d_int_validator = new QIntValidator(this);
  d_int_validator->setBottom(0);

  d_layout = new QGridLayout(this);
  d_display_plot = new FrequencyDisplayPlot(nplots, this);
  d_layout->addWidget(d_display_plot, 0, 0);

  d_layout->setColumnStretch(0, 1);
  setLayout(d_layout);

  d_controlpanel = NULL;

  d_num_real_data_points = 1024;
  d_fftsize = 1024;
  d_fftavg = 1.0;
  d_clicked = false;
  d_clicked_freq = 0;

  d_trig_mode = gr::qtgui::TRIG_MODE_FREE;
  d_trig_level = 0;
  d_trig_channel = 0;
  d_trig_tag_key = "";

  d_sizemenu = new FFTSizeMenu(this);
  d_avgmenu = new FFTAverageMenu(this);
  d_winmenu = new FFTWindowMenu(this);
  d_menu->addMenu(d_sizemenu);
  d_menu->addMenu(d_avgmenu);
  d_menu->addMenu(d_winmenu);
  connect(d_sizemenu, SIGNAL(whichTrigger(int)),
	  this, SLOT(setFFTSize(const int)));
  connect(d_avgmenu, SIGNAL(whichTrigger(float)),
	  this, SLOT(setFFTAverage(const float)));
  connect(d_winmenu, SIGNAL(whichTrigger(gr::filter::firdes::win_type)),
	  this, SLOT(setFFTWindowType(const gr::filter::firdes::win_type)));

  PopupMenu *maxymenu = new PopupMenu("Y Max", this);
  d_menu->addAction(maxymenu);
  connect(maxymenu, SIGNAL(whichTrigger(QString)),
	  this, SLOT(setYMax(QString)));

  PopupMenu *minymenu = new PopupMenu("Y Min", this);
  d_menu->addAction(minymenu);
  connect(minymenu, SIGNAL(whichTrigger(QString)),
	  this, SLOT(setYMin(QString)));

  d_maxhold_act = new QAction("Max Hold", this);
  d_maxhold_act->setCheckable(true);
  d_menu->addAction(d_maxhold_act);
  connect(d_maxhold_act, SIGNAL(triggered(bool)),
	  this, SLOT(notifyMaxHold(bool)));
  d_minhold_act = new QAction("Min Hold", this);
  d_minhold_act->setCheckable(true);
  d_menu->addAction(d_minhold_act);
  connect(d_minhold_act, SIGNAL(triggered(bool)),
	  this, SLOT(notifyMinHold(bool)));

  // Set up the trigger menu
  d_triggermenu = new QMenu("Trigger", this);
  d_tr_mode_menu = new TriggerModeMenu(this);
  d_tr_level_act = new PopupMenu("Level", this);
  d_tr_channel_menu = new TriggerChannelMenu(nplots, this);
  d_tr_tag_key_act = new PopupMenu("Tag Key", this);
  d_triggermenu->addMenu(d_tr_mode_menu);
  d_triggermenu->addAction(d_tr_level_act);
  d_triggermenu->addMenu(d_tr_channel_menu);
  d_triggermenu->addAction(d_tr_tag_key_act);
  d_menu->addMenu(d_triggermenu);

  d_controlpanelmenu = new QAction("Control Panel", this);
  d_controlpanelmenu->setCheckable(true);
  d_menu->addAction(d_controlpanelmenu);
  connect(d_controlpanelmenu, SIGNAL(triggered(bool)),
	  this, SLOT(setupControlPanel(bool)));

  setTriggerMode(gr::qtgui::TRIG_MODE_FREE);
  connect(d_tr_mode_menu, SIGNAL(whichTrigger(gr::qtgui::trigger_mode)),
          this, SLOT(setTriggerMode(gr::qtgui::trigger_mode)));
  // updates trigger state by calling set level or set tag key.
  connect(d_tr_mode_menu, SIGNAL(whichTrigger(gr::qtgui::trigger_mode)),
          this, SLOT(updateTrigger(gr::qtgui::trigger_mode)));

  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)),
          this, SLOT(setTriggerChannel(int)));

  setTriggerTagKey(std::string(""));
  connect(d_tr_tag_key_act, SIGNAL(whichTrigger(QString)),
          this, SLOT(setTriggerTagKey(QString)));

  connect(this, SIGNAL(signalClearMaxData()),
          getPlot(), SLOT(clearMaxData()));
  connect(this, SIGNAL(signalClearMinData()),
          getPlot(), SLOT(clearMinData()));
  connect(this, SIGNAL(signalSetMaxFFTVisible(bool)),
          getPlot(), SLOT(setMaxFFTVisible(bool)));
  connect(this, SIGNAL(signalSetMinFFTVisible(bool)),
          getPlot(), SLOT(setMinFFTVisible(bool)));

  Reset();

  connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)),
	  this, SLOT(onPlotPointSelected(const QPointF)));

  connect(this, SIGNAL(signalReplot()),
          getPlot(), SLOT(replot()));
}

FreqDisplayForm::~FreqDisplayForm()
{
  // Qt deletes children when parent is deleted

  // Don't worry about deleting Display Plots - they are deleted when parents are deleted
  delete d_int_validator;

  teardownControlPanel();
}

void
FreqDisplayForm::setupControlPanel(bool en)
{
  if(en) {
    setupControlPanel();
  }
  else {
    teardownControlPanel();
  }
}

void
FreqDisplayForm::setupControlPanel()
{
  if(d_controlpanel)
    delete d_controlpanel;

  // Create the control panel layout
  d_controlpanel = new FreqControlPanel(this);

  // Connect action items in menu to controlpanel widgets
  connect(d_grid_act, SIGNAL(triggered(bool)),
          d_controlpanel, SLOT(toggleGrid(bool)));
  connect(d_axislabelsmenu, SIGNAL(triggered(bool)),
          d_controlpanel, SLOT(toggleAxisLabels(bool)));
  connect(d_sizemenu, SIGNAL(whichTrigger(int)),
	  d_controlpanel, SLOT(toggleFFTSize(int)));
  connect(d_winmenu, SIGNAL(whichTrigger(gr::filter::firdes::win_type)),
	  d_controlpanel, SLOT(toggleFFTWindow(gr::filter::firdes::win_type)));
  connect(this, SIGNAL(signalFFTSize(int)),
	  d_controlpanel, SLOT(toggleFFTSize(int)));
  connect(this, SIGNAL(signalFFTWindow(gr::filter::firdes::win_type)),
	  d_controlpanel, SLOT(toggleFFTWindow(gr::filter::firdes::win_type)));
  connect(d_maxhold_act, SIGNAL(triggered(bool)),
          d_controlpanel, SLOT(toggleMaxHold(bool)));
  connect(d_minhold_act, SIGNAL(triggered(bool)),
          d_controlpanel, SLOT(toggleMinHold(bool)));
  connect(d_avgmenu, SIGNAL(whichTrigger(float)),
          d_controlpanel, SLOT(setFFTAverage(float)));
  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)));
  connect(d_stop_act, SIGNAL(triggered()),
          d_controlpanel, SLOT(toggleStopButton()));

  d_layout->addLayout(d_controlpanel, 0, 1);

  d_controlpanel->toggleGrid(d_grid_act->isChecked());
  d_controlpanel->toggleAxisLabels(d_axislabelsmenu->isChecked());
  d_controlpanelmenu->setChecked(true);
  d_controlpanel->toggleTriggerMode(getTriggerMode());
  d_controlpanel->toggleMaxHold(d_maxhold_act->isChecked());
  d_controlpanel->toggleMinHold(d_minhold_act->isChecked());
  d_controlpanel->setFFTAverage(getFFTAverage());

  emit signalFFTSize(getFFTSize());
  emit signalFFTWindow(getFFTWindowType());
}

void
FreqDisplayForm::teardownControlPanel()
{
  if(d_controlpanel) {
    d_layout->removeItem(d_controlpanel);
    delete d_controlpanel;
    d_controlpanel = NULL;
  }
  d_controlpanelmenu->setChecked(false);
}

FrequencyDisplayPlot*
FreqDisplayForm::getPlot()
{
  return ((FrequencyDisplayPlot*)d_display_plot);
}

void
FreqDisplayForm::newData(const QEvent *updateEvent)
{
  FreqUpdateEvent *fevent = (FreqUpdateEvent*)updateEvent;
  const std::vector<double*> dataPoints = fevent->getPoints();
  const uint64_t numDataPoints = fevent->getNumDataPoints();

  getPlot()->plotNewData(dataPoints, numDataPoints,
			 0, 0, 0, d_update_time);
}

void
FreqDisplayForm::customEvent( QEvent * e)
{
  if(e->type() == FreqUpdateEvent::Type()) {
    newData(e);
  }
  else if(e->type() == SpectrumFrequencyRangeEventType) {
    SetFreqEvent *fevent = (SetFreqEvent*)e;
    setFrequencyRange(fevent->getCenterFrequency(), fevent->getBandwidth());
  }
}

int
FreqDisplayForm::getFFTSize() const
{
  return d_fftsize;
}

float
FreqDisplayForm::getFFTAverage() const
{
  return d_fftavg;
}

gr::filter::firdes::win_type
FreqDisplayForm::getFFTWindowType() const
{
  return d_fftwintype;
}

void
FreqDisplayForm::setSampleRate(const QString &samprate)
{
  setFrequencyRange(d_center_freq, samprate.toDouble());
}

void
FreqDisplayForm::setFFTSize(const int newsize)
{
  d_fftsize = newsize;
  d_sizemenu->getActionFromSize(newsize)->setChecked(true);

  emit signalReplot();
  emit signalFFTSize(newsize);
}

void
FreqDisplayForm::setFFTAverage(const float newavg)
{
  d_fftavg = newavg;
  d_avgmenu->getActionFromAvg(newavg)->setChecked(true);
  emit signalReplot();
  //emit signalFFTAverage(newavg);
}

void
FreqDisplayForm::setFFTWindowType(const gr::filter::firdes::win_type newwin)
{
  d_fftwintype = newwin;
  d_winmenu->getActionFromWindow(newwin)->setChecked(true);
  emit signalReplot();
  emit signalFFTWindow(newwin);
}

void
FreqDisplayForm::setFrequencyRange(const double centerfreq,
				   const double bandwidth)
{
  std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"};
  double units10 = floor(log10(bandwidth));
  double units3  = std::max(floor(units10 / 3.0), 0.0);
  d_units = pow(10, (units10-fmod(units10, 3.0)));
  int iunit = static_cast<int>(units3);

  d_center_freq = centerfreq;
  d_samp_rate = bandwidth;

  getPlot()->setFrequencyRange(centerfreq, bandwidth,
			       d_units, strunits[iunit]);
}

void
FreqDisplayForm::setYaxis(double min, double max)
{
  getPlot()->setYaxis(min, max);
}

void FreqDisplayForm::setYLabel(const std::string &label,
                                const std::string &unit)
{
  getPlot()->setYLabel(label, unit);
}

void
FreqDisplayForm::setYMax(const QString &m)
{
  double new_max = m.toDouble();
  double cur_ymin = getPlot()->getYMin();
  if(new_max > cur_ymin)
    setYaxis(cur_ymin, new_max);
}

void
FreqDisplayForm::setYMin(const QString &m)
{
  double new_min = m.toDouble();
  double cur_ymax = getPlot()->getYMax();
  if(new_min < cur_ymax)
    setYaxis(new_min, cur_ymax);
}

void
FreqDisplayForm::autoScale(bool en)
{
  if(en) {
    d_autoscale_state = true;
  }
  else {
    d_autoscale_state = false;
  }

  d_autoscale_act->setChecked(en);
  getPlot()->setAutoScale(d_autoscale_state);
  emit signalReplot();
}

void
FreqDisplayForm::autoScaleShot()
{
  getPlot()->setAutoScaleShot();
  emit signalReplot();
}

void
FreqDisplayForm::setPlotPosHalf(bool half)
{
  getPlot()->setPlotPosHalf(half);
  emit signalReplot();
}

void
FreqDisplayForm::clearMaxHold()
{
  getPlot()->clearMaxData();
}

void
FreqDisplayForm::clearMinHold()
{
  getPlot()->clearMinData();
}

void
FreqDisplayForm::onPlotPointSelected(const QPointF p)
{
  d_clicked = true;
  d_clicked_freq = d_units*p.x();
}

bool
FreqDisplayForm::checkClicked()
{
  if(d_clicked) {
    d_clicked = false;
    return true;
  }
  else {
    return false;
  }
}

float
FreqDisplayForm::getClickedFreq() const
{
  return d_clicked_freq;
}


/********************************************************************
 * TRIGGER METHODS
 *******************************************************************/

void
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)) {
    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_tag_key == "") && (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
FreqDisplayForm::getTriggerMode() const
{
  return d_trig_mode;
}

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
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
FreqDisplayForm::getTriggerLevel() const
{
  return d_trig_level;
}

void
FreqDisplayForm::setTriggerChannel(int channel)
{
  d_trig_channel = channel;
  d_tr_channel_menu->getAction(d_trig_channel)->setChecked(true);
  emit signalReplot();
}

int
FreqDisplayForm::getTriggerChannel() const
{
  return d_trig_channel;
}

void
FreqDisplayForm::setTriggerTagKey(QString s)
{
  d_trig_tag_key = s.toStdString();
}

void
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
FreqDisplayForm::getTriggerTagKey() const
{
  return d_trig_tag_key;
}



/********************************************************************
 * Notifcation messages from the control panel
 *******************************************************************/


void
FreqDisplayForm::notifyYAxisPlus()
{
#if QWT_VERSION < 0x060100
  QwtScaleDiv *ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
  double range = ax->upperBound() - ax->lowerBound();
  double step = range/20.0;
  getPlot()->setYaxis(ax->lowerBound()+step, ax->upperBound()+step);

#else

  QwtScaleDiv ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
  double range = ax.upperBound() - ax.lowerBound();
  double step = range/20.0;
  getPlot()->setYaxis(ax.lowerBound()+step, ax.upperBound()+step);
#endif
}

void
FreqDisplayForm::notifyYAxisMinus()
{
#if QWT_VERSION < 0x060100
  QwtScaleDiv *ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
  double range = ax->upperBound() - ax->lowerBound();
  double step = range/20.0;
  getPlot()->setYaxis(ax->lowerBound()-step, ax->upperBound()-step);

#else

  QwtScaleDiv ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
  double range = ax.upperBound() - ax.lowerBound();
  double step = range/20.0;
  getPlot()->setYaxis(ax.lowerBound()-step, ax.upperBound()-step);
#endif
}

void
FreqDisplayForm::notifyYRangePlus()
{
#if QWT_VERSION < 0x060100
  QwtScaleDiv *ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
  double range = ax->upperBound() - ax->lowerBound();
  double step = range/20.0;
  getPlot()->setYaxis(ax->lowerBound()-step, ax->upperBound()+step);

#else

  QwtScaleDiv ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
  double range = ax.upperBound() - ax.lowerBound();
  double step = range/20.0;
  getPlot()->setYaxis(ax.lowerBound()-step, ax.upperBound()+step);
#endif
}

void
FreqDisplayForm::notifyYRangeMinus()
{
#if QWT_VERSION < 0x060100
  QwtScaleDiv *ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
  double range = ax->upperBound() - ax->lowerBound();
  double step = range/20.0;
  getPlot()->setYaxis(ax->lowerBound()+step, ax->upperBound()-step);

#else

  QwtScaleDiv ax = getPlot()->axisScaleDiv(QwtPlot::yLeft);
  double range = ax.upperBound() - ax.lowerBound();
  double step = range/20.0;
  getPlot()->setYaxis(ax.lowerBound()+step, ax.upperBound()-step);
#endif
}


void
FreqDisplayForm::notifyFFTSize(const QString &s)
{
  setFFTSize(s.toInt());
}

void
FreqDisplayForm::notifyFFTWindow(const QString &s)
{
  if(s == "None") {
    d_fftwintype = gr::filter::firdes::WIN_NONE;
  }
  else if(s == "Hamming") {
    d_fftwintype = gr::filter::firdes::WIN_HAMMING;
  }
  else if(s == "Hann") {
    d_fftwintype = gr::filter::firdes::WIN_HANN;
  }
  else if(s == "Blackman") {
    d_fftwintype = gr::filter::firdes::WIN_BLACKMAN;
  }
  else if(s == "Blackman-harris") {
    d_fftwintype = gr::filter::firdes::WIN_BLACKMAN_hARRIS;
  }
  else if(s == "Rectangular") {
    d_fftwintype = gr::filter::firdes::WIN_RECTANGULAR;
  }
  else if(s == "Kaiser") {
    d_fftwintype = gr::filter::firdes::WIN_KAISER;
  }
  else if(s == "Flat-top") {
    d_fftwintype = gr::filter::firdes::WIN_FLATTOP;
  }

  d_winmenu->getActionFromWindow(d_fftwintype)->setChecked(true);
  emit signalReplot();
}


void
FreqDisplayForm::notifyMaxHold(bool en)
{
  d_maxhold_act->setChecked(en);
  emit signalClearMaxData();
  emit signalSetMaxFFTVisible(en);
}

void
FreqDisplayForm::notifyMinHold(bool en)
{
  d_minhold_act->setChecked(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);
}