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