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