28 #include <QtGui/QtGui>
29 #include <QtGui/QIntValidator>
30 #include <QtGui/QDoubleValidator>
31 #include <qwt_symbol.h>
42 : QMenu(
"Line Color", parent), d_which(which)
44 d_act.push_back(
new QAction(
"Blue",
this));
45 d_act.push_back(
new QAction(
"Red",
this));
46 d_act.push_back(
new QAction(
"Green",
this));
47 d_act.push_back(
new QAction(
"Black",
this));
48 d_act.push_back(
new QAction(
"Cyan",
this));
49 d_act.push_back(
new QAction(
"Magenta",
this));
50 d_act.push_back(
new QAction(
"Yellow",
this));
51 d_act.push_back(
new QAction(
"Gray",
this));
52 d_act.push_back(
new QAction(
"Dark Red",
this));
53 d_act.push_back(
new QAction(
"Dark Green",
this));
54 d_act.push_back(
new QAction(
"Dark Blue",
this));
55 d_act.push_back(
new QAction(
"Dark Gray",
this));
57 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getBlue()));
58 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getRed()));
59 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getGreen()));
60 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
getBlack()));
61 connect(d_act[4], SIGNAL(triggered()),
this, SLOT(
getCyan()));
62 connect(d_act[5], SIGNAL(triggered()),
this, SLOT(
getMagenta()));
63 connect(d_act[6], SIGNAL(triggered()),
this, SLOT(
getYellow()));
64 connect(d_act[7], SIGNAL(triggered()),
this, SLOT(
getGray()));
65 connect(d_act[8], SIGNAL(triggered()),
this, SLOT(
getDarkRed()));
66 connect(d_act[9], SIGNAL(triggered()),
this, SLOT(
getDarkGreen()));
67 connect(d_act[10], SIGNAL(triggered()),
this, SLOT(
getDarkBlue()));
68 connect(d_act[11], SIGNAL(triggered()),
this, SLOT(
getDarkGray()));
70 QListIterator<QAction*> i(d_act);
72 QAction *a = i.next();
87 if(which < d_act.size())
90 throw std::runtime_error(
"LineColorMenu::getAction: which out of range.\n");
111 QList<QAction *> d_act;
125 : QMenu(
"Line Width", parent), d_which(which)
127 d_act.push_back(
new QAction(
"1",
this));
128 d_act.push_back(
new QAction(
"2",
this));
129 d_act.push_back(
new QAction(
"3",
this));
130 d_act.push_back(
new QAction(
"4",
this));
131 d_act.push_back(
new QAction(
"5",
this));
132 d_act.push_back(
new QAction(
"6",
this));
133 d_act.push_back(
new QAction(
"7",
this));
134 d_act.push_back(
new QAction(
"8",
this));
135 d_act.push_back(
new QAction(
"9",
this));
136 d_act.push_back(
new QAction(
"10",
this));
138 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getOne()));
139 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getTwo()));
140 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getThree()));
141 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
getFour()));
142 connect(d_act[4], SIGNAL(triggered()),
this, SLOT(
getFive()));
143 connect(d_act[5], SIGNAL(triggered()),
this, SLOT(
getSix()));
144 connect(d_act[6], SIGNAL(triggered()),
this, SLOT(
getSeven()));
145 connect(d_act[7], SIGNAL(triggered()),
this, SLOT(
getEight()));
146 connect(d_act[8], SIGNAL(triggered()),
this, SLOT(
getNine()));
147 connect(d_act[9], SIGNAL(triggered()),
this, SLOT(
getTen()));
149 QListIterator<QAction*> i(d_act);
151 QAction *a = i.next();
166 if(which < d_act.size())
169 throw std::runtime_error(
"LineWidthMenu::getAction: which out of range.\n");
188 QList<QAction *> d_act;
202 : QMenu(
"Line Style", parent), d_which(which)
204 d_act.push_back(
new QAction(
"None",
this));
205 d_act.push_back(
new QAction(
"Solid",
this));
206 d_act.push_back(
new QAction(
"Dash",
this));
207 d_act.push_back(
new QAction(
"Dots",
this));
208 d_act.push_back(
new QAction(
"Dash-Dot",
this));
209 d_act.push_back(
new QAction(
"Dash-Dot-Dot",
this));
211 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getNone()));
212 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getSolid()));
213 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getDash()));
214 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
getDots()));
215 connect(d_act[4], SIGNAL(triggered()),
this, SLOT(
getDashDot()));
216 connect(d_act[5], SIGNAL(triggered()),
this, SLOT(
getDashDotDot()));
218 QListIterator<QAction*> i(d_act);
220 QAction *a = i.next();
235 if(which < d_act.size())
238 throw std::runtime_error(
"LineStyleMenu::getAction: which out of range.\n");
253 QList<QAction *> d_act;
267 : QMenu(
"Line Marker", parent), d_which(which)
269 d_act.push_back(
new QAction(
"None",
this));
270 d_act.push_back(
new QAction(
"Circle",
this));
271 d_act.push_back(
new QAction(
"Rectangle",
this));
272 d_act.push_back(
new QAction(
"Diamond",
this));
273 d_act.push_back(
new QAction(
"Triangle",
this));
274 d_act.push_back(
new QAction(
"Down Triangle",
this));
275 d_act.push_back(
new QAction(
"Left Triangle",
this));
276 d_act.push_back(
new QAction(
"Right Triangle",
this));
277 d_act.push_back(
new QAction(
"Cross",
this));
278 d_act.push_back(
new QAction(
"X-Cross",
this));
279 d_act.push_back(
new QAction(
"Horiz. Line",
this));
280 d_act.push_back(
new QAction(
"Vert. Line",
this));
281 d_act.push_back(
new QAction(
"Star 1",
this));
282 d_act.push_back(
new QAction(
"Star 2",
this));
283 d_act.push_back(
new QAction(
"Hexagon",
this));
285 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getNone()));
286 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getCircle()));
287 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getRect()));
288 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
getDiamond()));
289 connect(d_act[4], SIGNAL(triggered()),
this, SLOT(
getTriangle()));
290 connect(d_act[5], SIGNAL(triggered()),
this, SLOT(
getDTriangle()));
291 connect(d_act[6], SIGNAL(triggered()),
this, SLOT(
getLTriangle()));
292 connect(d_act[7], SIGNAL(triggered()),
this, SLOT(
getRTriangle()));
293 connect(d_act[8], SIGNAL(triggered()),
this, SLOT(
getCross()));
294 connect(d_act[9], SIGNAL(triggered()),
this, SLOT(
getXCross()));
295 connect(d_act[10], SIGNAL(triggered()),
this, SLOT(
getHLine()));
296 connect(d_act[11], SIGNAL(triggered()),
this, SLOT(
getVLine()));
297 connect(d_act[12], SIGNAL(triggered()),
this, SLOT(
getStar1()));
298 connect(d_act[13], SIGNAL(triggered()),
this, SLOT(
getStar2()));
299 connect(d_act[14], SIGNAL(triggered()),
this, SLOT(
getHexagon()));
301 QListIterator<QAction*> i(d_act);
303 QAction *a = i.next();
318 if(which < d_act.size())
321 throw std::runtime_error(
"LineMarkerMenu::getAction: which out of range.\n");
345 QList<QAction *> d_act;
359 : QMenu(
"Line Transparency", parent), d_which(which)
361 d_act.push_back(
new QAction(
"None",
this));
362 d_act.push_back(
new QAction(
"Low",
this));
363 d_act.push_back(
new QAction(
"Medium",
this));
364 d_act.push_back(
new QAction(
"High",
this));
365 d_act.push_back(
new QAction(
"Off",
this));
367 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getNone()));
368 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getLow()));
369 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getMedium()));
370 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
getHigh()));
371 connect(d_act[4], SIGNAL(triggered()),
this, SLOT(
getOff()));
373 QListIterator<QAction*> i(d_act);
375 QAction *a = i.next();
390 if(which < d_act.size())
393 throw std::runtime_error(
"MarkerAlphaMenu::getAction: which out of range.\n");
407 QList<QAction *> d_act;
421 : QAction(
"Line Title", parent), d_which(which)
423 d_diag =
new QDialog(parent);
424 d_diag->setModal(
true);
426 d_text =
new QLineEdit();
428 QGridLayout *layout =
new QGridLayout(d_diag);
429 QPushButton *btn_ok =
new QPushButton(tr(
"OK"));
430 QPushButton *btn_cancel =
new QPushButton(tr(
"Cancel"));
432 layout->addWidget(d_text, 0, 0, 1, 2);
433 layout->addWidget(btn_ok, 1, 0);
434 layout->addWidget(btn_cancel, 1, 1);
436 connect(btn_ok, SIGNAL(clicked()),
this, SLOT(getText()));
437 connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
439 connect(
this, SIGNAL(triggered()),
this, SLOT(
getTextDiag()));
478 : QAction(
"Other", parent)
480 d_diag =
new QDialog(parent);
481 d_diag->setWindowTitle(
"Other");
482 d_diag->setModal(
true);
484 d_text =
new QLineEdit();
486 QGridLayout *layout =
new QGridLayout(d_diag);
487 QPushButton *btn_ok =
new QPushButton(tr(
"OK"));
488 QPushButton *btn_cancel =
new QPushButton(tr(
"Cancel"));
490 layout->addWidget(d_text, 0, 0, 1, 2);
491 layout->addWidget(btn_ok, 1, 0);
492 layout->addWidget(btn_cancel, 1, 1);
494 connect(btn_ok, SIGNAL(clicked()),
this, SLOT(getText()));
495 connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
497 connect(
this, SIGNAL(triggered()),
this, SLOT(
getTextDiag()));
505 d_text->setValidator(v);
510 d_text->setText(text);
543 : QAction(
"Other", parent)
545 d_diag =
new QDialog(parent);
546 d_diag->setWindowTitle(
"Other");
547 d_diag->setModal(
true);
549 d_text0 =
new QLineEdit();
550 d_text1 =
new QLineEdit();
552 QLabel *_label0 =
new QLabel(label0);
553 QLabel *_label1 =
new QLabel(label1);
555 QGridLayout *layout =
new QGridLayout(d_diag);
556 QPushButton *btn_ok =
new QPushButton(tr(
"OK"));
557 QPushButton *btn_cancel =
new QPushButton(tr(
"Cancel"));
559 layout->addWidget(_label0, 0, 0, 1, 2);
560 layout->addWidget(_label1, 1, 0, 1, 2);
562 layout->addWidget(d_text0, 0, 1, 1, 2);
563 layout->addWidget(d_text1, 1, 1, 1, 2);
564 layout->addWidget(btn_ok, 2, 0);
565 layout->addWidget(btn_cancel, 2, 1);
567 connect(btn_ok, SIGNAL(clicked()),
this, SLOT(getText()));
568 connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
570 connect(
this, SIGNAL(triggered()),
this, SLOT(
getTextDiag()));
577 void whichTrigger(
const QString &text0,
const QString &text1);
608 : QMenu(
"FFT Size", parent)
610 d_act.push_back(
new QAction(
"32",
this));
611 d_act.push_back(
new QAction(
"64",
this));
612 d_act.push_back(
new QAction(
"128",
this));
613 d_act.push_back(
new QAction(
"256",
this));
614 d_act.push_back(
new QAction(
"512",
this));
615 d_act.push_back(
new QAction(
"1024",
this));
616 d_act.push_back(
new QAction(
"2048",
this));
617 d_act.push_back(
new QAction(
"4096",
this));
623 d_grp =
new QActionGroup(
this);
624 for(
int t = 0; t < d_act.size(); t++) {
625 d_act[t]->setCheckable(
true);
626 d_act[t]->setActionGroup(d_grp);
629 QIntValidator *valid =
new QIntValidator(32, 4096,
this);
630 ((
OtherAction*)d_act[d_act.size()-1])->setValidator(valid);
632 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
get05()));
633 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
get06()));
634 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
get07()));
635 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
get08()));
636 connect(d_act[4], SIGNAL(triggered()),
this, SLOT(
get09()));
637 connect(d_act[5], SIGNAL(triggered()),
this, SLOT(
get10()));
638 connect(d_act[6], SIGNAL(triggered()),
this, SLOT(
get11()));
639 connect(d_act[7], SIGNAL(triggered()),
this, SLOT(
get12()));
644 this, SLOT(
getOther(
const QString&)));
646 QListIterator<QAction*> i(d_act);
648 QAction *a = i.next();
663 if(which < d_act.size())
666 throw std::runtime_error(
"FFTSizeMenu::getAction: which out of range.\n");
672 float which = logf(static_cast<float>(size))/logf(2.0) - 5;
674 if(modff(which,&ipt) == 0) {
675 if(which < d_act.size()-1)
676 return d_act[static_cast<int>(which)];
678 throw std::runtime_error(
"FFTSizeMenu::getActionFromString: which out of range.\n");
682 ((
OtherAction*)d_act[d_act.size()-1])->setDiagText(QString().setNum(size));
683 return d_act[d_act.size()-1];
704 int value = str.toInt();
709 QList<QAction *> d_act;
724 : QMenu(
"FFT Average", parent)
731 d_act.push_back(
new QAction(
"Off",
this));
732 d_act.push_back(
new QAction(
"High",
this));
733 d_act.push_back(
new QAction(
"Medium",
this));
734 d_act.push_back(
new QAction(
"Low",
this));
737 d_grp =
new QActionGroup(
this);
738 for(
int t = 0; t < d_act.size(); t++) {
739 d_act[t]->setCheckable(
true);
740 d_act[t]->setActionGroup(d_grp);
742 d_act[0]->setChecked(
true);
744 QDoubleValidator *valid =
new QDoubleValidator(0.0, 1.0, 2,
this);
745 ((
OtherAction*)d_act[d_act.size()-1])->setValidator(valid);
747 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getOff()));
748 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getHigh()));
749 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getMedium()));
750 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
getLow()));
752 this, SLOT(
getOther(
const QString&)));
754 QListIterator<QAction*> i(d_act);
756 QAction *a = i.next();
771 if(which < d_act.size())
774 throw std::runtime_error(
"FFTSizeMenu::getAction: which out of range.\n");
782 else if(avg == d_high)
784 else if(avg == d_medium)
786 else if(avg == d_low)
789 ((
OtherAction*)d_act[d_act.size()-1])->setDiagText(QString().setNum(avg));
792 return d_act[
static_cast<int>(which)];
805 float value = str.toFloat();
810 QList<QAction *> d_act;
813 float d_off, d_high, d_medium, d_low;
826 : QMenu(
"FFT Window", parent)
828 d_act.push_back(
new QAction(
"None",
this));
829 d_act.push_back(
new QAction(
"Hamming",
this));
830 d_act.push_back(
new QAction(
"Hann",
this));
831 d_act.push_back(
new QAction(
"Blackman",
this));
832 d_act.push_back(
new QAction(
"Blackman-harris",
this));
833 d_act.push_back(
new QAction(
"Rectangular",
this));
834 d_act.push_back(
new QAction(
"Kaiser",
this));
835 d_act.push_back(
new QAction(
"Flat-top",
this));
837 d_grp =
new QActionGroup(
this);
838 for(
int t = 0; t < d_act.size(); t++) {
839 d_act[t]->setCheckable(
true);
840 d_act[t]->setActionGroup(d_grp);
843 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getNone()));
844 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getHamming()));
845 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getHann()));
846 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
getBlackman()));
848 connect(d_act[5], SIGNAL(triggered()),
this, SLOT(
getRectangular()));
849 connect(d_act[6], SIGNAL(triggered()),
this, SLOT(
getKaiser()));
850 connect(d_act[7], SIGNAL(triggered()),
this, SLOT(
getFlattop()));
852 QListIterator<QAction*> i(d_act);
854 QAction *a = i.next();
869 if(which < d_act.size())
872 throw std::runtime_error(
"FFTWindowMenu::getAction: which out of range.\n");
878 switch(static_cast<int>(type)) {
905 QList<QAction *> d_act;
920 : QAction(
"Number of Points", parent)
922 d_diag =
new QDialog(parent);
923 d_diag->setWindowTitle(
"Number of Points");
924 d_diag->setModal(
true);
926 d_text =
new QLineEdit();
928 QGridLayout *layout =
new QGridLayout(d_diag);
929 QPushButton *btn_ok =
new QPushButton(tr(
"OK"));
930 QPushButton *btn_cancel =
new QPushButton(tr(
"Cancel"));
932 layout->addWidget(d_text, 0, 0, 1, 2);
933 layout->addWidget(btn_ok, 1, 0);
934 layout->addWidget(btn_cancel, 1, 1);
936 connect(btn_ok, SIGNAL(clicked()),
this, SLOT(getText()));
937 connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
939 connect(
this, SIGNAL(triggered()),
this, SLOT(
getTextDiag()));
947 d_text->setText(QString().setNum(npts));
981 : QMenu(
"Color Map", parent), d_which(which)
983 d_act.push_back(
new QAction(
"Multi-Color",
this));
984 d_act.push_back(
new QAction(
"White Hot",
this));
985 d_act.push_back(
new QAction(
"Black Hot",
this));
986 d_act.push_back(
new QAction(
"Incandescent",
this));
987 d_act.push_back(
new QAction(
"Other",
this));
990 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getMultiColor()));
991 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getWhiteHot()));
992 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getBlackHot()));
994 connect(d_act[4], SIGNAL(triggered()),
this, SLOT(
getOther()));
996 QListIterator<QAction*> i(d_act);
998 QAction *a = i.next();
1002 d_max_value = QColor(
"white");
1003 d_min_value = QColor(
"white");
1011 return d_act.size();
1016 if(which < d_act.size())
1017 return d_act[which];
1019 throw std::runtime_error(
"ColorMapMenu::getAction: which out of range.\n");
1024 const QColor &min_color=QColor(),
1025 const QColor &max_color=QColor());
1035 QMessageBox::information(
this,
"Set low and high intensities",
1036 "In the next windows, select the low and then the high intensity colors.",
1038 d_min_value = QColorDialog::getColor(d_min_value,
this);
1039 d_max_value = QColorDialog::getColor(d_max_value,
this);
1042 d_min_value, d_max_value);
1046 QList<QAction *> d_act;
1048 QColor d_max_value, d_min_value;
1062 : QMenu(
"Mode", parent)
1064 d_grp =
new QActionGroup(
this);
1065 d_act.push_back(
new QAction(
"Free",
this));
1066 d_act.push_back(
new QAction(
"Auto",
this));
1067 d_act.push_back(
new QAction(
"Normal",
this));
1068 d_act.push_back(
new QAction(
"Tag",
this));
1070 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getFree()));
1071 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getAuto()));
1072 connect(d_act[2], SIGNAL(triggered()),
this, SLOT(
getNorm()));
1073 connect(d_act[3], SIGNAL(triggered()),
this, SLOT(
getTag()));
1075 QListIterator<QAction*> i(d_act);
1076 while(i.hasNext()) {
1077 QAction *a = i.next();
1078 a->setCheckable(
true);
1079 a->setActionGroup(d_grp);
1089 return d_act.size();
1094 if(which < d_act.size())
1095 return d_act[which];
1097 throw std::runtime_error(
"TriggerModeMenu::getAction: which out of range.\n");
1116 throw std::runtime_error(
"TriggerModeMenu::getAction: unknown trigger mode.\n");
1130 QList<QAction *> d_act;
1131 QActionGroup *d_grp;
1144 : QMenu(
"Slope", parent)
1146 d_grp =
new QActionGroup(
this);
1147 d_act.push_back(
new QAction(
"Positive",
this));
1148 d_act.push_back(
new QAction(
"Negative",
this));
1150 connect(d_act[0], SIGNAL(triggered()),
this, SLOT(
getPos()));
1151 connect(d_act[1], SIGNAL(triggered()),
this, SLOT(
getNeg()));
1153 QListIterator<QAction*> i(d_act);
1154 while(i.hasNext()) {
1155 QAction *a = i.next();
1156 a->setCheckable(
true);
1157 a->setActionGroup(d_grp);
1167 return d_act.size();
1172 if(which < d_act.size())
1173 return d_act[which];
1175 throw std::runtime_error(
"TriggerSlopeMenu::getAction: which out of range.\n");
1188 throw std::runtime_error(
"TriggerSlopeMenu::getAction: unknown trigger slope.\n");
1200 QList<QAction *> d_act;
1201 QActionGroup *d_grp;
1214 : QMenu(
"Channel", parent)
1216 d_grp =
new QActionGroup(
this);
1217 for(
int i = 0; i < nchans; i++) {
1218 d_act.push_back(
new QAction(QString().setNum(i),
this));
1219 d_act[i]->setCheckable(
true);
1220 d_act[i]->setActionGroup(d_grp);
1222 addAction(d_act[i]);
1223 connect(d_act[i], SIGNAL(triggered()),
this, SLOT(
getChannel()));
1232 return d_act.size();
1237 if(which < d_act.size())
1238 return d_act[which];
1240 throw std::runtime_error(
"TriggerChannelMenu::getAction: which out of range.\n");
1250 QAction *a = d_grp->checkedAction();
1251 int which = a->text().toInt();
1256 QList<QAction *> d_act;
1257 QActionGroup *d_grp;
1270 : QAction(desc, parent)
1272 d_diag =
new QDialog(parent);
1273 d_diag->setWindowTitle(desc);
1274 d_diag->setModal(
true);
1276 d_text =
new QLineEdit();
1278 QGridLayout *layout =
new QGridLayout(d_diag);
1279 QPushButton *btn_ok =
new QPushButton(tr(
"OK"));
1280 QPushButton *btn_cancel =
new QPushButton(tr(
"Cancel"));
1282 layout->addWidget(d_text, 0, 0, 1, 2);
1283 layout->addWidget(btn_ok, 1, 0);
1284 layout->addWidget(btn_cancel, 1, 1);
1286 connect(btn_ok, SIGNAL(clicked()),
this, SLOT(getText()));
1287 connect(btn_cancel, SIGNAL(clicked()), d_diag, SLOT(close()));
1289 connect(
this, SIGNAL(triggered()),
this, SLOT(
getTextDiag()));