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