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