GNU Radio Manual and C++ API Reference  3.7.11
The Free & Open Software Radio Ecosystem
form_menus.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012 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 #ifndef FORM_MENUS_H
24 #define FORM_MENUS_H
25 
26 #include <stdexcept>
27 #include <vector>
28 #include <QtGui/QtGui>
29 #include <QtGui/QIntValidator>
30 #include <QtGui/QDoubleValidator>
31 
32 #if QT_VERSION >= 0x050000
33 #include <QtWidgets/QtWidgets>
34 #endif
35 
36 #include <qwt_symbol.h>
37 #include <gnuradio/filter/firdes.h>
40 
41 class LineColorMenu: public QMenu
42 {
43  Q_OBJECT
44 
45 public:
46  LineColorMenu(int which, QWidget *parent)
47  : QMenu("Line Color", parent), d_which(which)
48  {
49  d_grp = new QActionGroup(this);
50 
51  d_act.push_back(new QAction("Blue", this));
52  d_act.push_back(new QAction("Red", this));
53  d_act.push_back(new QAction("Green", this));
54  d_act.push_back(new QAction("Black", this));
55  d_act.push_back(new QAction("Cyan", this));
56  d_act.push_back(new QAction("Magenta", this));
57  d_act.push_back(new QAction("Yellow", this));
58  d_act.push_back(new QAction("Gray", this));
59  d_act.push_back(new QAction("Dark Red", this));
60  d_act.push_back(new QAction("Dark Green", this));
61  d_act.push_back(new QAction("Dark Blue", this));
62  d_act.push_back(new QAction("Dark Gray", this));
63 
64  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getBlue()));
65  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getRed()));
66  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getGreen()));
67  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getBlack()));
68  connect(d_act[4], SIGNAL(triggered()), this, SLOT(getCyan()));
69  connect(d_act[5], SIGNAL(triggered()), this, SLOT(getMagenta()));
70  connect(d_act[6], SIGNAL(triggered()), this, SLOT(getYellow()));
71  connect(d_act[7], SIGNAL(triggered()), this, SLOT(getGray()));
72  connect(d_act[8], SIGNAL(triggered()), this, SLOT(getDarkRed()));
73  connect(d_act[9], SIGNAL(triggered()), this, SLOT(getDarkGreen()));
74  connect(d_act[10], SIGNAL(triggered()), this, SLOT(getDarkBlue()));
75  connect(d_act[11], SIGNAL(triggered()), this, SLOT(getDarkGray()));
76 
77  QListIterator<QAction*> i(d_act);
78  while(i.hasNext()) {
79  QAction *a = i.next();
80  a->setCheckable(true);
81  a->setActionGroup(d_grp);
82  addAction(a);
83  }
84  }
85 
87  {}
88 
89  int getNumActions() const
90  {
91  return d_act.size();
92  }
93 
94  QAction * getAction(int which)
95  {
96  if(which < d_act.size())
97  return d_act[which];
98  else
99  throw std::runtime_error("LineColorMenu::getAction: which out of range.\n");
100  }
101 
102 signals:
103  void whichTrigger(int which, const QString &name);
104 
105 public slots:
106  void getBlue() { emit whichTrigger(d_which, "blue"); }
107  void getRed() { emit whichTrigger(d_which, "red"); }
108  void getGreen() { emit whichTrigger(d_which, "green"); }
109  void getBlack() { emit whichTrigger(d_which, "black"); }
110  void getCyan() { emit whichTrigger(d_which, "cyan"); }
111  void getMagenta() { emit whichTrigger(d_which, "magenta"); }
112  void getYellow() { emit whichTrigger(d_which, "yellow"); }
113  void getGray() { emit whichTrigger(d_which, "gray"); }
114  void getDarkRed() { emit whichTrigger(d_which, "darkred"); }
115  void getDarkGreen() { emit whichTrigger(d_which, "darkgreen"); }
116  void getDarkBlue() { emit whichTrigger(d_which, "darkblue"); }
117  void getDarkGray() { emit whichTrigger(d_which, "darkgray"); }
118 
119 private:
120  QActionGroup *d_grp;
121  QList<QAction *> d_act;
122  int d_which;
123 };
124 
125 
126 /********************************************************************/
127 
128 
129 class LineWidthMenu: public QMenu
130 {
131  Q_OBJECT
132 
133 public:
134  LineWidthMenu(int which, QWidget *parent)
135  : QMenu("Line Width", parent), d_which(which)
136  {
137  d_grp = new QActionGroup(this);
138 
139  d_act.push_back(new QAction("1", this));
140  d_act.push_back(new QAction("2", this));
141  d_act.push_back(new QAction("3", this));
142  d_act.push_back(new QAction("4", this));
143  d_act.push_back(new QAction("5", this));
144  d_act.push_back(new QAction("6", this));
145  d_act.push_back(new QAction("7", this));
146  d_act.push_back(new QAction("8", this));
147  d_act.push_back(new QAction("9", this));
148  d_act.push_back(new QAction("10", this));
149 
150  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getOne()));
151  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getTwo()));
152  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getThree()));
153  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getFour()));
154  connect(d_act[4], SIGNAL(triggered()), this, SLOT(getFive()));
155  connect(d_act[5], SIGNAL(triggered()), this, SLOT(getSix()));
156  connect(d_act[6], SIGNAL(triggered()), this, SLOT(getSeven()));
157  connect(d_act[7], SIGNAL(triggered()), this, SLOT(getEight()));
158  connect(d_act[8], SIGNAL(triggered()), this, SLOT(getNine()));
159  connect(d_act[9], SIGNAL(triggered()), this, SLOT(getTen()));
160 
161  QListIterator<QAction*> i(d_act);
162  while(i.hasNext()) {
163  QAction *a = i.next();
164  a->setCheckable(true);
165  a->setActionGroup(d_grp);
166  addAction(a);
167  }
168  }
169 
171  {}
172 
173  int getNumActions() const
174  {
175  return d_act.size();
176  }
177 
178  QAction * getAction(int which)
179  {
180  if(which < d_act.size())
181  return d_act[which];
182  else
183  throw std::runtime_error("LineWidthMenu::getAction: which out of range.\n");
184  }
185 
186 signals:
187  void whichTrigger(int which, int width);
188 
189 public slots:
190  void getOne() { emit whichTrigger(d_which, 1); }
191  void getTwo() { emit whichTrigger(d_which, 2); }
192  void getThree() { emit whichTrigger(d_which, 3); }
193  void getFour() { emit whichTrigger(d_which, 4); }
194  void getFive() { emit whichTrigger(d_which, 5); }
195  void getSix() { emit whichTrigger(d_which, 6); }
196  void getSeven() { emit whichTrigger(d_which, 7); }
197  void getEight() { emit whichTrigger(d_which, 8); }
198  void getNine() { emit whichTrigger(d_which, 9); }
199  void getTen() { emit whichTrigger(d_which, 10); }
200 
201 private:
202  QActionGroup *d_grp;
203  QList<QAction *> d_act;
204  int d_which;
205 };
206 
207 
208 /********************************************************************/
209 
210 
211 class LineStyleMenu: public QMenu
212 {
213  Q_OBJECT
214 
215 public:
216  LineStyleMenu(int which, QWidget *parent)
217  : QMenu("Line Style", parent), d_which(which)
218  {
219  d_grp = new QActionGroup(this);
220 
221  d_act.push_back(new QAction("None", this));
222  d_act.push_back(new QAction("Solid", this));
223  d_act.push_back(new QAction("Dash", this));
224  d_act.push_back(new QAction("Dots", this));
225  d_act.push_back(new QAction("Dash-Dot", this));
226  d_act.push_back(new QAction("Dash-Dot-Dot", this));
227 
228  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getNone()));
229  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getSolid()));
230  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getDash()));
231  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getDots()));
232  connect(d_act[4], SIGNAL(triggered()), this, SLOT(getDashDot()));
233  connect(d_act[5], SIGNAL(triggered()), this, SLOT(getDashDotDot()));
234 
235  QListIterator<QAction*> i(d_act);
236  while(i.hasNext()) {
237  QAction *a = i.next();
238  a->setCheckable(true);
239  a->setActionGroup(d_grp);
240  addAction(a);
241  }
242  }
243 
245  {}
246 
247  int getNumActions() const
248  {
249  return d_act.size();
250  }
251 
252  QAction * getAction(int which)
253  {
254  if(which < d_act.size())
255  return d_act[which];
256  else
257  throw std::runtime_error("LineStyleMenu::getAction: which out of range.\n");
258  }
259 
260 signals:
261  void whichTrigger(int which, Qt::PenStyle);
262 
263 public slots:
264  void getNone() { emit whichTrigger(d_which, Qt::NoPen); }
265  void getSolid() { emit whichTrigger(d_which, Qt::SolidLine); }
266  void getDash() { emit whichTrigger(d_which, Qt::DashLine); }
267  void getDots() { emit whichTrigger(d_which, Qt::DotLine); }
268  void getDashDot() { emit whichTrigger(d_which, Qt::DashDotLine); }
269  void getDashDotDot() { emit whichTrigger(d_which, Qt::DashDotDotLine); }
270 
271 private:
272  QActionGroup *d_grp;
273  QList<QAction *> d_act;
274  int d_which;
275 };
276 
277 
278 /********************************************************************/
279 
280 
281 class LineMarkerMenu: public QMenu
282 {
283  Q_OBJECT
284 
285 public:
286  LineMarkerMenu(int which, QWidget *parent)
287  : QMenu("Line Marker", parent), d_which(which)
288  {
289  d_grp = new QActionGroup(this);
290 
291  d_act.push_back(new QAction("None", this));
292  d_act.push_back(new QAction("Circle", this));
293  d_act.push_back(new QAction("Rectangle", this));
294  d_act.push_back(new QAction("Diamond", this));
295  d_act.push_back(new QAction("Triangle", this));
296  d_act.push_back(new QAction("Down Triangle", this));
297  d_act.push_back(new QAction("Left Triangle", this));
298  d_act.push_back(new QAction("Right Triangle", this));
299  d_act.push_back(new QAction("Cross", this));
300  d_act.push_back(new QAction("X-Cross", this));
301  d_act.push_back(new QAction("Horiz. Line", this));
302  d_act.push_back(new QAction("Vert. Line", this));
303  d_act.push_back(new QAction("Star 1", this));
304  d_act.push_back(new QAction("Star 2", this));
305  d_act.push_back(new QAction("Hexagon", this));
306 
307  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getNone()));
308  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getCircle()));
309  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getRect()));
310  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getDiamond()));
311  connect(d_act[4], SIGNAL(triggered()), this, SLOT(getTriangle()));
312  connect(d_act[5], SIGNAL(triggered()), this, SLOT(getDTriangle()));
313  connect(d_act[6], SIGNAL(triggered()), this, SLOT(getLTriangle()));
314  connect(d_act[7], SIGNAL(triggered()), this, SLOT(getRTriangle()));
315  connect(d_act[8], SIGNAL(triggered()), this, SLOT(getCross()));
316  connect(d_act[9], SIGNAL(triggered()), this, SLOT(getXCross()));
317  connect(d_act[10], SIGNAL(triggered()), this, SLOT(getHLine()));
318  connect(d_act[11], SIGNAL(triggered()), this, SLOT(getVLine()));
319  connect(d_act[12], SIGNAL(triggered()), this, SLOT(getStar1()));
320  connect(d_act[13], SIGNAL(triggered()), this, SLOT(getStar2()));
321  connect(d_act[14], SIGNAL(triggered()), this, SLOT(getHexagon()));
322 
323  QListIterator<QAction*> i(d_act);
324  while(i.hasNext()) {
325  QAction *a = i.next();
326  a->setCheckable(true);
327  a->setActionGroup(d_grp);
328  addAction(a);
329  }
330  }
331 
333  {}
334 
335  int getNumActions() const
336  {
337  return d_act.size();
338  }
339 
340  QAction * getAction(int which)
341  {
342  if(which < d_act.size())
343  return d_act[which];
344  else
345  throw std::runtime_error("LineMarkerMenu::getAction: which out of range.\n");
346  }
347 
348 signals:
349  void whichTrigger(int which, QwtSymbol::Style);
350 
351 public slots:
352  void getNone() { emit whichTrigger(d_which, QwtSymbol::NoSymbol); }
353  void getCircle() { emit whichTrigger(d_which, QwtSymbol::Ellipse); }
354  void getRect() { emit whichTrigger(d_which, QwtSymbol::Rect); }
355  void getDiamond() { emit whichTrigger(d_which, QwtSymbol::Diamond); }
356  void getTriangle() { emit whichTrigger(d_which, QwtSymbol::Triangle); }
357  void getDTriangle() { emit whichTrigger(d_which, QwtSymbol::DTriangle); }
358  void getLTriangle() { emit whichTrigger(d_which, QwtSymbol::LTriangle); }
359  void getRTriangle() { emit whichTrigger(d_which, QwtSymbol::RTriangle); }
360  void getCross() { emit whichTrigger(d_which, QwtSymbol::Cross); }
361  void getXCross() { emit whichTrigger(d_which, QwtSymbol::XCross); }
362  void getHLine() { emit whichTrigger(d_which, QwtSymbol::HLine); }
363  void getVLine() { emit whichTrigger(d_which, QwtSymbol::VLine); }
364  void getStar1() { emit whichTrigger(d_which, QwtSymbol::Star1); }
365  void getStar2() { emit whichTrigger(d_which, QwtSymbol::Star2); }
366  void getHexagon() { emit whichTrigger(d_which, QwtSymbol::Hexagon); }
367 
368 private:
369  QActionGroup *d_grp;
370  QList<QAction *> d_act;
371  int d_which;
372 };
373 
374 
375 /********************************************************************/
376 
377 
378 class MarkerAlphaMenu: public QMenu
379 {
380  Q_OBJECT
381 
382 public:
383  MarkerAlphaMenu(int which, QWidget *parent)
384  : QMenu("Line Transparency", parent), d_which(which)
385  {
386  d_grp = new QActionGroup(this);
387 
388  d_act.push_back(new QAction("None", this));
389  d_act.push_back(new QAction("Low", this));
390  d_act.push_back(new QAction("Medium", this));
391  d_act.push_back(new QAction("High", this));
392  d_act.push_back(new QAction("Off", this));
393 
394  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getNone()));
395  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getLow()));
396  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getMedium()));
397  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getHigh()));
398  connect(d_act[4], SIGNAL(triggered()), this, SLOT(getOff()));
399 
400  QListIterator<QAction*> i(d_act);
401  while(i.hasNext()) {
402  QAction *a = i.next();
403  a->setCheckable(true);
404  a->setActionGroup(d_grp);
405  addAction(a);
406  }
407  }
408 
410  {}
411 
412  int getNumActions() const
413  {
414  return d_act.size();
415  }
416 
417  QAction * getAction(int which)
418  {
419  if(which < d_act.size())
420  return d_act[which];
421  else
422  throw std::runtime_error("MarkerAlphaMenu::getAction: which out of range.\n");
423  }
424 
425 signals:
426  void whichTrigger(int which, int);
427 
428 public slots:
429  void getNone() { emit whichTrigger(d_which, 255); }
430  void getLow() { emit whichTrigger(d_which, 200); }
431  void getMedium() { emit whichTrigger(d_which, 125); }
432  void getHigh() { emit whichTrigger(d_which, 50); }
433  void getOff() { emit whichTrigger(d_which, 0); }
434 
435 private:
436  QActionGroup *d_grp;
437  QList<QAction *> d_act;
438  int d_which;
439 };
440 
441 
442 /********************************************************************/
443 
444 
445 class LineTitleAction: public QAction
446 {
447  Q_OBJECT
448 
449 public:
450  LineTitleAction(int which, QWidget *parent)
451  : QAction("Line Title", parent), d_which(which)
452  {
453  d_diag = new QDialog(parent);
454  d_diag->setModal(true);
455 
456  d_text = new QLineEdit();
457 
458  QGridLayout *layout = new QGridLayout(d_diag);
459  QPushButton *btn_ok = new QPushButton(tr("OK"));
460  QPushButton *btn_cancel = new QPushButton(tr("Cancel"));
461 
462  layout->addWidget(d_text, 0, 0, 1, 2);
463  layout->addWidget(btn_ok, 1, 0);
464  layout->addWidget(btn_cancel, 1, 1);
465 
466  connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
467  connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
468 
469  connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
470  }
471 
473  {}
474 
475 signals:
476  void whichTrigger(int which, const QString &text);
477 
478 public slots:
479  void getTextDiag()
480  {
481  d_diag->exec();
482  }
483 
484 private slots:
485  void getText()
486  {
487  emit whichTrigger(d_which, d_text->text());
488  d_diag->accept();
489  }
490 
491 private:
492  int d_which;
493 
494  QDialog *d_diag;
495  QLineEdit *d_text;
496 };
497 
498 
499 /********************************************************************/
500 
501 
502 class OtherAction: public QAction
503 {
504  Q_OBJECT
505 
506 public:
507  OtherAction(QWidget *parent)
508  : QAction("Other", parent)
509  {
510  d_diag = new QDialog(parent);
511  d_diag->setWindowTitle("Other");
512  d_diag->setModal(true);
513 
514  d_text = new QLineEdit();
515 
516  QGridLayout *layout = new QGridLayout(d_diag);
517  QPushButton *btn_ok = new QPushButton(tr("OK"));
518  QPushButton *btn_cancel = new QPushButton(tr("Cancel"));
519 
520  layout->addWidget(d_text, 0, 0, 1, 2);
521  layout->addWidget(btn_ok, 1, 0);
522  layout->addWidget(btn_cancel, 1, 1);
523 
524  connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
525  connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
526 
527  connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
528  }
529 
531  {}
532 
533  void setValidator(QValidator *v)
534  {
535  d_text->setValidator(v);
536  }
537 
538  void setDiagText(QString text)
539  {
540  d_text->setText(text);
541  }
542 
543 signals:
544  void whichTrigger(const QString &text);
545 
546 public slots:
547  void getTextDiag()
548  {
549  d_diag->exec();
550  }
551 
552 private slots:
553  void getText()
554  {
555  emit whichTrigger(d_text->text());
556  d_diag->accept();
557  }
558 
559 private:
560  QDialog *d_diag;
561  QLineEdit *d_text;
562 };
563 
564 /********************************************************************/
565 
566 
567 class OtherDualAction: public QAction
568 {
569  Q_OBJECT
570 
571 public:
572  OtherDualAction(QString label0, QString label1, QWidget *parent)
573  : QAction("Other", parent)
574  {
575  d_diag = new QDialog(parent);
576  d_diag->setWindowTitle("Other");
577  d_diag->setModal(true);
578 
579  d_text0 = new QLineEdit();
580  d_text1 = new QLineEdit();
581 
582  QLabel *_label0 = new QLabel(label0);
583  QLabel *_label1 = new QLabel(label1);
584 
585  QGridLayout *layout = new QGridLayout(d_diag);
586  QPushButton *btn_ok = new QPushButton(tr("OK"));
587  QPushButton *btn_cancel = new QPushButton(tr("Cancel"));
588 
589  layout->addWidget(_label0, 0, 0, 1, 2);
590  layout->addWidget(_label1, 1, 0, 1, 2);
591 
592  layout->addWidget(d_text0, 0, 1, 1, 2);
593  layout->addWidget(d_text1, 1, 1, 1, 2);
594  layout->addWidget(btn_ok, 2, 0);
595  layout->addWidget(btn_cancel, 2, 1);
596 
597  connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
598  connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
599 
600  connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
601  }
602 
604  {}
605 
606 signals:
607  void whichTrigger(const QString &text0, const QString &text1);
608 
609 public slots:
610  void getTextDiag()
611  {
612  d_diag->exec();
613  }
614 
615 private slots:
616  void getText()
617  {
618  emit whichTrigger(d_text0->text(), d_text1->text());
619  d_diag->accept();
620  }
621 
622 private:
623  QDialog *d_diag;
624  QLineEdit *d_text0;
625  QLineEdit *d_text1;
626 };
627 
628 
629 /********************************************************************/
630 
631 
632 class FFTSizeMenu: public QMenu
633 {
634  Q_OBJECT
635 
636 public:
637  FFTSizeMenu(QWidget *parent)
638  : QMenu("FFT Size", parent)
639  {
640  d_grp = new QActionGroup(this);
641 
642  d_act.push_back(new QAction("32", this));
643  d_act.push_back(new QAction("64", this));
644  d_act.push_back(new QAction("128", this));
645  d_act.push_back(new QAction("256", this));
646  d_act.push_back(new QAction("512", this));
647  d_act.push_back(new QAction("1024", this));
648  d_act.push_back(new QAction("2048", this));
649  d_act.push_back(new QAction("4096", this));
650  //d_act.push_back(new QAction("8192", this));
651  //d_act.push_back(new QAction("16384", this));
652  //d_act.push_back(new QAction("32768", this));
653  d_act.push_back(new OtherAction(this));
654 
655  d_grp = new QActionGroup(this);
656  for(int t = 0; t < d_act.size(); t++) {
657  d_act[t]->setCheckable(true);
658  d_act[t]->setActionGroup(d_grp);
659  }
660 
661  QIntValidator *valid = new QIntValidator(32, 4096, this);
662  ((OtherAction*)d_act[d_act.size()-1])->setValidator(valid);
663 
664  connect(d_act[0], SIGNAL(triggered()), this, SLOT(get05()));
665  connect(d_act[1], SIGNAL(triggered()), this, SLOT(get06()));
666  connect(d_act[2], SIGNAL(triggered()), this, SLOT(get07()));
667  connect(d_act[3], SIGNAL(triggered()), this, SLOT(get08()));
668  connect(d_act[4], SIGNAL(triggered()), this, SLOT(get09()));
669  connect(d_act[5], SIGNAL(triggered()), this, SLOT(get10()));
670  connect(d_act[6], SIGNAL(triggered()), this, SLOT(get11()));
671  connect(d_act[7], SIGNAL(triggered()), this, SLOT(get12()));
672  //connect(d_act[8], SIGNAL(triggered()), this, SLOT(get13()));
673  //connect(d_act[9], SIGNAL(triggered()), this, SLOT(get14()));
674  //connect(d_act[10], SIGNAL(triggered()), this, SLOT(get15()));
675  connect(d_act[8], SIGNAL(whichTrigger(const QString&)),
676  this, SLOT(getOther(const QString&)));
677 
678  QListIterator<QAction*> i(d_act);
679  while(i.hasNext()) {
680  QAction *a = i.next();
681  a->setCheckable(true);
682  a->setActionGroup(d_grp);
683  addAction(a);
684  }
685  }
686 
688  {}
689 
690  int getNumActions() const
691  {
692  return d_act.size();
693  }
694 
695  QAction * getAction(int which)
696  {
697  if(which < d_act.size())
698  return d_act[which];
699  else
700  throw std::runtime_error("FFTSizeMenu::getAction: which out of range.\n");
701  }
702 
703  QAction * getActionFromSize(int size)
704  {
705  float ipt;
706  float which = std::log(static_cast<float>(size))/std::log(2.0f) - 5;
707  // If we're a predefined value
708  if(std::modf(which,&ipt) == 0) {
709  if(which < d_act.size()-1)
710  return d_act[static_cast<int>(which)];
711  else
712  throw std::runtime_error("FFTSizeMenu::getActionFromString: which out of range.\n");
713  }
714  // Or a non-predefined value, return Other
715  else {
716  ((OtherAction*)d_act[d_act.size()-1])->setDiagText(QString().setNum(size));
717  return d_act[d_act.size()-1];
718  }
719  }
720 
721 signals:
722  void whichTrigger(int size);
723 
724 public slots:
725  void get05() { emit whichTrigger(32); }
726  void get06() { emit whichTrigger(64); }
727  void get07() { emit whichTrigger(128); }
728  void get08() { emit whichTrigger(256); }
729  void get09() { emit whichTrigger(512); }
730  void get10() { emit whichTrigger(1024); }
731  void get11() { emit whichTrigger(2048); }
732  void get12() { emit whichTrigger(4096); }
733  //void get13() { emit whichTrigger(8192); }
734  //void get14() { emit whichTrigger(16384); }
735  //void get15() { emit whichTrigger(32768); }
736  void getOther(const QString &str)
737  {
738  int value = str.toInt();
739  emit whichTrigger(value);
740  }
741 
742 private:
743  QList<QAction *> d_act;
744  OtherAction *d_other;
745  QActionGroup *d_grp;
746 };
747 
748 /********************************************************************/
749 
750 class AverageMenu: public QMenu
751 {
752  Q_OBJECT
753 
754 public:
755  AverageMenu(const std::string &menuTitle, QWidget *parent)
756  : QMenu(menuTitle.c_str(), parent)
757  {
758  d_grp = new QActionGroup(this);
759 
760  d_off = 1.0;
761  d_high = 0.05;
762  d_medium = 0.1;
763  d_low = 0.2;
764 
765  d_act.push_back(new QAction("Off", this));
766  d_act.push_back(new QAction("High", this));
767  d_act.push_back(new QAction("Medium", this));
768  d_act.push_back(new QAction("Low", this));
769  d_act.push_back(new OtherAction(this));
770 
771  d_grp = new QActionGroup(this);
772  for(int t = 0; t < d_act.size(); t++) {
773  d_act[t]->setCheckable(true);
774  d_act[t]->setActionGroup(d_grp);
775  }
776  d_act[0]->setChecked(true);
777 
778  QDoubleValidator *valid = new QDoubleValidator(0.0, 1.0, 3, this);
779  ((OtherAction*)d_act[d_act.size()-1])->setValidator(valid);
780 
781  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getOff()));
782  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getHigh()));
783  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getMedium()));
784  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getLow()));
785  connect(d_act[4], SIGNAL(whichTrigger(const QString&)),
786  this, SLOT(getOther(const QString&)));
787 
788  QListIterator<QAction*> i(d_act);
789  while(i.hasNext()) {
790  QAction *a = i.next();
791  a->setCheckable(true);
792  a->setActionGroup(d_grp);
793  addAction(a);
794  }
795  }
796 
798  {}
799 
800  int getNumActions() const
801  {
802  return d_act.size();
803  }
804 
805  QAction * getAction(int which)
806  {
807  if(which < d_act.size())
808  return d_act[which];
809  else
810  throw std::runtime_error("FFTSizeMenu::getAction: which out of range.\n");
811  }
812 
813  QAction * getActionFromAvg(float avg)
814  {
815  int which = 0;
816  if(avg == d_off)
817  which = 0;
818  else if(avg == d_high)
819  which = 1;
820  else if(avg == d_medium)
821  which = 2;
822  else if(avg == d_low)
823  which = 3;
824  else {
825  ((OtherAction*)d_act[d_act.size()-1])->setDiagText(QString().setNum(avg));
826  which = 4;
827  }
828  return d_act[static_cast<int>(which)];
829  }
830 
831  void setHigh(float x)
832  {
833  d_high = x;
834  }
835 
836  void setMedium(float x)
837  {
838  d_medium = x;
839  }
840 
841  void setLow(float x)
842  {
843  d_low = x;
844  }
845 
846  signals:
847  void whichTrigger(float alpha);
848 
849  public slots:
850  void getOff() { emit whichTrigger(d_off); }
851  void getHigh() { emit whichTrigger(d_high); }
852  void getMedium() { emit whichTrigger(d_medium); }
853  void getLow() { emit whichTrigger(d_low); }
854  void getOther(const QString &str)
855  {
856  float value = str.toFloat();
857  emit whichTrigger(value);
858  }
859 
860 private:
861  QList<QAction *> d_act;
862  OtherAction *d_other;
863  QActionGroup *d_grp;
864  float d_off, d_high, d_medium, d_low;
865 };
866 
867 /********************************************************************/
868 
870 {
871 public:
872  FFTAverageMenu(QWidget *parent) : AverageMenu("FFT Average", parent)
873  {
874  // nop
875  }
876 
878 };
879 
880 /********************************************************************/
881 
882 
883 class FFTWindowMenu: public QMenu
884 {
885  Q_OBJECT
886 
887 public:
888  FFTWindowMenu(QWidget *parent)
889  : QMenu("FFT Window", parent)
890  {
891  d_act.push_back(new QAction("None", this));
892  d_act.push_back(new QAction("Hamming", this));
893  d_act.push_back(new QAction("Hann", this));
894  d_act.push_back(new QAction("Blackman", this));
895  d_act.push_back(new QAction("Blackman-harris", this));
896  d_act.push_back(new QAction("Rectangular", this));
897  d_act.push_back(new QAction("Kaiser", this));
898  d_act.push_back(new QAction("Flat-top", this));
899 
900  d_grp = new QActionGroup(this);
901  for(int t = 0; t < d_act.size(); t++) {
902  d_act[t]->setCheckable(true);
903  d_act[t]->setActionGroup(d_grp);
904  }
905 
906  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getNone()));
907  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getHamming()));
908  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getHann()));
909  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getBlackman()));
910  connect(d_act[4], SIGNAL(triggered()), this, SLOT(getBlackmanharris()));
911  connect(d_act[5], SIGNAL(triggered()), this, SLOT(getRectangular()));
912  connect(d_act[6], SIGNAL(triggered()), this, SLOT(getKaiser()));
913  connect(d_act[7], SIGNAL(triggered()), this, SLOT(getFlattop()));
914 
915  QListIterator<QAction*> i(d_act);
916  while(i.hasNext()) {
917  QAction *a = i.next();
918  addAction(a);
919  }
920  }
921 
923  {}
924 
925  int getNumActions() const
926  {
927  return d_act.size();
928  }
929 
930  QAction * getAction(int which)
931  {
932  if(which < d_act.size())
933  return d_act[which];
934  else
935  throw std::runtime_error("FFTWindowMenu::getAction: which out of range.\n");
936  }
937 
939  {
940  int which = 0;
941  switch(static_cast<int>(type)) {
942  case((gr::filter::firdes::WIN_NONE)): which = 0; break;
943  case((gr::filter::firdes::WIN_HAMMING)): which = 1; break;
944  case((gr::filter::firdes::WIN_HANN)): which = 2; break;
945  case((gr::filter::firdes::WIN_BLACKMAN)): which = 3; break;
946  case((gr::filter::firdes::WIN_BLACKMAN_hARRIS)): which = 4; break;
947  case((gr::filter::firdes::WIN_RECTANGULAR)): which = 5; break;
948  case((gr::filter::firdes::WIN_KAISER)): which = 6; break;
949  case((gr::filter::firdes::WIN_FLATTOP)): which = 7; break;
950  }
951  return d_act[which];
952  }
953 
954 signals:
956 
957 public slots:
966 
967 private:
968  QList<QAction *> d_act;
969  QActionGroup *d_grp;
970  int d_which;
971 };
972 
973 
974 /********************************************************************/
975 
976 
977 class NPointsMenu: public QAction
978 {
979  Q_OBJECT
980 
981 public:
982  NPointsMenu(QWidget *parent)
983  : QAction("Number of Points", parent)
984  {
985  d_diag = new QDialog(parent);
986  d_diag->setWindowTitle("Number of Points");
987  d_diag->setModal(true);
988 
989  d_text = new QLineEdit();
990 
991  QGridLayout *layout = new QGridLayout(d_diag);
992  QPushButton *btn_ok = new QPushButton(tr("OK"));
993  QPushButton *btn_cancel = new QPushButton(tr("Cancel"));
994 
995  layout->addWidget(d_text, 0, 0, 1, 2);
996  layout->addWidget(btn_ok, 1, 0);
997  layout->addWidget(btn_cancel, 1, 1);
998 
999  connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
1000  connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
1001 
1002  connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
1003  }
1004 
1006  {}
1007 
1008 signals:
1009  void whichTrigger(const int npts);
1010 
1011 public slots:
1012  void setDiagText(const int npts)
1013  {
1014  d_text->setText(QString().setNum(npts));
1015  }
1016 
1018  {
1019  d_diag->show();
1020  }
1021 
1022 private slots:
1023  void getText()
1024  {
1025  emit whichTrigger(d_text->text().toInt());
1026  d_diag->accept();
1027  }
1028 
1029 private:
1030  QDialog *d_diag;
1031  QLineEdit *d_text;
1032 };
1033 
1034 
1035 /********************************************************************/
1036 
1037 
1038 class ColorMapMenu: public QMenu
1039 {
1040  Q_OBJECT
1041 
1042 public:
1043  ColorMapMenu(int which, QWidget *parent)
1044  : QMenu("Color Map", parent), d_which(which)
1045  {
1046  d_grp = new QActionGroup(this);
1047 
1048  d_act.push_back(new QAction("Multi-Color", this));
1049  d_act.push_back(new QAction("White Hot", this));
1050  d_act.push_back(new QAction("Black Hot", this));
1051  d_act.push_back(new QAction("Incandescent", this));
1052  d_act.push_back(new QAction("Sunset", this));
1053  d_act.push_back(new QAction("Cool", this));
1054  d_act.push_back(new QAction("Other", this));
1055  //d_act.push_back(new OtherDualAction("Min Intensity: ", "Max Intensity: ", this));
1056 
1057  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getMultiColor()));
1058  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getWhiteHot()));
1059  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getBlackHot()));
1060  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getIncandescent()));
1061  connect(d_act[4], SIGNAL(triggered()), this, SLOT(getSunset()));
1062  connect(d_act[5], SIGNAL(triggered()), this, SLOT(getCool()));
1063  connect(d_act[6], SIGNAL(triggered()), this, SLOT(getOther()));
1064 
1065  QListIterator<QAction*> i(d_act);
1066  while(i.hasNext()) {
1067  QAction *a = i.next();
1068  a->setCheckable(true);
1069  a->setActionGroup(d_grp);
1070  addAction(a);
1071  }
1072 
1073  d_max_value = QColor("white");
1074  d_min_value = QColor("white");
1075  }
1076 
1078  {}
1079 
1080  int getNumActions() const
1081  {
1082  return d_act.size();
1083  }
1084 
1085  QAction * getAction(int which)
1086  {
1087  if(which < d_act.size())
1088  return d_act[which];
1089  else
1090  throw std::runtime_error("ColorMapMenu::getAction: which out of range.\n");
1091  }
1092 
1093  signals:
1094  void whichTrigger(int which, const int type,
1095  const QColor &min_color=QColor(),
1096  const QColor &max_color=QColor());
1097 
1098  public slots:
1105  //void getOther(d_which, const QString &min_str, const QString &max_str)
1106  void getOther()
1107  {
1108  QMessageBox::information(this, "Set low and high intensities",
1109  "In the next windows, select the low and then the high intensity colors.",
1110  QMessageBox::Ok);
1111  d_min_value = QColorDialog::getColor(d_min_value, this);
1112  d_max_value = QColorDialog::getColor(d_max_value, this);
1113 
1115  d_min_value, d_max_value);
1116  }
1117 
1118 private:
1119  QActionGroup *d_grp;
1120  QList<QAction *> d_act;
1121  OtherDualAction *d_other;
1122  QColor d_max_value, d_min_value;
1123  int d_which;
1124 };
1125 
1126 
1127 /********************************************************************/
1128 
1129 
1130 class TriggerModeMenu: public QMenu
1131 {
1132  Q_OBJECT
1133 
1134 public:
1135  TriggerModeMenu(QWidget *parent)
1136  : QMenu("Mode", parent)
1137  {
1138  d_grp = new QActionGroup(this);
1139  d_act.push_back(new QAction("Free", this));
1140  d_act.push_back(new QAction("Auto", this));
1141  d_act.push_back(new QAction("Normal", this));
1142  d_act.push_back(new QAction("Tag", this));
1143 
1144  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getFree()));
1145  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getAuto()));
1146  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getNorm()));
1147  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getTag()));
1148 
1149  QListIterator<QAction*> i(d_act);
1150  while(i.hasNext()) {
1151  QAction *a = i.next();
1152  a->setCheckable(true);
1153  a->setActionGroup(d_grp);
1154  addAction(a);
1155  }
1156  }
1157 
1159  {}
1160 
1161  int getNumActions() const
1162  {
1163  return d_act.size();
1164  }
1165 
1166  QAction * getAction(int which)
1167  {
1168  if(which < d_act.size())
1169  return d_act[which];
1170  else
1171  throw std::runtime_error("TriggerModeMenu::getAction: which out of range.\n");
1172  }
1173 
1175  {
1176  switch(mode) {
1178  return d_act[0];
1179  break;
1181  return d_act[1];
1182  break;
1184  return d_act[2];
1185  break;
1187  return d_act[3];
1188  break;
1189  default:
1190  throw std::runtime_error("TriggerModeMenu::getAction: unknown trigger mode.\n");
1191  }
1192  }
1193 
1194 signals:
1196 
1197 public slots:
1202 
1203 private:
1204  QList<QAction *> d_act;
1205  QActionGroup *d_grp;
1206 };
1207 
1208 
1209 /********************************************************************/
1210 
1211 
1212 class TriggerSlopeMenu: public QMenu
1213 {
1214  Q_OBJECT
1215 
1216 public:
1217  TriggerSlopeMenu(QWidget *parent)
1218  : QMenu("Slope", parent)
1219  {
1220  d_grp = new QActionGroup(this);
1221  d_act.push_back(new QAction("Positive", this));
1222  d_act.push_back(new QAction("Negative", this));
1223 
1224  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getPos()));
1225  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getNeg()));
1226 
1227  QListIterator<QAction*> i(d_act);
1228  while(i.hasNext()) {
1229  QAction *a = i.next();
1230  a->setCheckable(true);
1231  a->setActionGroup(d_grp);
1232  addAction(a);
1233  }
1234  }
1235 
1237  {}
1238 
1239  int getNumActions() const
1240  {
1241  return d_act.size();
1242  }
1243 
1244  QAction * getAction(int which)
1245  {
1246  if(which < d_act.size())
1247  return d_act[which];
1248  else
1249  throw std::runtime_error("TriggerSlopeMenu::getAction: which out of range.\n");
1250  }
1251 
1253  {
1254  switch(slope) {
1256  return d_act[0];
1257  break;
1259  return d_act[1];
1260  break;
1261  default:
1262  throw std::runtime_error("TriggerSlopeMenu::getAction: unknown trigger slope.\n");
1263  }
1264  }
1265 
1266 signals:
1268 
1269 public slots:
1272 
1273 private:
1274  QList<QAction *> d_act;
1275  QActionGroup *d_grp;
1276 };
1277 
1278 
1279 /********************************************************************/
1280 
1281 
1282 class TriggerChannelMenu: public QMenu
1283 {
1284  Q_OBJECT
1285 
1286 public:
1287  TriggerChannelMenu(int nchans, QWidget *parent)
1288  : QMenu("Channel", parent)
1289  {
1290  d_grp = new QActionGroup(this);
1291  for(int i = 0; i < nchans; i++) {
1292  d_act.push_back(new QAction(QString().setNum(i), this));
1293  d_act[i]->setCheckable(true);
1294  d_act[i]->setActionGroup(d_grp);
1295 
1296  addAction(d_act[i]);
1297  connect(d_act[i], SIGNAL(triggered()), this, SLOT(getChannel()));
1298  }
1299  }
1300 
1302  {}
1303 
1304  int getNumActions() const
1305  {
1306  return d_act.size();
1307  }
1308 
1309  QAction * getAction(int which)
1310  {
1311  if(which < d_act.size())
1312  return d_act[which];
1313  else
1314  throw std::runtime_error("TriggerChannelMenu::getAction: which out of range.\n");
1315  }
1316 
1317 
1318 signals:
1319  void whichTrigger(int n);
1320 
1321 public slots:
1322  void getChannel()
1323  {
1324  QAction *a = d_grp->checkedAction();
1325  int which = a->text().toInt();
1326  emit whichTrigger(which);
1327  }
1328 
1329 private:
1330  QList<QAction *> d_act;
1331  QActionGroup *d_grp;
1332 };
1333 
1334 
1335 /********************************************************************/
1336 
1337 
1338 class NumberLayoutMenu: public QMenu
1339 {
1340  Q_OBJECT
1341 
1342 public:
1343  NumberLayoutMenu(QWidget *parent)
1344  : QMenu("Layout", parent)
1345  {
1346  d_grp = new QActionGroup(this);
1347  d_act.push_back(new QAction("Horizontal", this));
1348  d_act.push_back(new QAction("Vertical", this));
1349  d_act.push_back(new QAction("None", this));
1350 
1351  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getHoriz()));
1352  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getVert()));
1353  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getNone()));
1354 
1355  QListIterator<QAction*> i(d_act);
1356  while(i.hasNext()) {
1357  QAction *a = i.next();
1358  a->setCheckable(true);
1359  a->setActionGroup(d_grp);
1360  addAction(a);
1361  }
1362  }
1363 
1365  {}
1366 
1367  int getNumActions() const
1368  {
1369  return d_act.size();
1370  }
1371 
1372  QAction * getAction(int which)
1373  {
1374  if(which < d_act.size())
1375  return d_act[which];
1376  else
1377  throw std::runtime_error("NumberLayoutMenu::getAction: which out of range.\n");
1378  }
1379 
1380  QAction * getAction(gr::qtgui::graph_t layout)
1381  {
1382  switch(layout) {
1384  return d_act[0];
1385  break;
1387  return d_act[1];
1388  break;
1390  return d_act[1];
1391  break;
1392  default:
1393  throw std::runtime_error("NumberLayoutMenu::getAction: unknown layout type.\n");
1394  }
1395  }
1396 
1397 signals:
1398  void whichTrigger(gr::qtgui::graph_t layout);
1399 
1400 public slots:
1404 
1405 private:
1406  QList<QAction *> d_act;
1407  QActionGroup *d_grp;
1408 };
1409 
1410 
1411 /********************************************************************/
1412 
1413 
1414 class NumberColorMapMenu: public QMenu
1415 {
1416  Q_OBJECT
1417 
1418 public:
1419  NumberColorMapMenu(int which, QWidget *parent)
1420  : QMenu("Color Map", parent), d_which(which)
1421  {
1422  d_grp = new QActionGroup(this);
1423 
1424  d_act.push_back(new QAction("Black", this));
1425  d_act.push_back(new QAction("Blue-Red", this));
1426  d_act.push_back(new QAction("White Hot", this));
1427  d_act.push_back(new QAction("Black Hot", this));
1428  d_act.push_back(new QAction("Black-Red", this));
1429  d_act.push_back(new QAction("Other", this));
1430 
1431  connect(d_act[0], SIGNAL(triggered()), this, SLOT(getBlack()));
1432  connect(d_act[1], SIGNAL(triggered()), this, SLOT(getBlueRed()));
1433  connect(d_act[2], SIGNAL(triggered()), this, SLOT(getWhiteHot()));
1434  connect(d_act[3], SIGNAL(triggered()), this, SLOT(getBlackHot()));
1435  connect(d_act[4], SIGNAL(triggered()), this, SLOT(getBlackRed()));
1436  connect(d_act[5], SIGNAL(triggered()), this, SLOT(getOther()));
1437 
1438  QListIterator<QAction*> i(d_act);
1439  while(i.hasNext()) {
1440  QAction *a = i.next();
1441  a->setCheckable(true);
1442  a->setActionGroup(d_grp);
1443  addAction(a);
1444  }
1445 
1446  d_max_value = QColor("black");
1447  d_min_value = QColor("black");
1448  }
1449 
1451  {}
1452 
1453  int getNumActions() const
1454  {
1455  return d_act.size();
1456  }
1457 
1458  QAction * getAction(int which)
1459  {
1460  if(which < d_act.size())
1461  return d_act[which];
1462  else
1463  throw std::runtime_error("ColorMapMenu::getAction: which out of range.\n");
1464  }
1465 
1466  signals:
1467  void whichTrigger(int which,
1468  const QColor &min_color,
1469  const QColor &max_color);
1470 
1471  public slots:
1472  void getBlack() { emit whichTrigger(d_which, QColor("black"), QColor("black")); }
1473  void getBlueRed() { emit whichTrigger(d_which, QColor("blue"), QColor("red")); }
1474  void getWhiteHot() { emit whichTrigger(d_which, QColor("black"), QColor("white")); }
1475  void getBlackHot() { emit whichTrigger(d_which, QColor("white"), QColor("black")); }
1476  void getBlackRed() { emit whichTrigger(d_which, QColor("black"), QColor("red")); }
1477  void getOther()
1478  {
1479  QMessageBox::information(this, "Set low and high intensities",
1480  "In the next windows, select the low and then the high intensity colors.",
1481  QMessageBox::Ok);
1482  d_min_value = QColorDialog::getColor(d_min_value, this);
1483  d_max_value = QColorDialog::getColor(d_max_value, this);
1484 
1485  emit whichTrigger(d_which, d_min_value, d_max_value);
1486  }
1487 
1488 private:
1489  QActionGroup *d_grp;
1490  QList<QAction *> d_act;
1491  QColor d_max_value, d_min_value;
1492  int d_which;
1493 };
1494 
1495 
1496 /********************************************************************/
1497 
1498 
1499 class PopupMenu: public QAction
1500 {
1501  Q_OBJECT
1502 
1503 public:
1504  PopupMenu(QString desc, QWidget *parent)
1505  : QAction(desc, parent)
1506  {
1507  d_diag = new QDialog(parent);
1508  d_diag->setWindowTitle(desc);
1509  d_diag->setModal(true);
1510 
1511  d_text = new QLineEdit();
1512 
1513  QGridLayout *layout = new QGridLayout(d_diag);
1514  QPushButton *btn_ok = new QPushButton(tr("OK"));
1515  QPushButton *btn_cancel = new QPushButton(tr("Cancel"));
1516 
1517  layout->addWidget(d_text, 0, 0, 1, 2);
1518  layout->addWidget(btn_ok, 1, 0);
1519  layout->addWidget(btn_cancel, 1, 1);
1520 
1521  connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
1522  connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
1523 
1524  connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
1525  }
1526 
1528  {}
1529 
1530  void setText(QString s)
1531  {
1532  d_text->setText(s);
1533  }
1534 
1535 signals:
1536  void whichTrigger(const QString data);
1537 
1538 public slots:
1540  {
1541  d_diag->show();
1542  }
1543 
1544 private slots:
1545  void getText()
1546  {
1547  emit whichTrigger(d_text->text());
1548  d_diag->accept();
1549  }
1550 
1551 private:
1552  QDialog *d_diag;
1553  QLineEdit *d_text;
1554 };
1555 
1556 
1557 /********************************************************************/
1558 
1559 
1560 class ItemFloatAct: public QAction
1561 {
1562  Q_OBJECT
1563 
1564 public:
1565  ItemFloatAct(int which, QString title, QWidget *parent)
1566  : QAction(title, parent), d_which(which)
1567  {
1568  d_diag = new QDialog(parent);
1569  d_diag->setWindowTitle(title);
1570  d_diag->setModal(true);
1571 
1572  d_text = new QLineEdit();
1573 
1574  QGridLayout *layout = new QGridLayout(d_diag);
1575  QPushButton *btn_ok = new QPushButton(tr("OK"));
1576  QPushButton *btn_cancel = new QPushButton(tr("Cancel"));
1577 
1578  layout->addWidget(d_text, 0, 0, 1, 2);
1579  layout->addWidget(btn_ok, 1, 0);
1580  layout->addWidget(btn_cancel, 1, 1);
1581 
1582  connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
1583  connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
1584 
1585  connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
1586  }
1587 
1589  {}
1590 
1591  void setText(float f)
1592  {
1593  d_text->setText(QString("%1").arg(f));
1594  }
1595 
1596 
1597 signals:
1598  void whichTrigger(int which, float data);
1599 
1600 public slots:
1602  {
1603  d_diag->show();
1604  }
1605 
1606 private slots:
1607  void getText()
1608  {
1609  emit whichTrigger(d_which, d_text->text().toFloat());
1610  d_diag->accept();
1611  }
1612 
1613 private:
1614  int d_which;
1615  QDialog *d_diag;
1616  QLineEdit *d_text;
1617 };
1618 
1619 
1620 
1621 /********************************************************************/
1622 
1623 
1624 #endif /* FORM_MENUS_H */
void getYellow()
Definition: form_menus.h:112
QAction * getAction(int which)
Definition: form_menus.h:930
void getNone()
Definition: form_menus.h:1403
OtherAction(QWidget *parent)
Definition: form_menus.h:507
Definition: form_menus.h:1338
void getDarkRed()
Definition: form_menus.h:114
Definition: qtgui_types.h:162
QAction * getAction(int which)
Definition: form_menus.h:1166
void getDarkBlue()
Definition: form_menus.h:116
Definition: gr-qtgui/include/gnuradio/qtgui/trigger_mode.h:38
void getLow()
Definition: form_menus.h:430
Hann window; max attenuation 44 dB.
Definition: firdes.h:48
void getBlue()
Definition: form_menus.h:106
QAction * getAction(int which)
Definition: form_menus.h:1309
QAction * getAction(int which)
Definition: form_menus.h:417
void getEight()
Definition: form_menus.h:197
TriggerModeMenu(QWidget *parent)
Definition: form_menus.h:1135
Definition: form_menus.h:1130
void whichTrigger(int which, const QString &name)
Hamming window; max attenuation 53 dB.
Definition: firdes.h:47
int getNumActions() const
Definition: form_menus.h:1304
~AverageMenu()
Definition: form_menus.h:797
int getNumActions() const
Definition: form_menus.h:800
~OtherAction()
Definition: form_menus.h:530
void getTextDiag()
Definition: form_menus.h:610
void getDash()
Definition: form_menus.h:266
void getDiamond()
Definition: form_menus.h:355
void get05()
Definition: form_menus.h:725
QAction * getAction(gr::qtgui::trigger_slope slope)
Definition: form_menus.h:1252
Definition: form_menus.h:1499
QAction * getAction(int which)
Definition: form_menus.h:1085
void getNone()
Definition: form_menus.h:958
LineWidthMenu(int which, QWidget *parent)
Definition: form_menus.h:134
PopupMenu(QString desc, QWidget *parent)
Definition: form_menus.h:1504
void getTextDiag()
Definition: form_menus.h:1601
void getOne()
Definition: form_menus.h:190
void getOther(const QString &str)
Definition: form_menus.h:736
~FFTWindowMenu()
Definition: form_menus.h:922
Definition: qtgui_types.h:176
~PopupMenu()
Definition: form_menus.h:1527
void getPos()
Definition: form_menus.h:1270
int getNumActions() const
Definition: form_menus.h:1239
NumberLayoutMenu(QWidget *parent)
Definition: form_menus.h:1343
void getTen()
Definition: form_menus.h:199
void get10()
Definition: form_menus.h:730
void getOther(const QString &str)
Definition: form_menus.h:854
TriggerSlopeMenu(QWidget *parent)
Definition: form_menus.h:1217
void getNorm()
Definition: form_menus.h:1200
Definition: form_menus.h:445
void getBlack()
Definition: form_menus.h:109
void getTag()
Definition: form_menus.h:1201
Basic rectangular window.
Definition: firdes.h:50
~LineTitleAction()
Definition: form_menus.h:472
void setHigh(float x)
Definition: form_menus.h:831
Definition: form_menus.h:977
FFTSizeMenu(QWidget *parent)
Definition: form_menus.h:637
void get08()
Definition: form_menus.h:728
void getCircle()
Definition: form_menus.h:353
void getSix()
Definition: form_menus.h:195
~LineStyleMenu()
Definition: form_menus.h:244
int getNumActions() const
Definition: form_menus.h:173
QAction * getActionFromWindow(gr::filter::firdes::win_type type)
Definition: form_menus.h:938
Definition: form_menus.h:502
void getDots()
Definition: form_menus.h:267
void getBlueRed()
Definition: form_menus.h:1473
QAction * getAction(int which)
Definition: form_menus.h:1244
QAction * getAction(int which)
Definition: form_menus.h:695
Definition: qtgui_types.h:173
void setValidator(QValidator *v)
Definition: form_menus.h:533
void getDarkGray()
Definition: form_menus.h:117
void getHann()
Definition: form_menus.h:960
Definition: form_menus.h:211
void getGray()
Definition: form_menus.h:113
Definition: gr-qtgui/include/gnuradio/qtgui/trigger_mode.h:37
int getNumActions() const
Definition: form_menus.h:1080
void getHoriz()
Definition: form_menus.h:1401
Kaiser window; max attenuation a function of beta, google it.
Definition: firdes.h:51
int getNumActions() const
Definition: form_menus.h:690
void getHigh()
Definition: form_menus.h:851
graph_t
Definition: qtgui_types.h:160
void getFree()
Definition: form_menus.h:1198
Definition: form_menus.h:378
LineStyleMenu(int which, QWidget *parent)
Definition: form_menus.h:216
Definition: form_menus.h:1212
QAction * getAction(int which)
Definition: form_menus.h:94
Definition: form_menus.h:869
void getCross()
Definition: form_menus.h:360
void get06()
Definition: form_menus.h:726
void getGreen()
Definition: form_menus.h:108
void getFlattop()
Definition: form_menus.h:965
void getVert()
Definition: form_menus.h:1402
int getNumActions() const
Definition: form_menus.h:335
Definition: form_menus.h:567
~NPointsMenu()
Definition: form_menus.h:1005
void getBlack()
Definition: form_menus.h:1472
void getTextDiag()
Definition: form_menus.h:547
Definition: gr-qtgui/include/gnuradio/qtgui/trigger_mode.h:31
void getNine()
Definition: form_menus.h:198
int getNumActions() const
Definition: form_menus.h:925
void getBlackman()
Definition: form_menus.h:961
Definition: cc_common.h:45
QAction * getActionFromSize(int size)
Definition: form_menus.h:703
~MarkerAlphaMenu()
Definition: form_menus.h:409
TriggerChannelMenu(int nchans, QWidget *parent)
Definition: form_menus.h:1287
void getWhiteHot()
Definition: form_menus.h:1100
void getNone()
Definition: form_menus.h:429
void get11()
Definition: form_menus.h:731
Definition: qtgui_types.h:175
don&#39;t use a window
Definition: firdes.h:46
OtherDualAction(QString label0, QString label1, QWidget *parent)
Definition: form_menus.h:572
~LineMarkerMenu()
Definition: form_menus.h:332
~LineWidthMenu()
Definition: form_menus.h:170
QAction * getAction(gr::qtgui::trigger_mode mode)
Definition: form_menus.h:1174
Definition: qtgui_types.h:177
void getVLine()
Definition: form_menus.h:363
void setDiagText(QString text)
Definition: form_menus.h:538
Definition: form_menus.h:632
~FFTAverageMenu()
Definition: form_menus.h:877
~ColorMapMenu()
Definition: form_menus.h:1077
flat top window; useful in FFTs
Definition: firdes.h:55
~ItemFloatAct()
Definition: form_menus.h:1588
Definition: form_menus.h:883
void getWhiteHot()
Definition: form_menus.h:1474
void setDiagText(const int npts)
Definition: form_menus.h:1012
void getBlackHot()
Definition: form_menus.h:1475
Definition: qtgui_types.h:172
Definition: gr-qtgui/include/gnuradio/qtgui/trigger_mode.h:30
QAction * getActionFromAvg(float avg)
Definition: form_menus.h:813
Definition: qtgui_types.h:174
trigger_slope
Definition: gr-qtgui/include/gnuradio/qtgui/trigger_mode.h:36
trigger_mode
Definition: gr-qtgui/include/gnuradio/qtgui/trigger_mode.h:29
void getRectangular()
Definition: form_menus.h:963
~TriggerSlopeMenu()
Definition: form_menus.h:1236
ItemFloatAct(int which, QString title, QWidget *parent)
Definition: form_menus.h:1565
Definition: gr-qtgui/include/gnuradio/qtgui/trigger_mode.h:33
Definition: form_menus.h:750
void getTextDiag()
Definition: form_menus.h:1539
NPointsMenu(QWidget *parent)
Definition: form_menus.h:982
Definition: qtgui_types.h:163
void getFour()
Definition: form_menus.h:193
void getNone()
Definition: form_menus.h:264
Blackman window; max attenuation 74 dB.
Definition: firdes.h:49
QAction * getAction(int which)
Definition: form_menus.h:1458
void getTriangle()
Definition: form_menus.h:356
void getOther()
Definition: form_menus.h:1106
~TriggerChannelMenu()
Definition: form_menus.h:1301
LineMarkerMenu(int which, QWidget *parent)
Definition: form_menus.h:286
void getLow()
Definition: form_menus.h:853
void getOff()
Definition: form_menus.h:850
void getKaiser()
Definition: form_menus.h:964
void getCyan()
Definition: form_menus.h:110
QAction * getAction(int which)
Definition: form_menus.h:252
void getNone()
Definition: form_menus.h:352
void getMedium()
Definition: form_menus.h:431
QAction * getAction(int which)
Definition: form_menus.h:178
void getXCross()
Definition: form_menus.h:361
void getNeg()
Definition: form_menus.h:1271
void getAuto()
Definition: form_menus.h:1199
void getSolid()
Definition: form_menus.h:265
void getMultiColor()
Definition: form_menus.h:1099
~LineColorMenu()
Definition: form_menus.h:86
AverageMenu(const std::string &menuTitle, QWidget *parent)
Definition: form_menus.h:755
void getDashDot()
Definition: form_menus.h:268
void getBlackHot()
Definition: form_menus.h:1101
void getRed()
Definition: form_menus.h:107
FFTWindowMenu(QWidget *parent)
Definition: form_menus.h:888
void getDashDotDot()
Definition: form_menus.h:269
void getDTriangle()
Definition: form_menus.h:357
void getOther()
Definition: form_menus.h:1477
void getCool()
Definition: form_menus.h:1104
void getTextDiag()
Definition: form_menus.h:1017
MarkerAlphaMenu(int which, QWidget *parent)
Definition: form_menus.h:383
void getHamming()
Definition: form_menus.h:959
void getSeven()
Definition: form_menus.h:196
void get09()
Definition: form_menus.h:729
void getRTriangle()
Definition: form_menus.h:359
void getIncandescent()
Definition: form_menus.h:1102
Definition: form_menus.h:129
void setMedium(float x)
Definition: form_menus.h:836
void getHLine()
Definition: form_menus.h:362
void setLow(float x)
Definition: form_menus.h:841
int getNumActions() const
Definition: form_menus.h:1453
void getStar2()
Definition: form_menus.h:365
void getFive()
Definition: form_menus.h:194
void getMedium()
Definition: form_menus.h:852
~OtherDualAction()
Definition: form_menus.h:603
void getStar1()
Definition: form_menus.h:364
Definition: form_menus.h:281
Definition: form_menus.h:41
LineTitleAction(int which, QWidget *parent)
Definition: form_menus.h:450
void getBlackmanharris()
Definition: form_menus.h:962
void getRect()
Definition: form_menus.h:354
void getChannel()
Definition: form_menus.h:1322
NumberColorMapMenu(int which, QWidget *parent)
Definition: form_menus.h:1419
int getNumActions() const
Definition: form_menus.h:89
int getNumActions() const
Definition: form_menus.h:412
void getThree()
Definition: form_menus.h:192
void setText(float f)
Definition: form_menus.h:1591
void getDarkGreen()
Definition: form_menus.h:115
void getTwo()
Definition: form_menus.h:191
~NumberLayoutMenu()
Definition: form_menus.h:1364
~TriggerModeMenu()
Definition: form_menus.h:1158
LineColorMenu(int which, QWidget *parent)
Definition: form_menus.h:46
void setText(QString s)
Definition: form_menus.h:1530
void getMagenta()
Definition: form_menus.h:111
void getHigh()
Definition: form_menus.h:432
QAction * getAction(int which)
Definition: form_menus.h:805
Definition: qtgui_types.h:171
void get07()
Definition: form_menus.h:727
Blackman-harris window.
Definition: firdes.h:52
int getNumActions() const
Definition: form_menus.h:247
Definition: gr-qtgui/include/gnuradio/qtgui/trigger_mode.h:32
void getLTriangle()
Definition: form_menus.h:358
Definition: form_menus.h:1038
QAction * getAction(int which)
Definition: form_menus.h:1372
~FFTSizeMenu()
Definition: form_menus.h:687
void getBlackRed()
Definition: form_menus.h:1476
Definition: form_menus.h:1560
void getOff()
Definition: form_menus.h:433
void getTextDiag()
Definition: form_menus.h:479
Definition: form_menus.h:1282
int getNumActions() const
Definition: form_menus.h:1367
QAction * getAction(int which)
Definition: form_menus.h:340
~NumberColorMapMenu()
Definition: form_menus.h:1450
win_type
Definition: firdes.h:45
ColorMapMenu(int which, QWidget *parent)
Definition: form_menus.h:1043
Definition: qtgui_types.h:161
FFTAverageMenu(QWidget *parent)
Definition: form_menus.h:872
Definition: form_menus.h:1414
int getNumActions() const
Definition: form_menus.h:1161
void getSunset()
Definition: form_menus.h:1103
void getHexagon()
Definition: form_menus.h:366
void get12()
Definition: form_menus.h:732
QAction * getAction(gr::qtgui::graph_t layout)
Definition: form_menus.h:1380