GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
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
39#include <qwt_symbol.h>
40
41class LineColorMenu : public QMenu
42{
43 Q_OBJECT
44
45public:
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
98signals:
99 void whichTrigger(unsigned int which, const QString& name);
100
101public 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
115private:
116 QActionGroup* d_grp;
117 QList<QAction*> d_act;
118 int d_which;
119};
120
121
122/********************************************************************/
123
124
125class LineWidthMenu : public QMenu
126{
127 Q_OBJECT
128
129public:
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
178signals:
179 void whichTrigger(unsigned int which, unsigned int width);
180
181public 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
193private:
194 QActionGroup* d_grp;
195 QList<QAction*> d_act;
196 int d_which;
197};
198
199
200/********************************************************************/
201
202
203class LineStyleMenu : public QMenu
204{
205 Q_OBJECT
206
207public:
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
248signals:
249 void whichTrigger(unsigned int which, Qt::PenStyle);
250
251public 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
259private:
260 QActionGroup* d_grp;
261 QList<QAction*> d_act;
262 int d_which;
263};
264
265
266/********************************************************************/
267
268
269class LineMarkerMenu : public QMenu
270{
271 Q_OBJECT
272
273public:
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
332signals:
333 void whichTrigger(unsigned int which, QwtSymbol::Style);
334
335public 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
352private:
353 QActionGroup* d_grp;
354 QList<QAction*> d_act;
355 int d_which;
356};
357
358
359/********************************************************************/
360
361
362class MarkerAlphaMenu : public QMenu
363{
364 Q_OBJECT
365
366public:
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
405signals:
406 void whichTrigger(unsigned int which, unsigned int);
407
408public 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
415private:
416 QActionGroup* d_grp;
417 QList<QAction*> d_act;
418 int d_which;
419};
420
421
422/********************************************************************/
423
424
425class LineTitleAction : public QAction
426{
427 Q_OBJECT
428
429public:
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
454signals:
455 void whichTrigger(unsigned int which, const QString& text);
456
457public slots:
458 void getTextDiag() { d_diag->exec(); }
459
460private slots:
461 void getText()
462 {
463 emit whichTrigger(d_which, d_text->text());
464 d_diag->accept();
465 }
466
467private:
468 int d_which;
469
470 QDialog* d_diag;
471 QLineEdit* d_text;
472};
473
474
475/********************************************************************/
476
477
478class OtherAction : public QAction
479{
480 Q_OBJECT
481
482public:
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
511signals:
512 void whichTrigger(const QString& text);
513
514public slots:
515 void getTextDiag() { d_diag->exec(); }
516
517private slots:
518 void getText()
519 {
520 emit whichTrigger(d_text->text());
521 d_diag->accept();
522 }
523
524private:
525 QDialog* d_diag;
526 QLineEdit* d_text;
527};
528
529/********************************************************************/
530
531
532class OtherDualAction : public QAction
533{
534 Q_OBJECT
535
536public:
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
570signals:
571 void whichTrigger(const QString& text0, const QString& text1);
572
573public slots:
574 void getTextDiag() { d_diag->exec(); }
575
576private slots:
577 void getText()
578 {
579 emit whichTrigger(d_text0->text(), d_text1->text());
580 d_diag->accept();
581 }
582
583private:
584 QDialog* d_diag;
585 QLineEdit* d_text0;
586 QLineEdit* d_text1;
587};
588
589
590/********************************************************************/
591
592
593class FFTSizeMenu : public QMenu
594{
595 Q_OBJECT
596
597public:
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
680signals:
681 void whichTrigger(int size);
682
683public 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
701private:
702 QList<QAction*> d_act;
703 QActionGroup* d_grp;
704};
705
706/********************************************************************/
707
708class AverageMenu : public QMenu
709{
710 Q_OBJECT
711
712public:
713 AverageMenu(const std::string& menuTitle, QWidget* parent)
714 : QMenu(menuTitle.c_str(), parent)
715 {
716 d_grp = new QActionGroup(this);
717
718 d_off = 1.0;
719 d_high = 0.05;
720 d_medium = 0.1;
721 d_low = 0.2;
722
723 d_act.push_back(new QAction("Off", this));
724 d_act.push_back(new QAction("High", this));
725 d_act.push_back(new QAction("Medium", this));
726 d_act.push_back(new QAction("Low", this));
727 d_act.push_back(new OtherAction(this));
728
729 d_grp = new QActionGroup(this);
730 for (int t = 0; t < d_act.size(); t++) {
731 d_act[t]->setCheckable(true);
732 d_act[t]->setActionGroup(d_grp);
733 }
734 d_act[0]->setChecked(true);
735
736 QDoubleValidator* valid = new QDoubleValidator(0.0, 1.0, 3, this);
737 ((OtherAction*)d_act[d_act.size() - 1])->setValidator(valid);
738
739 connect(d_act[0], SIGNAL(triggered()), this, SLOT(getOff()));
740 connect(d_act[1], SIGNAL(triggered()), this, SLOT(getHigh()));
741 connect(d_act[2], SIGNAL(triggered()), this, SLOT(getMedium()));
742 connect(d_act[3], SIGNAL(triggered()), this, SLOT(getLow()));
743 connect(d_act[4],
744 SIGNAL(whichTrigger(const QString&)),
745 this,
746 SLOT(getOther(const QString&)));
747
748 QListIterator<QAction*> i(d_act);
749 while (i.hasNext()) {
750 QAction* a = i.next();
751 a->setCheckable(true);
752 a->setActionGroup(d_grp);
753 addAction(a);
754 }
755 }
756
758
759 int getNumActions() const { return d_act.size(); }
760
761 QAction* getAction(unsigned int which)
762 {
763 if (which < static_cast<unsigned int>(d_act.size()))
764 return d_act[which];
765 else
766 throw std::runtime_error("FFTSizeMenu::getAction: which out of range.\n");
767 }
768
769 QAction* getActionFromAvg(float avg)
770 {
771 int which = 0;
772 if (avg == d_off)
773 which = 0;
774 else if (avg == d_high)
775 which = 1;
776 else if (avg == d_medium)
777 which = 2;
778 else if (avg == d_low)
779 which = 3;
780 else {
781 ((OtherAction*)d_act[d_act.size() - 1])->setDiagText(QString().setNum(avg));
782 which = 4;
783 }
784 return d_act[static_cast<int>(which)];
785 }
786
787 void setHigh(float x) { d_high = x; }
788
789 void setMedium(float x) { d_medium = x; }
790
791 void setLow(float x) { d_low = x; }
792
793signals:
794 void whichTrigger(float alpha);
795
796public slots:
797 void getOff() { emit whichTrigger(d_off); }
798 void getHigh() { emit whichTrigger(d_high); }
799 void getMedium() { emit whichTrigger(d_medium); }
800 void getLow() { emit whichTrigger(d_low); }
801 void getOther(const QString& str)
802 {
803 float value = str.toFloat();
804 emit whichTrigger(value);
805 }
806
807private:
808 QList<QAction*> d_act;
809 QActionGroup* d_grp;
810 float d_off, d_high, d_medium, d_low;
811};
812
813/********************************************************************/
814
816{
817public:
818 FFTAverageMenu(QWidget* parent) : AverageMenu("FFT Average", parent)
819 {
820 // nop
821 }
822
824};
825
826/********************************************************************/
827
828
829class FFTWindowMenu : public QMenu
830{
831 Q_OBJECT
832
833public:
834 FFTWindowMenu(QWidget* parent) : QMenu("FFT Window", parent)
835 {
836 d_act.push_back(new QAction("None", this));
837 d_act.push_back(new QAction("Hamming", this));
838 d_act.push_back(new QAction("Hann", this));
839 d_act.push_back(new QAction("Blackman", this));
840 d_act.push_back(new QAction("Blackman-harris", this));
841 d_act.push_back(new QAction("Rectangular", this));
842 d_act.push_back(new QAction("Kaiser", this));
843 d_act.push_back(new QAction("Flat-top", this));
844
845 d_grp = new QActionGroup(this);
846 for (int t = 0; t < d_act.size(); t++) {
847 d_act[t]->setCheckable(true);
848 d_act[t]->setActionGroup(d_grp);
849 }
850
851 connect(d_act[0], SIGNAL(triggered()), this, SLOT(getNone()));
852 connect(d_act[1], SIGNAL(triggered()), this, SLOT(getHamming()));
853 connect(d_act[2], SIGNAL(triggered()), this, SLOT(getHann()));
854 connect(d_act[3], SIGNAL(triggered()), this, SLOT(getBlackman()));
855 connect(d_act[4], SIGNAL(triggered()), this, SLOT(getBlackmanharris()));
856 connect(d_act[5], SIGNAL(triggered()), this, SLOT(getRectangular()));
857 connect(d_act[6], SIGNAL(triggered()), this, SLOT(getKaiser()));
858 connect(d_act[7], SIGNAL(triggered()), this, SLOT(getFlattop()));
859
860 QListIterator<QAction*> i(d_act);
861 while (i.hasNext()) {
862 QAction* a = i.next();
863 addAction(a);
864 }
865 }
866
868
869 int getNumActions() const { return d_act.size(); }
870
871 QAction* getAction(unsigned int which)
872 {
873 if (which < static_cast<unsigned int>(d_act.size()))
874 return d_act[which];
875 else
876 throw std::runtime_error("FFTWindowMenu::getAction: which out of range.\n");
877 }
878
880 {
881 int which = 0;
882 switch (static_cast<int>(type)) {
884 which = 0;
885 break;
887 which = 1;
888 break;
890 which = 2;
891 break;
893 which = 3;
894 break;
896 which = 4;
897 break;
899 which = 5;
900 break;
902 which = 6;
903 break;
905 which = 7;
906 break;
907 }
908 return d_act[which];
909 }
910
911signals:
913
914public slots:
926
927private:
928 QList<QAction*> d_act;
929 QActionGroup* d_grp;
930};
931
932
933/********************************************************************/
934
935
936class NPointsMenu : public QAction
937{
938 Q_OBJECT
939
940public:
941 NPointsMenu(QWidget* parent) : QAction("Number of Points", parent)
942 {
943 d_diag = new QDialog(parent);
944 d_diag->setWindowTitle("Number of Points");
945 d_diag->setModal(true);
946
947 d_text = new QLineEdit();
948
949 QGridLayout* layout = new QGridLayout(d_diag);
950 QPushButton* btn_ok = new QPushButton(tr("OK"));
951 QPushButton* btn_cancel = new QPushButton(tr("Cancel"));
952
953 layout->addWidget(d_text, 0, 0, 1, 2);
954 layout->addWidget(btn_ok, 1, 0);
955 layout->addWidget(btn_cancel, 1, 1);
956
957 connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
958 connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
959
960 connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
961 }
962
964
965signals:
966 void whichTrigger(const int npts);
967
968public slots:
969 void setDiagText(const int npts) { d_text->setText(QString().setNum(npts)); }
970
971 void getTextDiag() { d_diag->show(); }
972
973private slots:
974 void getText()
975 {
976 emit whichTrigger(d_text->text().toInt());
977 d_diag->accept();
978 }
979
980private:
981 QDialog* d_diag;
982 QLineEdit* d_text;
983};
984
985
986/********************************************************************/
987
988
989class ColorMapMenu : public QMenu
990{
991 Q_OBJECT
992
993public:
994 ColorMapMenu(unsigned int which, QWidget* parent)
995 : QMenu("Color Map", parent), d_which(which)
996 {
997 d_grp = new QActionGroup(this);
998
999 d_act.push_back(new QAction("Multi-Color", this));
1000 d_act.push_back(new QAction("White Hot", this));
1001 d_act.push_back(new QAction("Black Hot", this));
1002 d_act.push_back(new QAction("Incandescent", this));
1003 d_act.push_back(new QAction("Sunset", this));
1004 d_act.push_back(new QAction("Cool", this));
1005 d_act.push_back(new QAction("Other", this));
1006 // d_act.push_back(new OtherDualAction("Min Intensity: ", "Max Intensity: ",
1007 // this));
1008
1009 connect(d_act[0], SIGNAL(triggered()), this, SLOT(getMultiColor()));
1010 connect(d_act[1], SIGNAL(triggered()), this, SLOT(getWhiteHot()));
1011 connect(d_act[2], SIGNAL(triggered()), this, SLOT(getBlackHot()));
1012 connect(d_act[3], SIGNAL(triggered()), this, SLOT(getIncandescent()));
1013 connect(d_act[4], SIGNAL(triggered()), this, SLOT(getSunset()));
1014 connect(d_act[5], SIGNAL(triggered()), this, SLOT(getCool()));
1015 connect(d_act[6], SIGNAL(triggered()), this, SLOT(getOther()));
1016
1017 QListIterator<QAction*> i(d_act);
1018 while (i.hasNext()) {
1019 QAction* a = i.next();
1020 a->setCheckable(true);
1021 a->setActionGroup(d_grp);
1022 addAction(a);
1023 }
1024
1025 d_max_value = QColor("white");
1026 d_min_value = QColor("white");
1027 }
1028
1030
1031 int getNumActions() const { return d_act.size(); }
1032
1033 QAction* getAction(unsigned int which)
1034 {
1035 if (which < static_cast<unsigned int>(d_act.size()))
1036 return d_act[which];
1037 else
1038 throw std::runtime_error("ColorMapMenu::getAction: which out of range.\n");
1039 }
1040
1041signals:
1042 void whichTrigger(unsigned int which,
1043 const int type,
1044 const QColor& min_color = QColor(),
1045 const QColor& max_color = QColor());
1046
1047public slots:
1049 {
1051 }
1055 {
1057 }
1060 // void getOther(d_which, const QString &min_str, const QString &max_str)
1062 {
1063 QMessageBox::information(
1064 this,
1065 "Set low and high intensities",
1066 "In the next windows, select the low and then the high intensity colors.",
1067 QMessageBox::Ok);
1068 d_min_value = QColorDialog::getColor(d_min_value, this);
1069 d_max_value = QColorDialog::getColor(d_max_value, this);
1070
1071 emit whichTrigger(
1072 d_which, INTENSITY_COLOR_MAP_TYPE_USER_DEFINED, d_min_value, d_max_value);
1073 }
1074
1075private:
1076 QActionGroup* d_grp;
1077 QList<QAction*> d_act;
1078 QColor d_max_value, d_min_value;
1079 int d_which;
1080};
1081
1082
1083/********************************************************************/
1084
1085
1086class TriggerModeMenu : public QMenu
1087{
1088 Q_OBJECT
1089
1090public:
1091 TriggerModeMenu(QWidget* parent) : QMenu("Mode", parent)
1092 {
1093 d_grp = new QActionGroup(this);
1094 d_act.push_back(new QAction("Free", this));
1095 d_act.push_back(new QAction("Auto", this));
1096 d_act.push_back(new QAction("Normal", this));
1097 d_act.push_back(new QAction("Tag", this));
1098
1099 connect(d_act[0], SIGNAL(triggered()), this, SLOT(getFree()));
1100 connect(d_act[1], SIGNAL(triggered()), this, SLOT(getAuto()));
1101 connect(d_act[2], SIGNAL(triggered()), this, SLOT(getNorm()));
1102 connect(d_act[3], SIGNAL(triggered()), this, SLOT(getTag()));
1103
1104 QListIterator<QAction*> i(d_act);
1105 while (i.hasNext()) {
1106 QAction* a = i.next();
1107 a->setCheckable(true);
1108 a->setActionGroup(d_grp);
1109 addAction(a);
1110 }
1111 }
1112
1114
1115 int getNumActions() const { return d_act.size(); }
1116
1117 QAction* getAction(unsigned int which)
1118 {
1119 if (which < static_cast<unsigned int>(d_act.size()))
1120 return d_act[which];
1121 else
1122 throw std::runtime_error("TriggerModeMenu::getAction: which out of range.\n");
1123 }
1124
1126 {
1127 switch (mode) {
1129 return d_act[0];
1130 break;
1132 return d_act[1];
1133 break;
1135 return d_act[2];
1136 break;
1138 return d_act[3];
1139 break;
1140 default:
1141 throw std::runtime_error(
1142 "TriggerModeMenu::getAction: unknown trigger mode.\n");
1143 }
1144 }
1145
1146signals:
1148
1149public slots:
1154
1155private:
1156 QList<QAction*> d_act;
1157 QActionGroup* d_grp;
1158};
1159
1160
1161/********************************************************************/
1162
1163
1164class TriggerSlopeMenu : public QMenu
1165{
1166 Q_OBJECT
1167
1168public:
1169 TriggerSlopeMenu(QWidget* parent) : QMenu("Slope", parent)
1170 {
1171 d_grp = new QActionGroup(this);
1172 d_act.push_back(new QAction("Positive", this));
1173 d_act.push_back(new QAction("Negative", this));
1174
1175 connect(d_act[0], SIGNAL(triggered()), this, SLOT(getPos()));
1176 connect(d_act[1], SIGNAL(triggered()), this, SLOT(getNeg()));
1177
1178 QListIterator<QAction*> i(d_act);
1179 while (i.hasNext()) {
1180 QAction* a = i.next();
1181 a->setCheckable(true);
1182 a->setActionGroup(d_grp);
1183 addAction(a);
1184 }
1185 }
1186
1188
1189 int getNumActions() const { return d_act.size(); }
1190
1191 QAction* getAction(unsigned int which)
1192 {
1193 if (which < static_cast<unsigned int>(d_act.size()))
1194 return d_act[which];
1195 else
1196 throw std::runtime_error(
1197 "TriggerSlopeMenu::getAction: which out of range.\n");
1198 }
1199
1201 {
1202 switch (slope) {
1204 return d_act[0];
1205 break;
1207 return d_act[1];
1208 break;
1209 default:
1210 throw std::runtime_error(
1211 "TriggerSlopeMenu::getAction: unknown trigger slope.\n");
1212 }
1213 }
1214
1215signals:
1217
1218public slots:
1221
1222private:
1223 QList<QAction*> d_act;
1224 QActionGroup* d_grp;
1225};
1226
1227
1228/********************************************************************/
1229
1230
1231class TriggerChannelMenu : public QMenu
1232{
1233 Q_OBJECT
1234
1235public:
1236 TriggerChannelMenu(int nchans, QWidget* parent) : QMenu("Channel", parent)
1237 {
1238 d_grp = new QActionGroup(this);
1239 for (int i = 0; i < nchans; i++) {
1240 d_act.push_back(new QAction(QString().setNum(i), this));
1241 d_act[i]->setCheckable(true);
1242 d_act[i]->setActionGroup(d_grp);
1243
1244 addAction(d_act[i]);
1245 connect(d_act[i], SIGNAL(triggered()), this, SLOT(getChannel()));
1246 }
1247 }
1248
1250
1251 int getNumActions() const { return d_act.size(); }
1252
1253 QAction* getAction(unsigned int which)
1254 {
1255 if (which < static_cast<unsigned int>(d_act.size()))
1256 return d_act[which];
1257 else
1258 throw std::runtime_error(
1259 "TriggerChannelMenu::getAction: which out of range.\n");
1260 }
1261
1262
1263signals:
1264 void whichTrigger(int n);
1265
1266public slots:
1268 {
1269 QAction* a = d_grp->checkedAction();
1270 int which = a->text().toInt();
1271 emit whichTrigger(which);
1272 }
1273
1274private:
1275 QList<QAction*> d_act;
1276 QActionGroup* d_grp;
1277};
1278
1279
1280/********************************************************************/
1281
1282
1283class NumberLayoutMenu : public QMenu
1284{
1285 Q_OBJECT
1286
1287public:
1288 NumberLayoutMenu(QWidget* parent) : QMenu("Layout", parent)
1289 {
1290 d_grp = new QActionGroup(this);
1291 d_act.push_back(new QAction("Horizontal", this));
1292 d_act.push_back(new QAction("Vertical", this));
1293 d_act.push_back(new QAction("None", this));
1294
1295 connect(d_act[0], SIGNAL(triggered()), this, SLOT(getHoriz()));
1296 connect(d_act[1], SIGNAL(triggered()), this, SLOT(getVert()));
1297 connect(d_act[2], SIGNAL(triggered()), this, SLOT(getNone()));
1298
1299 QListIterator<QAction*> i(d_act);
1300 while (i.hasNext()) {
1301 QAction* a = i.next();
1302 a->setCheckable(true);
1303 a->setActionGroup(d_grp);
1304 addAction(a);
1305 }
1306 }
1307
1309
1310 int getNumActions() const { return d_act.size(); }
1311
1312 QAction* getAction(unsigned int which)
1313 {
1314 if (which < static_cast<unsigned int>(d_act.size()))
1315 return d_act[which];
1316 else
1317 throw std::runtime_error(
1318 "NumberLayoutMenu::getAction: which out of range.\n");
1319 }
1320
1321 QAction* getAction(gr::qtgui::graph_t layout)
1322 {
1323 switch (layout) {
1324 case gr::qtgui::NUM_GRAPH_HORIZ:
1325 return d_act[0];
1326 break;
1327 case gr::qtgui::NUM_GRAPH_VERT:
1328 return d_act[1];
1329 break;
1330 case gr::qtgui::NUM_GRAPH_NONE:
1331 return d_act[1];
1332 break;
1333 default:
1334 throw std::runtime_error(
1335 "NumberLayoutMenu::getAction: unknown layout type.\n");
1336 }
1337 }
1338
1339signals:
1340 void whichTrigger(gr::qtgui::graph_t layout);
1341
1342public slots:
1343 void getHoriz() { emit whichTrigger(gr::qtgui::NUM_GRAPH_HORIZ); }
1344 void getVert() { emit whichTrigger(gr::qtgui::NUM_GRAPH_VERT); }
1345 void getNone() { emit whichTrigger(gr::qtgui::NUM_GRAPH_NONE); }
1346
1347private:
1348 QList<QAction*> d_act;
1349 QActionGroup* d_grp;
1350};
1351
1352
1353/********************************************************************/
1354
1355
1356class NumberColorMapMenu : public QMenu
1357{
1358 Q_OBJECT
1359
1360public:
1361 NumberColorMapMenu(unsigned int which, QWidget* parent)
1362 : QMenu("Color Map", parent), d_which(which)
1363 {
1364 d_grp = new QActionGroup(this);
1365
1366 d_act.push_back(new QAction("Black", this));
1367 d_act.push_back(new QAction("Blue-Red", this));
1368 d_act.push_back(new QAction("White Hot", this));
1369 d_act.push_back(new QAction("Black Hot", this));
1370 d_act.push_back(new QAction("Black-Red", this));
1371 d_act.push_back(new QAction("Other", this));
1372
1373 connect(d_act[0], SIGNAL(triggered()), this, SLOT(getBlack()));
1374 connect(d_act[1], SIGNAL(triggered()), this, SLOT(getBlueRed()));
1375 connect(d_act[2], SIGNAL(triggered()), this, SLOT(getWhiteHot()));
1376 connect(d_act[3], SIGNAL(triggered()), this, SLOT(getBlackHot()));
1377 connect(d_act[4], SIGNAL(triggered()), this, SLOT(getBlackRed()));
1378 connect(d_act[5], SIGNAL(triggered()), this, SLOT(getOther()));
1379
1380 QListIterator<QAction*> i(d_act);
1381 while (i.hasNext()) {
1382 QAction* a = i.next();
1383 a->setCheckable(true);
1384 a->setActionGroup(d_grp);
1385 addAction(a);
1386 }
1387
1388 d_max_value = QColor("black");
1389 d_min_value = QColor("black");
1390 }
1391
1393
1394 int getNumActions() const { return d_act.size(); }
1395
1396 QAction* getAction(unsigned int which)
1397 {
1398 if (which < static_cast<unsigned int>(d_act.size()))
1399 return d_act[which];
1400 else
1401 throw std::runtime_error("ColorMapMenu::getAction: which out of range.\n");
1402 }
1403
1404signals:
1405 void
1406 whichTrigger(unsigned int which, const QColor& min_color, const QColor& max_color);
1407
1408public slots:
1409 void getBlack() { emit whichTrigger(d_which, QColor("black"), QColor("black")); }
1410 void getBlueRed() { emit whichTrigger(d_which, QColor("blue"), QColor("red")); }
1411 void getWhiteHot() { emit whichTrigger(d_which, QColor("black"), QColor("white")); }
1412 void getBlackHot() { emit whichTrigger(d_which, QColor("white"), QColor("black")); }
1413 void getBlackRed() { emit whichTrigger(d_which, QColor("black"), QColor("red")); }
1415 {
1416 QMessageBox::information(
1417 this,
1418 "Set low and high intensities",
1419 "In the next windows, select the low and then the high intensity colors.",
1420 QMessageBox::Ok);
1421 d_min_value = QColorDialog::getColor(d_min_value, this);
1422 d_max_value = QColorDialog::getColor(d_max_value, this);
1423
1424 emit whichTrigger(d_which, d_min_value, d_max_value);
1425 }
1426
1427private:
1428 QActionGroup* d_grp;
1429 QList<QAction*> d_act;
1430 QColor d_max_value, d_min_value;
1431 int d_which;
1432};
1433
1434
1435/********************************************************************/
1436
1437
1438class PopupMenu : public QAction
1439{
1440 Q_OBJECT
1441
1442public:
1443 PopupMenu(QString desc, QWidget* parent) : QAction(desc, parent)
1444 {
1445 d_diag = new QDialog(parent);
1446 d_diag->setWindowTitle(desc);
1447 d_diag->setModal(true);
1448
1449 d_text = new QLineEdit();
1450
1451 QGridLayout* layout = new QGridLayout(d_diag);
1452 QPushButton* btn_ok = new QPushButton(tr("OK"));
1453 QPushButton* btn_cancel = new QPushButton(tr("Cancel"));
1454
1455 layout->addWidget(d_text, 0, 0, 1, 2);
1456 layout->addWidget(btn_ok, 1, 0);
1457 layout->addWidget(btn_cancel, 1, 1);
1458
1459 connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
1460 connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
1461
1462 connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
1463 }
1464
1466
1467 void setText(QString s) { d_text->setText(s); }
1468
1469signals:
1470 void whichTrigger(const QString data);
1471
1472public slots:
1473 void getTextDiag() { d_diag->show(); }
1474
1475private slots:
1476 void getText()
1477 {
1478 emit whichTrigger(d_text->text());
1479 d_diag->accept();
1480 }
1481
1482private:
1483 QDialog* d_diag;
1484 QLineEdit* d_text;
1485};
1486
1487
1488/********************************************************************/
1489
1490
1491class ItemFloatAct : public QAction
1492{
1493 Q_OBJECT
1494
1495public:
1496 ItemFloatAct(unsigned int which, QString title, QWidget* parent)
1497 : QAction(title, parent), d_which(which)
1498 {
1499 d_diag = new QDialog(parent);
1500 d_diag->setWindowTitle(title);
1501 d_diag->setModal(true);
1502
1503 d_text = new QLineEdit();
1504
1505 QGridLayout* layout = new QGridLayout(d_diag);
1506 QPushButton* btn_ok = new QPushButton(tr("OK"));
1507 QPushButton* btn_cancel = new QPushButton(tr("Cancel"));
1508
1509 layout->addWidget(d_text, 0, 0, 1, 2);
1510 layout->addWidget(btn_ok, 1, 0);
1511 layout->addWidget(btn_cancel, 1, 1);
1512
1513 connect(btn_ok, SIGNAL(clicked()), this, SLOT(getText()));
1514 connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
1515
1516 connect(this, SIGNAL(triggered()), this, SLOT(getTextDiag()));
1517 }
1518
1520
1521 void setText(float f) { d_text->setText(QString("%1").arg(f)); }
1522
1523
1524signals:
1525 void whichTrigger(unsigned int which, float data);
1526
1527public slots:
1528 void getTextDiag() { d_diag->show(); }
1529
1530private slots:
1531 void getText()
1532 {
1533 emit whichTrigger(d_which, d_text->text().toFloat());
1534 d_diag->accept();
1535 }
1536
1537private:
1538 int d_which;
1539 QDialog* d_diag;
1540 QLineEdit* d_text;
1541};
1542
1543
1544/********************************************************************/
1545
1546
1547#endif /* FORM_MENUS_H */
Definition form_menus.h:709
void whichTrigger(float alpha)
void getLow()
Definition form_menus.h:800
void getMedium()
Definition form_menus.h:799
void getOff()
Definition form_menus.h:797
AverageMenu(const std::string &menuTitle, QWidget *parent)
Definition form_menus.h:713
QAction * getActionFromAvg(float avg)
Definition form_menus.h:769
QAction * getAction(unsigned int which)
Definition form_menus.h:761
void setHigh(float x)
Definition form_menus.h:787
void setMedium(float x)
Definition form_menus.h:789
void setLow(float x)
Definition form_menus.h:791
void getHigh()
Definition form_menus.h:798
void getOther(const QString &str)
Definition form_menus.h:801
~AverageMenu()
Definition form_menus.h:757
int getNumActions() const
Definition form_menus.h:759
Definition form_menus.h:990
void getWhiteHot()
Definition form_menus.h:1052
~ColorMapMenu()
Definition form_menus.h:1029
void getCool()
Definition form_menus.h:1059
void getBlackHot()
Definition form_menus.h:1053
void getOther()
Definition form_menus.h:1061
void whichTrigger(unsigned int which, const int type, const QColor &min_color=QColor(), const QColor &max_color=QColor())
void getIncandescent()
Definition form_menus.h:1054
int getNumActions() const
Definition form_menus.h:1031
QAction * getAction(unsigned int which)
Definition form_menus.h:1033
void getSunset()
Definition form_menus.h:1058
ColorMapMenu(unsigned int which, QWidget *parent)
Definition form_menus.h:994
void getMultiColor()
Definition form_menus.h:1048
Definition form_menus.h:816
~FFTAverageMenu()
Definition form_menus.h:823
FFTAverageMenu(QWidget *parent)
Definition form_menus.h:818
Definition form_menus.h:594
void get11()
Definition form_menus.h:690
FFTSizeMenu(QWidget *parent)
Definition form_menus.h:598
int getNumActions() const
Definition form_menus.h:651
QAction * getAction(unsigned int which)
Definition form_menus.h:653
void get07()
Definition form_menus.h:686
void get06()
Definition form_menus.h:685
QAction * getActionFromSize(int size)
Definition form_menus.h:661
void getOther(const QString &str)
Definition form_menus.h:695
void get12()
Definition form_menus.h:691
void get10()
Definition form_menus.h:689
void get05()
Definition form_menus.h:684
void get09()
Definition form_menus.h:688
~FFTSizeMenu()
Definition form_menus.h:649
void whichTrigger(int size)
void get08()
Definition form_menus.h:687
Definition form_menus.h:830
void getKaiser()
Definition form_menus.h:924
int getNumActions() const
Definition form_menus.h:869
QAction * getActionFromWindow(gr::filter::firdes::win_type type)
Definition form_menus.h:879
void whichTrigger(const gr::filter::firdes::win_type type)
QAction * getAction(unsigned int which)
Definition form_menus.h:871
void getBlackmanharris()
Definition form_menus.h:919
~FFTWindowMenu()
Definition form_menus.h:867
void getBlackman()
Definition form_menus.h:918
void getHamming()
Definition form_menus.h:916
void getRectangular()
Definition form_menus.h:923
void getFlattop()
Definition form_menus.h:925
void getHann()
Definition form_menus.h:917
FFTWindowMenu(QWidget *parent)
Definition form_menus.h:834
void getNone()
Definition form_menus.h:915
Definition form_menus.h:1492
~ItemFloatAct()
Definition form_menus.h:1519
void whichTrigger(unsigned int which, float data)
void getTextDiag()
Definition form_menus.h:1528
ItemFloatAct(unsigned int which, QString title, QWidget *parent)
Definition form_menus.h:1496
void setText(float f)
Definition form_menus.h:1521
Definition form_menus.h:42
int getNumActions() const
Definition form_menus.h:88
void getDarkGray()
Definition form_menus.h:113
void getBlue()
Definition form_menus.h:102
void getGray()
Definition form_menus.h:109
void getGreen()
Definition form_menus.h:104
void getMagenta()
Definition form_menus.h:107
void getRed()
Definition form_menus.h:103
void getBlack()
Definition form_menus.h:105
void getDarkGreen()
Definition form_menus.h:111
void getDarkRed()
Definition form_menus.h:110
LineColorMenu(unsigned int which, QWidget *parent)
Definition form_menus.h:46
QAction * getAction(unsigned int which)
Definition form_menus.h:90
void whichTrigger(unsigned int which, const QString &name)
void getDarkBlue()
Definition form_menus.h:112
void getYellow()
Definition form_menus.h:108
void getCyan()
Definition form_menus.h:106
~LineColorMenu()
Definition form_menus.h:86
Definition form_menus.h:270
void getStar2()
Definition form_menus.h:349
QAction * getAction(unsigned int which)
Definition form_menus.h:324
void getStar1()
Definition form_menus.h:348
void getVLine()
Definition form_menus.h:347
void whichTrigger(unsigned int which, QwtSymbol::Style)
void getLTriangle()
Definition form_menus.h:342
void getDTriangle()
Definition form_menus.h:341
void getTriangle()
Definition form_menus.h:340
LineMarkerMenu(unsigned int which, QWidget *parent)
Definition form_menus.h:274
void getCircle()
Definition form_menus.h:337
int getNumActions() const
Definition form_menus.h:322
void getRect()
Definition form_menus.h:338
void getHLine()
Definition form_menus.h:346
void getRTriangle()
Definition form_menus.h:343
void getHexagon()
Definition form_menus.h:350
void getCross()
Definition form_menus.h:344
void getXCross()
Definition form_menus.h:345
void getDiamond()
Definition form_menus.h:339
void getNone()
Definition form_menus.h:336
~LineMarkerMenu()
Definition form_menus.h:320
Definition form_menus.h:204
void getSolid()
Definition form_menus.h:253
void getNone()
Definition form_menus.h:252
void getDashDot()
Definition form_menus.h:256
void getDots()
Definition form_menus.h:255
void getDashDotDot()
Definition form_menus.h:257
void getDash()
Definition form_menus.h:254
~LineStyleMenu()
Definition form_menus.h:236
QAction * getAction(unsigned int which)
Definition form_menus.h:240
int getNumActions() const
Definition form_menus.h:238
LineStyleMenu(unsigned int which, QWidget *parent)
Definition form_menus.h:208
void whichTrigger(unsigned int which, Qt::PenStyle)
Definition form_menus.h:426
void getTextDiag()
Definition form_menus.h:458
~LineTitleAction()
Definition form_menus.h:452
LineTitleAction(unsigned int which, QWidget *parent)
Definition form_menus.h:430
void whichTrigger(unsigned int which, const QString &text)
Definition form_menus.h:126
void getSix()
Definition form_menus.h:187
~LineWidthMenu()
Definition form_menus.h:166
LineWidthMenu(unsigned int which, QWidget *parent)
Definition form_menus.h:130
void getNine()
Definition form_menus.h:190
void getOne()
Definition form_menus.h:182
void whichTrigger(unsigned int which, unsigned int width)
void getEight()
Definition form_menus.h:189
QAction * getAction(unsigned int which)
Definition form_menus.h:170
void getTwo()
Definition form_menus.h:183
void getFour()
Definition form_menus.h:185
void getFive()
Definition form_menus.h:186
void getSeven()
Definition form_menus.h:188
void getTen()
Definition form_menus.h:191
int getNumActions() const
Definition form_menus.h:168
void getThree()
Definition form_menus.h:184
Definition form_menus.h:363
void getOff()
Definition form_menus.h:413
void getMedium()
Definition form_menus.h:411
MarkerAlphaMenu(unsigned int which, QWidget *parent)
Definition form_menus.h:367
QAction * getAction(unsigned int which)
Definition form_menus.h:397
int getNumActions() const
Definition form_menus.h:395
~MarkerAlphaMenu()
Definition form_menus.h:393
void getHigh()
Definition form_menus.h:412
void whichTrigger(unsigned int which, unsigned int)
void getLow()
Definition form_menus.h:410
void getNone()
Definition form_menus.h:409
Definition form_menus.h:937
void setDiagText(const int npts)
Definition form_menus.h:969
void getTextDiag()
Definition form_menus.h:971
void whichTrigger(const int npts)
~NPointsMenu()
Definition form_menus.h:963
NPointsMenu(QWidget *parent)
Definition form_menus.h:941
Definition form_menus.h:1357
void getBlack()
Definition form_menus.h:1409
void getBlackRed()
Definition form_menus.h:1413
QAction * getAction(unsigned int which)
Definition form_menus.h:1396
NumberColorMapMenu(unsigned int which, QWidget *parent)
Definition form_menus.h:1361
void getWhiteHot()
Definition form_menus.h:1411
~NumberColorMapMenu()
Definition form_menus.h:1392
void getOther()
Definition form_menus.h:1414
void whichTrigger(unsigned int which, const QColor &min_color, const QColor &max_color)
int getNumActions() const
Definition form_menus.h:1394
void getBlueRed()
Definition form_menus.h:1410
void getBlackHot()
Definition form_menus.h:1412
Definition form_menus.h:1284
QAction * getAction(gr::qtgui::graph_t layout)
Definition form_menus.h:1321
~NumberLayoutMenu()
Definition form_menus.h:1308
void getNone()
Definition form_menus.h:1345
void whichTrigger(gr::qtgui::graph_t layout)
void getVert()
Definition form_menus.h:1344
NumberLayoutMenu(QWidget *parent)
Definition form_menus.h:1288
int getNumActions() const
Definition form_menus.h:1310
void getHoriz()
Definition form_menus.h:1343
QAction * getAction(unsigned int which)
Definition form_menus.h:1312
Definition form_menus.h:479
~OtherAction()
Definition form_menus.h:505
OtherAction(QWidget *parent)
Definition form_menus.h:483
void setDiagText(QString text)
Definition form_menus.h:509
void whichTrigger(const QString &text)
void getTextDiag()
Definition form_menus.h:515
void setValidator(QValidator *v)
Definition form_menus.h:507
Definition form_menus.h:533
~OtherDualAction()
Definition form_menus.h:568
void whichTrigger(const QString &text0, const QString &text1)
OtherDualAction(QString label0, QString label1, QWidget *parent)
Definition form_menus.h:537
void getTextDiag()
Definition form_menus.h:574
Definition form_menus.h:1439
PopupMenu(QString desc, QWidget *parent)
Definition form_menus.h:1443
~PopupMenu()
Definition form_menus.h:1465
void whichTrigger(const QString data)
void setText(QString s)
Definition form_menus.h:1467
void getTextDiag()
Definition form_menus.h:1473
Definition form_menus.h:1232
TriggerChannelMenu(int nchans, QWidget *parent)
Definition form_menus.h:1236
int getNumActions() const
Definition form_menus.h:1251
~TriggerChannelMenu()
Definition form_menus.h:1249
void getChannel()
Definition form_menus.h:1267
void whichTrigger(int n)
QAction * getAction(unsigned int which)
Definition form_menus.h:1253
Definition form_menus.h:1087
~TriggerModeMenu()
Definition form_menus.h:1113
int getNumActions() const
Definition form_menus.h:1115
void getFree()
Definition form_menus.h:1150
void getNorm()
Definition form_menus.h:1152
QAction * getAction(gr::qtgui::trigger_mode mode)
Definition form_menus.h:1125
void getAuto()
Definition form_menus.h:1151
TriggerModeMenu(QWidget *parent)
Definition form_menus.h:1091
void whichTrigger(gr::qtgui::trigger_mode mode)
void getTag()
Definition form_menus.h:1153
QAction * getAction(unsigned int which)
Definition form_menus.h:1117
Definition form_menus.h:1165
int getNumActions() const
Definition form_menus.h:1189
void getPos()
Definition form_menus.h:1219
QAction * getAction(unsigned int which)
Definition form_menus.h:1191
TriggerSlopeMenu(QWidget *parent)
Definition form_menus.h:1169
~TriggerSlopeMenu()
Definition form_menus.h:1187
void getNeg()
Definition form_menus.h:1220
QAction * getAction(gr::qtgui::trigger_slope slope)
Definition form_menus.h:1200
void whichTrigger(gr::qtgui::trigger_slope slope)
win_type
Definition firdes.h:45
@ WIN_HANN
Hann window; max attenuation 44 dB.
Definition firdes.h:48
@ WIN_RECTANGULAR
Basic rectangular window.
Definition firdes.h:50
@ WIN_KAISER
Kaiser window; max attenuation a function of beta, google it.
Definition firdes.h:51
@ WIN_HAMMING
Hamming window; max attenuation 53 dB.
Definition firdes.h:47
@ WIN_BLACKMAN
Blackman window; max attenuation 74 dB.
Definition firdes.h:49
@ WIN_BLACKMAN_hARRIS
Blackman-harris window.
Definition firdes.h:52
@ WIN_NONE
don't use a window
Definition firdes.h:46
@ WIN_FLATTOP
flat top window; useful in FFTs
Definition firdes.h:56
trigger_mode
Definition trigger_mode.h:29
@ TRIG_MODE_FREE
Definition trigger_mode.h:30
@ TRIG_MODE_NORM
Definition trigger_mode.h:32
@ TRIG_MODE_AUTO
Definition trigger_mode.h:31
@ TRIG_MODE_TAG
Definition trigger_mode.h:33
trigger_slope
Definition trigger_mode.h:36
@ TRIG_SLOPE_NEG
Definition trigger_mode.h:38
@ TRIG_SLOPE_POS
Definition trigger_mode.h:37
@ INTENSITY_COLOR_MAP_TYPE_BLACK_HOT
Definition qtgui_types.h:144
@ INTENSITY_COLOR_MAP_TYPE_WHITE_HOT
Definition qtgui_types.h:143
@ INTENSITY_COLOR_MAP_TYPE_USER_DEFINED
Definition qtgui_types.h:146
@ INTENSITY_COLOR_MAP_TYPE_INCANDESCENT
Definition qtgui_types.h:145
@ INTENSITY_COLOR_MAP_TYPE_COOL
Definition qtgui_types.h:148
@ INTENSITY_COLOR_MAP_TYPE_SUNSET
Definition qtgui_types.h:147
@ INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR
Definition qtgui_types.h:142
Definition cc_common.h:45