##// END OF EJS Templates
Sync
leroy -
r68:44c3f7e01104 default
parent child
Show More
This diff has been collapsed as it changes many lines, (513 lines changed) Show them Hide them
@@ -0,0 +1,513
1 #include "asmpage.h"
2
3 ASMPage::ASMPage(QWidget *parent, unsigned int bufferSize, unsigned int xMAX, unsigned int yMAX) :
4 QMainWindow(parent)
5 {
6 unsigned int i;
7 localBufferSize = bufferSize;
8 // memory allocation of the data buffer
9 dataBuffer = (QByteArray**) malloc( localBufferSize * sizeof(QByteArray*) );
10 for (i=0; i<localBufferSize; i++)
11 {
12 dataBuffer[i] = new QByteArray;
13 }
14
15 pageTitle = "default";
16
17 wfPlot_asm_b1b1 = new WFPlot(this, xMAX, yMAX);
18 wfPlot_asm_b2b2 = new WFPlot(this, xMAX, yMAX);
19 wfPlot_asm_b3b3 = new WFPlot(this, xMAX, yMAX);
20 wfPlot_asm_e1e1 = new WFPlot(this, xMAX, yMAX);
21 wfPlot_asm_e2e2 = new WFPlot(this, xMAX, yMAX);
22
23 wfPlot_asm_b1b1->customPlot->setTitle("b1b1");
24 wfPlot_asm_b2b2->customPlot->setTitle("b2b2");
25 wfPlot_asm_b3b3->customPlot->setTitle("b3b3");
26 wfPlot_asm_e1e1->customPlot->setTitle("e1e1");
27 wfPlot_asm_e2e2->customPlot->setTitle("e2e2");
28
29 dockB1B1 = NULL;
30 dockB2B2 = NULL;
31 dockB3B3 = NULL;
32 dockE1E1 = NULL;
33 dockE2E2 = NULL;
34
35 titleWidgetB1B1 = new QWidget();
36 titleWidgetB2B2 = new QWidget();
37 titleWidgetB3B3 = new QWidget();
38 titleWidgetE1E1 = new QWidget();
39 titleWidgetE2E2 = new QWidget();
40
41 logFileName = new QLabel();
42 logFile = new QFile();
43
44 logFileEn = false;
45 storageEnabled = false;
46 allowDataStorage = false;
47
48 createToolBar();
49 }
50
51 ASMPage::~ASMPage()
52 {
53 unsigned int i;
54 // deallocation of the data buffer
55 for (i=0; i<localBufferSize; i++)
56 {
57 delete dataBuffer[i];
58 }
59 free(dataBuffer);
60 }
61
62 void ASMPage::createToolBar()
63 {
64 radio_b1b1 = new QRadioButton(tr("b1b1"));
65 radio_b2b2 = new QRadioButton(tr("b2b2"));
66 radio_b3b3 = new QRadioButton(tr("b3b3"));
67 radio_e1e1 = new QRadioButton(tr("e1e1"));
68 radio_e2e2 = new QRadioButton(tr("e2e2"));
69 radio_tabify = new QRadioButton(tr("tabify"));
70
71 radio_b1b1->setAutoExclusive(false);
72 radio_b2b2->setAutoExclusive(false);
73 radio_b3b3->setAutoExclusive(false);
74 radio_e1e1->setAutoExclusive(false);
75 radio_e2e2->setAutoExclusive(false);
76 radio_tabify->setAutoExclusive(false);
77
78 button_selectAll = new QPushButton(tr("select all"));
79
80 label_storeWfrm = new QLabel("-");
81
82 myToolBar = new QToolBar("select");
83
84 myToolBar->addWidget(radio_b1b1);
85 myToolBar->addWidget(radio_b2b2);
86 myToolBar->addWidget(radio_b3b3);
87 myToolBar->addWidget(radio_e1e1);
88 myToolBar->addWidget(radio_e2e2);
89 myToolBar->addSeparator();
90 myToolBar->addWidget(button_selectAll);
91 myToolBar->addWidget(radio_tabify);
92 myToolBar->addSeparator();
93 myToolBar->addWidget(label_storeWfrm);
94
95 addToolBar(Qt::LeftToolBarArea, myToolBar);
96
97 radio_tabify->setChecked(true);
98
99 connect(this->radio_b1b1, SIGNAL(clicked(bool)), this, SLOT(actionRadioB1B1(bool)));
100 connect(this->radio_b2b2, SIGNAL(clicked(bool)), this, SLOT(actionRadioB2B2(bool)));
101 connect(this->radio_b3b3, SIGNAL(clicked(bool)), this, SLOT(actionRadioB3B3(bool)));
102 connect(this->radio_e1e1, SIGNAL(clicked(bool)), this, SLOT(actionRadioE1E1(bool)));
103 connect(this->radio_e2e2, SIGNAL(clicked(bool)), this, SLOT(actionRadioE2E2(bool)));
104 connect(this->button_selectAll, SIGNAL(clicked()), this, SLOT(selectAll()));
105 connect(this->radio_tabify, SIGNAL(clicked(bool)), this, SLOT(organizeDocks()));
106 }
107
108 void ASMPage::actionRadioB1B1(bool state)
109 {
110 if (state == true)
111 {
112 if (dockB1B1 == NULL)
113 {
114 dockB1B1 = new QDockWidget("B1B1", this);
115 dockB1B1->setWidget(wfPlot_asm_b1b1);
116 dockB1B1->setTitleBarWidget(titleWidgetB1B1);
117 }
118 }
119 else
120 {
121 this->removeDockWidget(dockB1B1);
122 }
123 organizeDocks();
124 }
125
126 void ASMPage::actionRadioB2B2(bool state)
127 {
128 if (state == true)
129 {
130 if (dockB2B2 == NULL)
131 {
132 dockB2B2 = new QDockWidget("B2B2", this);
133 dockB2B2->setWidget(wfPlot_asm_b2b2);
134 dockB2B2->setTitleBarWidget(titleWidgetB2B2);
135 }
136 }
137 else
138 {
139 this->removeDockWidget(dockB2B2);
140 }
141 organizeDocks();
142 }
143
144 void ASMPage::actionRadioB3B3(bool state)
145 {
146 if (state == true)
147 {
148 if (dockB3B3 == NULL)
149 {
150 dockB3B3 = new QDockWidget("B3B3", this);
151 dockB3B3->setWidget(wfPlot_asm_b3b3);
152 dockB3B3->setTitleBarWidget(titleWidgetB3B3);
153 }
154 }
155 else
156 {
157 this->removeDockWidget(dockB3B3);
158 }
159 organizeDocks();
160 }
161
162 void ASMPage::actionRadioE1E1(bool state)
163 {
164 if (state == true)
165 {
166 if (dockE1E1 == NULL)
167 {
168 dockE1E1 = new QDockWidget("E1E1", this);
169 dockE1E1->setWidget(wfPlot_asm_e1e1);
170 dockE1E1->setTitleBarWidget(titleWidgetE1E1);
171 }
172 }
173 else
174 {
175 this->removeDockWidget(dockE1E1);
176 }
177 organizeDocks();
178 }
179
180 void ASMPage::actionRadioE2E2(bool state)
181 {
182 if (state == true)
183 {
184 if (dockE2E2 == NULL)
185 {
186 dockE2E2 = new QDockWidget("E2E2", this);
187 dockE2E2->setWidget(wfPlot_asm_e2e2);
188 dockE2E2->setTitleBarWidget(titleWidgetE2E2);
189 }
190 }
191 else
192 {
193 this->removeDockWidget(dockE2E2);
194 }
195 organizeDocks();
196 }
197
198 void ASMPage::buildDockList()
199 {
200 dockList.clear();
201
202 if (radio_b1b1->isChecked())
203 {
204 dockList.append(dockB1B1);
205 removeDockWidget(dockB1B1);
206 }
207 if (radio_b2b2->isChecked())
208 {
209 dockList.append(dockB2B2);
210 removeDockWidget(dockB2B2);
211 }
212 if (radio_b3b3->isChecked())
213 {
214 dockList.append(dockB3B3);
215 removeDockWidget(dockB3B3);
216 }
217 if (radio_e1e1->isChecked())
218 {
219 dockList.append(dockE1E1);
220 removeDockWidget(dockE1E1);
221 }
222 if (radio_e2e2->isChecked())
223 {
224 dockList.append(dockE2E2);
225 removeDockWidget(dockE2E2);
226 }
227 }
228
229 void ASMPage::organizeDocks()
230 {
231 if (radio_tabify->isChecked())
232 {
233 tabify();
234 }
235 else
236 {
237 unTabify();
238 }
239 wfPlot_asm_b1b1->resize(wfPlot_asm_b1b1->minimumSizeHint());
240 wfPlot_asm_b2b2->resize(wfPlot_asm_b2b2->minimumSizeHint());
241 wfPlot_asm_b3b3->resize(wfPlot_asm_b3b3->minimumSizeHint());
242 wfPlot_asm_e1e1->resize(wfPlot_asm_e1e1->minimumSizeHint());
243 wfPlot_asm_e2e2->resize(wfPlot_asm_e2e2->minimumSizeHint());
244 this->resize(this->minimumSizeHint());
245 }
246
247 void ASMPage::unTabify()
248 {
249 buildDockList();
250
251 switch(dockList.size())
252 {
253 case 0:
254 break;
255 case 1:
256 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
257 dockList.at(0)->show();
258 break;
259 case 2:
260 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
261 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
262 dockList.at(0)->show();
263 dockList.at(1)->show();
264 break;
265 case 3:
266 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
267 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
268 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(2));
269 dockList.at(0)->show();
270 dockList.at(1)->show();
271 dockList.at(2)->show();
272 break;
273 case 4:
274 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
275 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
276 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(2));
277 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
278 dockList.at(0)->show();
279 dockList.at(1)->show();
280 dockList.at(2)->show();
281 dockList.at(3)->show();
282 break;
283 case 5:
284 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
285 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
286 addDockWidget(Qt::TopDockWidgetArea, dockList.at(2));
287 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
288 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(4));
289 dockList.at(0)->show();
290 dockList.at(1)->show();
291 dockList.at(2)->show();
292 dockList.at(3)->show();
293 dockList.at(4)->show();
294 break;
295 default:
296 break;
297 }
298 }
299
300 void ASMPage::tabify()
301 {
302 buildDockList();
303
304 switch(dockList.size())
305 {
306 case 0:
307 break;
308 case 1:
309 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
310 dockList.at(0)->show();
311 break;
312 case 2:
313 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
314 tabifyDockWidget(dockList.at(0), dockList.at(1));
315 dockList.at(0)->show();
316 dockList.at(1)->show();
317 break;
318 case 3:
319 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
320 tabifyDockWidget(dockList.at(0), dockList.at(1));
321 tabifyDockWidget(dockList.at(1), dockList.at(2));
322 dockList.at(0)->show();
323 dockList.at(1)->show();
324 dockList.at(2)->show();
325 break;
326 case 4:
327 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
328 tabifyDockWidget(dockList.at(0), dockList.at(1));
329 tabifyDockWidget(dockList.at(1), dockList.at(2));
330 tabifyDockWidget(dockList.at(2), dockList.at(3));
331 dockList.at(0)->show();
332 dockList.at(1)->show();
333 dockList.at(2)->show();
334 dockList.at(3)->show();
335 break;
336 case 5:
337 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
338 tabifyDockWidget(dockList.at(0), dockList.at(1));
339 tabifyDockWidget(dockList.at(1), dockList.at(2));
340 tabifyDockWidget(dockList.at(2), dockList.at(3));
341 tabifyDockWidget(dockList.at(3), dockList.at(4));
342 dockList.at(0)->show();
343 dockList.at(1)->show();
344 dockList.at(2)->show();
345 dockList.at(3)->show();
346 dockList.at(4)->show();
347 break;
348 default:
349 break;
350 }
351 }
352
353 void ASMPage::selectAll()
354 {
355 radio_b1b1->click();
356 radio_b2b2->click();
357 radio_b3b3->click();
358 radio_e1e1->click();
359 radio_e2e2->click();
360 }
361
362 void ASMPage::storeWfrm()
363 {
364 if (logFileEn == false)
365 {
366 buildFileName();
367 label_storeWfrm->setText("Recording...");
368 logFileEn = true;
369 }
370 else
371 {
372 // disable storage
373 storageEnabled = false;
374 label_storeWfrm->setText("-");
375 logFileEn = false;
376 }
377 }
378
379 void ASMPage::buildFileName()
380 {
381 QTime time;
382 QDate date;
383 QString dateTime;
384 QString prefix;
385
386 date = QDate::currentDate();
387 time = QTime::currentTime();
388
389 dateTime = QString::number( date.year() ) + "_"
390 + QString::number( date.month() ) + "_"
391 + QString::number( date.day() ) + "-"
392 + QString::number( time.hour() ) + "_"
393 + QString::number( time.minute() ) + "_"
394 + QString::number( time.second() );
395
396 prefix = defaultStorageDirectory + "/" + dateTime + "_" + pageTitle ;
397
398 if(this->logFile->isOpen()) this->logFile->close();
399 this->logFile->setFileName( prefix + ".data");
400 if(this->logFile->open(QIODevice::WriteOnly)) this->logFileStrm = new QTextStream(this->logFile);
401
402 *(this->logFileStrm) << "time V E1 E2 B1 B2 B3" << endl;
403
404 storageEnabled = true;
405
406 }
407
408 void ASMPage::displayOnPlot(float *data, unsigned char num, unsigned char asm_indice_start, double deltaF, unsigned int nbData)
409 {
410 fillDataBuffer( data, num, asm_indice_start, deltaF, nbData );
411
412 switch(num){
413 case 0:
414 wfPlot_asm_b1b1->displayOnPlotFloat(data, nbData);
415 break;
416
417 case 1:
418 wfPlot_asm_b2b2->displayOnPlotFloat(data, nbData);
419 break;
420
421 case 2:
422 wfPlot_asm_b3b3->displayOnPlotFloat(data, nbData);
423 break;
424
425 case 3:
426 wfPlot_asm_e1e1->displayOnPlotFloat(data, nbData);
427 break;
428
429 case 4:
430 wfPlot_asm_e2e2->displayOnPlotFloat(data, nbData);
431 break;
432
433 default:
434 break;
435 }
436 }
437
438 void ASMPage::initDataBuffer()
439 {
440 for (unsigned int i = 0; i < localBufferSize; i++)
441 {
442 dataBuffer[i]->clear();
443 }
444 }
445
446 void ASMPage::fillDataBuffer(float *data, unsigned char num, unsigned char asm_indice_start, double deltaF, unsigned int nbData)
447 {
448 double frequencyBin;
449 QByteArray frequencyBinQByteArray;
450
451 if ( (storageEnabled == true) | (allowDataStorage == true) ) // store data in buffers
452 {
453 switch(num) {
454
455 case 0 :
456 initDataBuffer();
457 frequencyBin = 0;
458 for (unsigned int i=0; i<nbData; i++)
459 {
460 frequencyBin = asm_indice_start * deltaF
461 + deltaF * ((double) i);
462 frequencyBinQByteArray.setNum( frequencyBin, 'f', 10 );
463 dataBuffer[i]->append( frequencyBinQByteArray + ' ' + QByteArray::number(data[i]) );
464 }
465 allowDataStorage = true;
466 break;
467
468 case 1 :
469 case 2 :
470 case 3 :
471 if (allowDataStorage==true) {
472 for (unsigned int i=0; i<nbData; i++)
473 {
474 dataBuffer[i]->append( ' ' + QByteArray::number(data[i]) );
475 }
476 }
477 break;
478
479 case 4 :
480 if (allowDataStorage==true) {
481 for (unsigned int i=0; i<nbData; i++)
482 {
483 dataBuffer[i]->append( ' ' + QByteArray::number(data[i]) );
484 }
485 storeDataBuffer( nbData );
486 allowDataStorage = false;
487 }
488 break;
489
490 default:
491 break;
492
493 }
494 }
495 }
496
497 void ASMPage::storeDataBuffer(unsigned int nbData)
498 {
499 for (unsigned int i = 0; i < nbData; i++ )
500 {
501 *(this->logFileStrm) << *dataBuffer[i] << endl;
502 }
503 if (storageEnabled == false){
504 this->logFileStrm->flush();
505 this->logFile->waitForBytesWritten(3000);
506 this->logFile->close();
507 }
508 }
509
510 void ASMPage::setDefaultStorageDirectory(QString nameOfTheDirectory)
511 {
512 defaultStorageDirectory = nameOfTheDirectory;
513 }
@@ -0,0 +1,97
1 #ifndef ASMPAGE_H
2 #define ASMPAGE_H
3
4 #include <QMainWindow>
5 #include <QFile>
6 #include <QTextStream>
7 #include <QLabel>
8 #include <QRadioButton>
9 #include <QPushButton>
10
11 #include "wfplot.h"
12
13 class ASMPage : public QMainWindow
14 {
15 Q_OBJECT
16 public:
17 explicit ASMPage(QWidget *parent = 0, unsigned int bufferSize = 0, unsigned int xMAX = 0, unsigned int yMAX = 0);
18 ~ASMPage();
19
20 void createToolBar();
21 void buildDockList();
22 void unTabify();
23 void tabify();
24 // STORE
25 void buildFileName();
26
27 bool logFileEn;
28 bool storageEnabled;
29
30 QLabel *logFileName;
31 QLabel *label_storeWfrm;
32
33 QWidget *titleWidgetB1B1;
34 QWidget *titleWidgetB2B2;
35 QWidget *titleWidgetB3B3;
36 QWidget *titleWidgetE1E1;
37 QWidget *titleWidgetE2E2;
38
39 unsigned int localBufferSize;
40 QByteArray **dataBuffer;
41
42 QList<QDockWidget*> dockList;
43
44 QDockWidget *dockB1B1;
45 QDockWidget *dockB2B2;
46 QDockWidget *dockB3B3;
47 QDockWidget *dockE1E1;
48 QDockWidget *dockE2E2;
49
50 QRadioButton *radio_b1b1;
51 QRadioButton *radio_b2b2;
52 QRadioButton *radio_b3b3;
53 QRadioButton *radio_e1e1;
54 QRadioButton *radio_e2e2;
55 QRadioButton *radio_tabify;
56
57 QPushButton *button_selectAll;
58 QPushButton *button_storeWfrm;
59
60 QToolBar *myToolBar;
61
62 WFPlot *wfPlot_asm_b1b1;
63 WFPlot *wfPlot_asm_b2b2;
64 WFPlot *wfPlot_asm_b3b3;
65 WFPlot *wfPlot_asm_e1e1;
66 WFPlot *wfPlot_asm_e2e2;
67
68 QFile *logFile;
69
70 QTextStream *logFileStrm;
71
72 QString pageTitle;
73 QString defaultStorageDirectory;
74
75 void displayOnPlot(float *data, unsigned char num, unsigned char asm_indice_start, double deltaF, unsigned int nbData);
76 void initDataBuffer();
77 void fillDataBuffer(float *data, unsigned char num, unsigned char asm_indice_start, double deltaF, unsigned int nbData);
78 void storeDataBuffer(unsigned int nbData);
79
80 bool allowDataStorage;
81
82 signals:
83
84 public slots:
85 void actionRadioB1B1(bool state);
86 void actionRadioB2B2(bool state);
87 void actionRadioB3B3(bool state);
88 void actionRadioE1E1(bool state);
89 void actionRadioE2E2(bool state);
90 void organizeDocks();
91 void selectAll();
92 void storeWfrm();
93 void setDefaultStorageDirectory(QString nameOfTheDirectory);
94
95 };
96
97 #endif // ASMPAGE_H
This diff has been collapsed as it changes many lines, (580 lines changed) Show them Hide them
@@ -0,0 +1,580
1 #include "pagespectra.h"
2 #include <stdio.h>
3
4 PageSpectra::PageSpectra(QWidget *parent) :
5 QMainWindow(parent)
6 {
7 unsigned int i = 0;
8
9 for (i = 0; i<6; i++)
10 {
11 localIndex[i] = 0;
12 }
13
14 pageTitle = "default";
15 wfPlot_v = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
16 wfPlot_e1 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
17 wfPlot_e2 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
18 wfPlot_b1 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
19 wfPlot_b2 = new WFPlot(this, WFDISPLAY_XMAX, WFDISPLAY_YMAX);
20 //
21 wfPlot_v->customPlot->setTitle("s11");
22 wfPlot_e1->customPlot->setTitle("s22");
23 wfPlot_e2->customPlot->setTitle("s33");
24 wfPlot_b1->customPlot->setTitle("s44");
25 wfPlot_b2->customPlot->setTitle("s55");
26 //
27 /*mainLayout = new QGridLayout;
28 mainLayout->addWidget(wfPlot_v, 0, 0, 1, 1);
29 mainLayout->addWidget(wfPlot_e1, 0, 1, 1, 1);
30 mainLayout->addWidget(wfPlot_e2, 0, 2, 1, 1);
31 mainLayout->addWidget(wfPlot_b1, 1, 0, 1, 1);
32 mainLayout->addWidget(wfPlot_b2, 1, 1, 1, 1);
33 mainLayout->addWidget(wfPlot_b3, 1, 2, 1, 1);*/
34 //
35 dockV = NULL;
36 dockE1 = NULL;
37 dockE2 = NULL;
38 dockB1 = NULL;
39 dockB2 = NULL;
40
41 titleWidgetV = new QWidget();
42 titleWidgetE1 = new QWidget();
43 titleWidgetE2 = new QWidget();
44 titleWidgetB1 = new QWidget();
45 titleWidgetB2 = new QWidget();
46
47 logFileName = new QLabel();
48 logFile = new QFile();
49 logFileV = new QFile();
50 logFileE1 = new QFile();
51 logFileE2 = new QFile();
52 logFileB1 = new QFile();
53 logFileB2 = new QFile();
54
55 logFileEn = false;
56 storageEnabledV = false;
57 storageEnabledE1 = false;
58 storageEnabledE2 = false;
59 storageEnabledB1 = false;
60 storageEnabledB2 = false;
61
62 createToolBar();
63 readSettings();
64 }
65
66 void PageSpectra::displayOnPlot(short *data, unsigned char num)
67 {
68 QByteArray dataByteArray;
69 unsigned int i;
70
71 switch(num){
72 case 0:
73 wfPlot_v->displayOnPlot(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
74 if ( (storageEnabledV == true) && (logFileV->isOpen()) )
75 {
76 for (i=0; i<DEFAULT_SIZE; i++)
77 {
78 dataByteArray.clear();
79 dataByteArray.append(QByteArray::number(localIndex[0]));
80 dataByteArray.append(' ');
81 dataByteArray.append(QByteArray::number(data[i]));
82 *(this->logFileStrmV) << dataByteArray << endl;
83 localIndex[0]++;
84 }
85 }
86 break;
87 case 1:
88 wfPlot_e1->displayOnPlot(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
89 break;
90 case 2:
91 wfPlot_e2->displayOnPlot(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
92 break;
93 case 3:
94 wfPlot_b1->displayOnPlot(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
95 break;
96 case 4:
97 wfPlot_b2->displayOnPlot(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
98 break;
99 default:
100 break;
101 }
102 }
103
104 void PageSpectra::displayOnPlotFloat(float *data, unsigned char num)
105 {
106 QByteArray dataByteArray;
107 unsigned int i;
108
109 switch(num){
110 case 0:
111 wfPlot_v->displayOnPlotFloat(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
112 if ( (storageEnabledV == true) && (logFileV->isOpen()) )
113 {
114 for (i=0; i<DEFAULT_SIZE; i++)
115 {
116 dataByteArray.clear();
117 dataByteArray.append(QByteArray::number(localIndex[0]));
118 dataByteArray.append(' ');
119 dataByteArray.append(QByteArray::number(data[i]));
120 *(this->logFileStrmV) << dataByteArray << endl;
121 localIndex[0]++;
122 }
123 }
124 break;
125 case 1:
126 wfPlot_e1->displayOnPlotFloat(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
127 break;
128 case 2:
129 wfPlot_e2->displayOnPlotFloat(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
130 break;
131 case 3:
132 wfPlot_b1->displayOnPlotFloat(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
133 break;
134 case 4:
135 wfPlot_b2->displayOnPlotFloat(data, WFDISPLAY_DEFAULT_SPECTRA_SIZE);
136 break;
137 default:
138 break;
139 }
140 }
141
142 void PageSpectra::createToolBar()
143 {
144 radio_v = new QRadioButton(tr("s11"));
145 radio_e1 = new QRadioButton(tr("s22"));
146 radio_e2 = new QRadioButton(tr("s33"));
147 radio_b1 = new QRadioButton(tr("s44"));
148 radio_b2 = new QRadioButton(tr("s55"));
149 radio_tabify = new QRadioButton(tr("tabify"));
150
151 radio_v->setAutoExclusive(false);
152 radio_e1->setAutoExclusive(false);
153 radio_e2->setAutoExclusive(false);
154 radio_b1->setAutoExclusive(false);
155 radio_b2->setAutoExclusive(false);
156 radio_tabify->setAutoExclusive(false);
157
158 button_selectAll = new QPushButton(tr("select all"));
159 button_storeWfrm = new QPushButton(tr("REC"));
160 button_chooseDir = new QPushButton(tr("choose dir"));
161
162 myToolBar = new QToolBar("select");
163
164 myToolBar->addWidget(radio_v);
165 myToolBar->addWidget(radio_e1);
166 myToolBar->addWidget(radio_e2);
167 myToolBar->addWidget(radio_b1);
168 myToolBar->addWidget(radio_b2);
169 myToolBar->addSeparator();
170 myToolBar->addWidget(button_selectAll);
171 myToolBar->addWidget(radio_tabify);
172 myToolBar->addSeparator();
173 myToolBar->addWidget(button_storeWfrm);
174 myToolBar->addWidget(button_chooseDir);
175
176 addToolBar(Qt::LeftToolBarArea, myToolBar);
177
178 radio_tabify->setChecked(true);
179
180 connect(this->radio_v, SIGNAL(clicked(bool)), this, SLOT(actionRadioV(bool)));
181 connect(this->radio_e1, SIGNAL(clicked(bool)), this, SLOT(actionRadioE1(bool)));
182 connect(this->radio_e2, SIGNAL(clicked(bool)), this, SLOT(actionRadioE2(bool)));
183 connect(this->radio_b1, SIGNAL(clicked(bool)), this, SLOT(actionRadioB1(bool)));
184 connect(this->radio_b2, SIGNAL(clicked(bool)), this, SLOT(actionRadioB2(bool)));
185 connect(this->button_selectAll, SIGNAL(clicked()), this, SLOT(selectAll()));
186 connect(this->radio_tabify, SIGNAL(clicked(bool)), this, SLOT(organizeDocks()));
187 connect(this->button_storeWfrm, SIGNAL(clicked()), this, SLOT(storeWfrm()));
188 connect(this->button_chooseDir, SIGNAL(clicked()), this, SLOT(chooseDir()));
189 }
190
191 void PageSpectra::actionRadioV(bool state)
192 {
193 if (state == true)
194 {
195 if (dockV == NULL)
196 {
197 dockV = new QDockWidget("V", this);
198 dockV->setWidget(wfPlot_v);
199 dockV->setTitleBarWidget(titleWidgetV);
200 }
201 }
202 else
203 {
204 this->removeDockWidget(dockV);
205 }
206 organizeDocks();
207 }
208
209 void PageSpectra::actionRadioE1(bool state)
210 {
211 if (state == true)
212 {
213 if (dockE1 == NULL)
214 {
215 dockE1 = new QDockWidget("E1", this);
216 dockE1->setWidget(wfPlot_e1);
217 dockE1->setTitleBarWidget(titleWidgetE1);
218 }
219 }
220 else
221 {
222 this->removeDockWidget(dockE1);
223 }
224 organizeDocks();
225 }
226
227 void PageSpectra::actionRadioE2(bool state)
228 {
229 if (state == true)
230 {
231 if (dockE2 == NULL)
232 {
233 dockE2 = new QDockWidget("E2", this);
234 dockE2->setWidget(wfPlot_e2);
235 dockE2->setTitleBarWidget(titleWidgetE2);
236 }
237 }
238 else
239 {
240 this->removeDockWidget(dockE2);
241 }
242 organizeDocks();
243 }
244
245 void PageSpectra::actionRadioB1(bool state)
246 {
247 if (state == true)
248 {
249 if (dockB1 == NULL)
250 {
251 dockB1 = new QDockWidget("B1", this);
252 dockB1->setWidget(wfPlot_b1);
253 dockB1->setTitleBarWidget(titleWidgetB1);
254 }
255 }
256 else
257 {
258 this->removeDockWidget(dockB1);
259 }
260 organizeDocks();
261 }
262
263 void PageSpectra::actionRadioB2(bool state)
264 {
265 if (state == true)
266 {
267 if (dockB2 == NULL)
268 {
269 dockB2 = new QDockWidget("B2", this);
270 dockB2->setWidget(wfPlot_b2);
271 dockB2->setTitleBarWidget(titleWidgetB2);
272 }
273 }
274 else
275 {
276 this->removeDockWidget(dockB2);
277 }
278 organizeDocks();
279 }
280
281 void PageSpectra::buildDockList()
282 {
283 dockList.clear();
284
285 if (radio_v->isChecked())
286 {
287 dockList.append(dockV);
288 removeDockWidget(dockV);
289 }
290 if (radio_e1->isChecked())
291 {
292 dockList.append(dockE1);
293 removeDockWidget(dockE1);
294 }
295 if (radio_e2->isChecked())
296 {
297 dockList.append(dockE2);
298 removeDockWidget(dockE2);
299 }
300 if (radio_b1->isChecked())
301 {
302 dockList.append(dockB1);
303 removeDockWidget(dockB1);
304 }
305 if (radio_b2->isChecked())
306 {
307 dockList.append(dockB2);
308 removeDockWidget(dockB2);
309 }
310 }
311
312 void PageSpectra::organizeDocks()
313 {
314 if (radio_tabify->isChecked())
315 {
316 tabify();
317 }
318 else
319 {
320 unTabify();
321 }
322 wfPlot_v->resize(wfPlot_v->minimumSizeHint());
323 wfPlot_e1->resize(wfPlot_e1->minimumSizeHint());
324 wfPlot_e2->resize(wfPlot_e2->minimumSizeHint());
325 wfPlot_b1->resize(wfPlot_b1->minimumSizeHint());
326 wfPlot_b2->resize(wfPlot_b2->minimumSizeHint());
327 this->resize(this->minimumSizeHint());
328 }
329
330 void PageSpectra::unTabify()
331 {
332 buildDockList();
333
334 switch(dockList.size())
335 {
336 case 0:
337 break;
338 case 1:
339 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
340 dockList.at(0)->show();
341 break;
342 case 2:
343 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
344 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
345 dockList.at(0)->show();
346 dockList.at(1)->show();
347 break;
348 case 3:
349 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
350 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
351 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(2));
352 dockList.at(0)->show();
353 dockList.at(1)->show();
354 dockList.at(2)->show();
355 break;
356 case 4:
357 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
358 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
359 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(2));
360 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
361 dockList.at(0)->show();
362 dockList.at(1)->show();
363 dockList.at(2)->show();
364 dockList.at(3)->show();
365 break;
366 case 5:
367 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
368 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
369 addDockWidget(Qt::TopDockWidgetArea, dockList.at(2));
370 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
371 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(4));
372 dockList.at(0)->show();
373 dockList.at(1)->show();
374 dockList.at(2)->show();
375 dockList.at(3)->show();
376 dockList.at(4)->show();
377 break;
378 default:
379 break;
380 }
381 }
382
383 void PageSpectra::tabify()
384 {
385 buildDockList();
386
387 switch(dockList.size())
388 {
389 case 0:
390 break;
391 case 1:
392 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
393 dockList.at(0)->show();
394 break;
395 case 2:
396 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
397 tabifyDockWidget(dockList.at(0), dockList.at(1));
398 dockList.at(0)->show();
399 dockList.at(1)->show();
400 break;
401 case 3:
402 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
403 tabifyDockWidget(dockList.at(0), dockList.at(1));
404 tabifyDockWidget(dockList.at(1), dockList.at(2));
405 dockList.at(0)->show();
406 dockList.at(1)->show();
407 dockList.at(2)->show();
408 break;
409 case 4:
410 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
411 tabifyDockWidget(dockList.at(0), dockList.at(1));
412 tabifyDockWidget(dockList.at(1), dockList.at(2));
413 tabifyDockWidget(dockList.at(2), dockList.at(3));
414 dockList.at(0)->show();
415 dockList.at(1)->show();
416 dockList.at(2)->show();
417 dockList.at(3)->show();
418 break;
419 case 5:
420 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
421 tabifyDockWidget(dockList.at(0), dockList.at(1));
422 tabifyDockWidget(dockList.at(1), dockList.at(2));
423 tabifyDockWidget(dockList.at(2), dockList.at(3));
424 tabifyDockWidget(dockList.at(3), dockList.at(4));
425 dockList.at(0)->show();
426 dockList.at(1)->show();
427 dockList.at(2)->show();
428 dockList.at(3)->show();
429 dockList.at(4)->show();
430 break;
431 case 6:
432 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
433 tabifyDockWidget(dockList.at(0), dockList.at(1));
434 tabifyDockWidget(dockList.at(1), dockList.at(2));
435 tabifyDockWidget(dockList.at(2), dockList.at(3));
436 tabifyDockWidget(dockList.at(3), dockList.at(4));
437 tabifyDockWidget(dockList.at(4), dockList.at(5));
438 dockList.at(0)->show();
439 dockList.at(1)->show();
440 dockList.at(2)->show();
441 dockList.at(3)->show();
442 dockList.at(4)->show();
443 dockList.at(5)->show();
444 break;
445 default:
446 break;
447 }
448 }
449
450 void PageSpectra::selectAll()
451 {
452 radio_v->click();
453 radio_e1->click();
454 radio_e2->click();
455 radio_b1->click();
456 radio_b2->click();
457 }
458
459 void PageSpectra::storeWfrm()
460 {
461 if (logFileEn == false)
462 {
463 buildFileNames();
464 button_storeWfrm->setText(tr("STOP"));
465 logFileEn = true;
466 }
467 else
468 {
469 if(this->logFileV->isOpen()) this->logFileV->close();
470 if(this->logFileE1->isOpen()) this->logFileE1->close();
471 if(this->logFileE2->isOpen()) this->logFileE2->close();
472 // disable all storage
473 storageEnabledV = false;
474 storageEnabledE1 = false;
475 storageEnabledE2 = false;
476 storageEnabledB1 = false;
477 storageEnabledB2 = false;
478 button_storeWfrm->setText(tr("REC"));
479 logFileEn = false;
480 }
481 }
482
483 void PageSpectra::buildFileNames()
484 {
485 QString date;
486 QString time;
487 QString prefix;
488
489 date = QDate::currentDate().toString();
490 time = QTime::currentTime().toString();
491
492 prefix = defaultStorageDirectory + "/" + date + "_" + time + "_" + pageTitle ;
493
494 if (radio_v->isChecked())
495 {
496 if(this->logFileV->isOpen()) this->logFileV->close();
497 this->logFileV->setFileName( prefix + "_V.data");
498 if(this->logFileV->open(QIODevice::WriteOnly)) this->logFileStrmV = new QTextStream(this->logFileV);
499 storageEnabledV = true;
500 }
501 if (radio_e1->isChecked())
502 {
503 if(this->logFileE1->isOpen()) this->logFileE1->close();
504 this->logFileE1->setFileName( prefix + "_E1.data");
505 if(this->logFileE1->open(QIODevice::WriteOnly)) this->logFileStrmE1 = new QTextStream(this->logFileE1);
506 storageEnabledE1 = true;
507 }
508 if (radio_e2->isChecked())
509 {
510 if(this->logFileE2->isOpen()) this->logFileE2->close();
511 this->logFileE2->setFileName( prefix + "_E2.data");
512 if(this->logFileE2->open(QIODevice::WriteOnly)) this->logFileStrmE2 = new QTextStream(this->logFileE2);
513 storageEnabledE2 = true;
514 }
515 if (radio_b1->isChecked())
516 {
517
518 }
519 if (radio_b2->isChecked())
520 {
521
522 }
523 }
524
525 void PageSpectra::logFileEnDisable(bool state)
526 {
527 if(state==true)
528 {
529 this->logFileEn = true;
530 }
531 else if(state==false)
532 {
533 this->logFileEn = false;
534 }
535 }
536
537 bool PageSpectra::islogfileenable()
538 {
539 return this->logFileEn;
540 }
541
542 void PageSpectra::appendToLogFile(const QString & text)
543 {
544 if(this->logFileEn && this->logFile->isOpen())
545 {
546 *(this->logFileStrm) << text << endl;
547 }
548 }
549
550 void PageSpectra::closeEvent(QCloseEvent *event)
551 {
552 if(this->logFile->isOpen())
553 {
554 this->logFileStrm->flush();
555 this->logFile->waitForBytesWritten(3000);
556 this->logFile->close();
557 }
558 writeSettings();
559 event->accept();
560 }
561
562 void PageSpectra::readSettings()
563 {
564 QSettings settings("lpp", "lfrsgse");
565 defaultStorageDirectory = settings.value("defaultStorageDirectory", QDir::homePath()).toString();
566 }
567
568 void PageSpectra::writeSettings()
569 {
570 QSettings settings("lpp", "lfrsgse");
571 settings.setValue("defaultStorageDirectory", defaultStorageDirectory);
572 }
573
574 void PageSpectra::chooseDir()
575 {
576 defaultStorageDirectory = QFileDialog::getExistingDirectory(this,
577 "choose the directory",
578 QDir::homePath(),
579 QFileDialog::ShowDirsOnly);
580 }
@@ -0,0 +1,125
1 #ifndef PAGESPECTRA_H
2 #define PAGESPECTRA_H
3
4 #include <QMainWindow>
5 #include <QRadioButton>
6 #include <QPushButton>
7 #include <QDockWidget>
8 #include <QToolBar>
9 #include <QLabel>
10 #include <QFile>
11 #include <QTextStream>
12 #include <QFileDialog>
13 #include <QSettings>
14
15 #include <wfplot.h>
16 #include <wfdisplay_params.h>
17
18 class PageSpectra : public QMainWindow
19 {
20 Q_OBJECT
21 public:
22 explicit PageSpectra(QWidget *parent = 0);
23
24 void createToolBar();
25 void buildDockList();
26 void unTabify();
27 void tabify();
28 // STORE
29 void buildFileNames();
30 bool islogfileenable();
31 void appendToLogFile(const QString & text);
32 void closeEvent(QCloseEvent *event);
33 void readSettings();
34 void writeSettings();
35
36 bool logFileEn;
37 bool storageEnabledV;
38 bool storageEnabledE1;
39 bool storageEnabledE2;
40 bool storageEnabledB1;
41 bool storageEnabledB2;
42
43 QLabel *logFileName;
44 QLabel *logFileNameV;
45 QLabel *logFileNameE1;
46 QLabel *logFileNameE2;
47 QLabel *logFileNameB1;
48 QLabel *logFileNameB2;
49
50 QWidget *titleWidgetV;
51 QWidget *titleWidgetE1;
52 QWidget *titleWidgetE2;
53 QWidget *titleWidgetB1;
54 QWidget *titleWidgetB2;
55
56 QList<QDockWidget*> dockList;
57
58 QDockWidget *dockV;
59 QDockWidget *dockE1;
60 QDockWidget *dockE2;
61 QDockWidget *dockB1;
62 QDockWidget *dockB2;
63
64 QRadioButton *radio_v;
65 QRadioButton *radio_e1;
66 QRadioButton *radio_e2;
67 QRadioButton *radio_b1;
68 QRadioButton *radio_b2;
69 QRadioButton *radio_tabify;
70
71 QPushButton *button_selectAll;
72 QPushButton *button_storeWfrm;
73 QPushButton *button_chooseDir;
74
75 QToolBar *myToolBar;
76
77 WFPlot *wfPlot_v;
78 WFPlot *wfPlot_e1;
79 WFPlot *wfPlot_e2;
80 WFPlot *wfPlot_b1;
81 WFPlot *wfPlot_b2;
82
83 QFile *logFile;
84 QFile *logFileV;
85 QFile *logFileE1;
86 QFile *logFileE2;
87 QFile *logFileB1;
88 QFile *logFileB2;
89
90 QTextStream *logFileStrm;
91 QTextStream *logFileStrmV;
92 QTextStream *logFileStrmE1;
93 QTextStream *logFileStrmE2;
94 QTextStream *logFileStrmB1;
95 QTextStream *logFileStrmB2;
96
97 QString pageTitle;
98 QString defaultStorageDirectory;
99
100 unsigned int localIndex[5];
101
102 //QGridLayout *mainLayout;
103
104 void displayOnPlot(short *data, unsigned char num);
105 void displayOnPlotFloat(float *data, unsigned char num);
106
107 signals:
108 void setLogFileName(QString FileName);
109
110 public slots:
111 void actionRadioV(bool state);
112 void actionRadioE1(bool state);
113 void actionRadioE2(bool state);
114 void actionRadioB1(bool state);
115 void actionRadioB2(bool state);
116 void organizeDocks();
117 void selectAll();
118 void storeWfrm();
119 void logFileEnDisable(bool state);
120 void chooseDir();
121
122
123 };
124
125 #endif // PAGESPECTRA_H
@@ -0,0 +1,57
1 #include "wfdisplay.h"
2
3
4 WFDisplay::WFDisplay(QWidget *parent, unsigned int bufferSize, unsigned int xMAX, unsigned int yMAX) :
5 QWidget(parent)
6 {
7 waveforms_LAYOUT = new QVBoxLayout;
8
9 spwTabWidget = new QTabWidget;
10
11 page_f0 = new WFPage( 0, bufferSize, xMAX, yMAX );
12 page_f1 = new WFPage( 0, bufferSize, xMAX, yMAX );
13 page_f2 = new WFPage( 0, bufferSize, xMAX, yMAX );
14 page_f3 = new WFPage( 0, bufferSize, xMAX, yMAX );
15
16 page_f0->pageTitle = "NORM_SWF_F0";
17 page_f1->pageTitle = "NORM_SWF_F1";
18 page_f2->pageTitle = "NORM_SWF_F2";
19 page_f3->pageTitle = "NORM_CWF_F3";
20
21 spwTabWidget->addTab(page_f0, tr("f0 (24576 Hz)"));
22 spwTabWidget->addTab(page_f1, tr("f1 (4096 Hz"));
23 spwTabWidget->addTab(page_f2, tr("f2 (256 Hz)"));
24 spwTabWidget->addTab(page_f3, tr("f3 (16 Hz)"));
25
26 waveforms_LAYOUT->addWidget(spwTabWidget);
27
28 this->setLayout(waveforms_LAYOUT);
29
30 }
31
32 void WFDisplay::displayOnPlot(short *data, unsigned char num_page, unsigned char num,
33 unsigned int coarseTime, unsigned int fineTime, double deltaT, unsigned int nbData)
34 {
35 QVector<double> x(nbData), y(nbData);
36
37 for (unsigned int i=0; i<nbData; ++i)
38 {
39 x[i] = i;
40 y[i] = (double) data[i];
41 }
42 switch(num_page){
43 case 0:
44 page_f0->displayOnPlot(data, num, coarseTime, fineTime, deltaT, nbData);
45 break;
46 case 1:
47 page_f1->displayOnPlot(data, num, coarseTime, fineTime, deltaT, nbData);
48 break;
49 case 2:
50 page_f2->displayOnPlot(data, num, coarseTime, fineTime, deltaT, nbData);
51 break;
52 case 3:
53 page_f3->displayOnPlot(data, num, coarseTime, fineTime, deltaT, nbData);
54 break;
55 }
56
57 }
@@ -0,0 +1,35
1 #ifndef WFDISPLAY_H
2 #define WFDISPLAY_H
3
4 #include <QWidget>
5 #include <QGridLayout>
6 #include <QVBoxLayout>
7 #include <QTabWidget>
8 #include <wfpage.h>
9
10 class WFDisplay : public QWidget
11 {
12 Q_OBJECT
13 public:
14 explicit WFDisplay(QWidget *parent = 0, unsigned int bufferSize = 0, unsigned int xMAX = 0, unsigned int yMAX = 0);
15
16 WFPage * page_f0;
17 WFPage * page_f1;
18 WFPage * page_f2;
19 WFPage * page_f3;
20
21 QTabWidget *spwTabWidget;
22
23 QVBoxLayout *waveforms_LAYOUT;
24
25 void displayOnPlot(short *data, unsigned char num_page, unsigned char num,
26 unsigned int coarseTime, unsigned int fineTime, double deltaT, unsigned int nbData);
27
28 signals:
29
30 public slots:
31
32 };
33
34
35 #endif // WFDISPLAY_H
@@ -0,0 +1,56
1 #-------------------------------------------------
2 #
3 # Project created by QtCreator 2013-05-31T12:59:38
4 #
5 #-------------------------------------------------
6
7 TARGET = wfdisplay
8 TEMPLATE = lib
9 QT += core xml svg network
10
11 contains(QT_MAJOR_VERSION, 5) {
12
13 QT += widgets
14
15 QT += printsupport
16
17 }
18 INCLUDEPATH += \
19 $${PWD} \
20 $$[QT_INSTALL_HEADERS]/lppmon/common
21
22 LIBS += -llppmoncommon
23
24 DEFINES += WFDISPLAY_LIBRARY
25
26 SOURCES += wfdisplay.cpp \
27 wfplot.cpp \
28 wfpage.cpp \
29 pagespectra.cpp \
30 asmpage.cpp
31
32
33 HEADERS += wfdisplay.h\
34 wfplot.h \
35 wfpage.h \
36 wfdisplay_params.h \
37 pagespectra.h \
38 asmpage.h
39
40
41 header.path = $$[QT_INSTALL_HEADERS]/lppmon/wfdisplay
42 header.files = \
43 wfdisplay.h \
44 wfdisplay_global.h \
45 wfpage.h \
46 wfplot.h \
47 wfdisplay_params.h \
48 pagespectra.h \
49 asmpage.h
50
51 target.path = $$[QT_INSTALL_LIBS]
52 isEmpty(target.path) {
53 target.path = $(QTDIR)/lib
54 }
55
56 INSTALLS += header target
@@ -0,0 +1,10
1 #ifndef WFDISPLAY_PARAMS_H
2 #define WFDISPLAY_PARAMS_H
3
4 #define FONT_SIZE_WAVEFORM_TITLE 10
5 #define WFDISPLAY_XMAX 2048
6 #define WFDISPLAY_YMAX 15000
7 #define DEFAULT_SIZE 2048
8 #define WFDISPLAY_DEFAULT_SPECTRA_SIZE 128
9
10 #endif // WFDISPLAY_PARAMS_H
This diff has been collapsed as it changes many lines, (616 lines changed) Show them Hide them
@@ -0,0 +1,616
1 #include "wfpage.h"
2 #include <stdio.h>
3
4 WFPage::WFPage(QWidget *parent, unsigned int bufferSize, unsigned int xMAX, unsigned int yMAX) :
5 QMainWindow(parent)
6 {
7 unsigned int i;
8 localBufferSize = bufferSize;
9 // memory allocation of the data buffer
10 dataBuffer = (QByteArray**) malloc( localBufferSize * sizeof(QByteArray*) );
11 for (i=0; i<localBufferSize; i++)
12 {
13 dataBuffer[i] = new QByteArray;
14 }
15
16 pageTitle = "default";
17 wfPlot_v = new WFPlot(this, xMAX, yMAX);
18 wfPlot_e1 = new WFPlot(this, xMAX, yMAX);
19 wfPlot_e2 = new WFPlot(this, xMAX, yMAX);
20 wfPlot_b1 = new WFPlot(this, xMAX, yMAX);
21 wfPlot_b2 = new WFPlot(this, xMAX, yMAX);
22 wfPlot_b3 = new WFPlot(this, xMAX, yMAX);
23 //
24 wfPlot_v->customPlot->setTitle("v");
25 wfPlot_e1->customPlot->setTitle("e1");
26 wfPlot_e2->customPlot->setTitle("e2");
27 wfPlot_b1->customPlot->setTitle("b1");
28 wfPlot_b2->customPlot->setTitle("b2");
29 wfPlot_b3->customPlot->setTitle("b3");
30 //
31 dockV = NULL;
32 dockE1 = NULL;
33 dockE2 = NULL;
34 dockB1 = NULL;
35 dockB2 = NULL;
36 dockB3 = NULL;
37
38 titleWidgetV = new QWidget();
39 titleWidgetE1 = new QWidget();
40 titleWidgetE2 = new QWidget();
41 titleWidgetB1 = new QWidget();
42 titleWidgetB2 = new QWidget();
43 titleWidgetB3 = new QWidget();
44
45 logFileName = new QLabel();
46 logFile = new QFile();
47
48 logFileEn = false;
49 storageEnabled = false;
50 allowDataStorage = false;
51
52 createToolBar();
53 readSettings();
54 }
55
56 WFPage::~WFPage()
57 {
58 unsigned int i;
59 // deallocation of the data buffer
60 for (i=0; i<localBufferSize; i++)
61 {
62 delete dataBuffer[i];
63 }
64 free(dataBuffer);
65 }
66
67 void WFPage::displayOnPlot(short *data, unsigned char num, unsigned int coarseTime, unsigned int fineTime, double deltaT, unsigned int nbData)
68 {
69 fillDataBuffer( data, num, coarseTime, fineTime, deltaT, nbData );
70
71 switch(num){
72 case 0:
73 wfPlot_v->displayOnPlot(data, nbData);
74 break;
75
76 case 1:
77 wfPlot_e1->displayOnPlot(data, nbData);
78 break;
79
80 case 2:
81 wfPlot_e2->displayOnPlot(data, nbData);
82 break;
83
84 case 3:
85 wfPlot_b1->displayOnPlot(data, nbData);
86 break;
87
88 case 4:
89 wfPlot_b2->displayOnPlot(data, nbData);
90 break;
91
92 case 5:
93 wfPlot_b3->displayOnPlot(data, nbData);
94 break;
95 }
96 }
97
98 void WFPage::initDataBuffer()
99 {
100 for (unsigned int i = 0; i < localBufferSize; i++)
101 {
102 dataBuffer[i]->clear();
103 }
104 }
105
106 void WFPage::fillDataBuffer(short *data, unsigned char num, unsigned int coarseTime, unsigned int fineTime, double deltaT, unsigned int nbData)
107 {
108 double sampleTime;
109 QByteArray sampleTimeQByteArray;
110
111 if ( (storageEnabled == true) | (allowDataStorage==true) ) // store data in buffers
112 {
113 switch(num) {
114
115 case 0 :
116 initDataBuffer();
117 sampleTime = 0;
118 for (unsigned int i=0; i<nbData; i++)
119 {
120 sampleTime = (double) (coarseTime)
121 + ((double) (fineTime)) * 1. / 65536.
122 + deltaT * ((double) i);
123 sampleTimeQByteArray.setNum( sampleTime, 'f', 10 );
124 dataBuffer[i]->append( sampleTimeQByteArray + ' ' + QByteArray::number(data[i]) );
125 }
126 allowDataStorage = true;
127 break;
128
129 case 1 :
130 case 2 :
131 case 3 :
132 case 4 :
133 if (allowDataStorage==true) {
134 for (unsigned int i=0; i<nbData; i++)
135 {
136 dataBuffer[i]->append( ' ' + QByteArray::number(data[i]) );
137 }
138 }
139 break;
140
141 case 5 :
142 if (allowDataStorage==true) {
143 for (unsigned int i=0; i<nbData; i++)
144 {
145 dataBuffer[i]->append( ' ' + QByteArray::number(data[i]) );
146 }
147 storeDataBuffer( nbData );
148 allowDataStorage = false;
149 }
150 break;
151
152 default:
153 break;
154
155 }
156 }
157 }
158
159 void WFPage::storeDataBuffer( unsigned int nbData)
160 {
161 for (unsigned int i = 0; i < nbData; i++ )
162 {
163 *(this->logFileStrm) << *dataBuffer[i] << endl;
164 }
165 if (storageEnabled == false){
166 this->logFileStrm->flush();
167 this->logFile->waitForBytesWritten(3000);
168 this->logFile->close();
169 }
170 }
171
172 void WFPage::createToolBar()
173 {
174 radio_v = new QRadioButton(tr("v"));
175 radio_e1 = new QRadioButton(tr("e1"));
176 radio_e2 = new QRadioButton(tr("e2"));
177 radio_b1 = new QRadioButton(tr("b1"));
178 radio_b2 = new QRadioButton(tr("b2"));
179 radio_b3 = new QRadioButton(tr("b3"));
180 radio_tabify = new QRadioButton(tr("tabify"));
181
182 radio_v->setAutoExclusive(false);
183 radio_e1->setAutoExclusive(false);
184 radio_e2->setAutoExclusive(false);
185 radio_b1->setAutoExclusive(false);
186 radio_b2->setAutoExclusive(false);
187 radio_b3->setAutoExclusive(false);
188 radio_tabify->setAutoExclusive(false);
189
190 button_selectAll = new QPushButton(tr("select all"));
191
192 label_storeWfrm = new QLabel("-");
193
194 myToolBar = new QToolBar("select");
195
196 myToolBar->addWidget(radio_v);
197 myToolBar->addWidget(radio_e1);
198 myToolBar->addWidget(radio_e2);
199 myToolBar->addWidget(radio_b1);
200 myToolBar->addWidget(radio_b2);
201 myToolBar->addWidget(radio_b3);
202 myToolBar->addSeparator();
203 myToolBar->addWidget(button_selectAll);
204 myToolBar->addWidget(radio_tabify);
205 myToolBar->addSeparator();
206 myToolBar->addWidget(label_storeWfrm);
207
208 addToolBar(Qt::LeftToolBarArea, myToolBar);
209
210 radio_tabify->setChecked(true);
211
212 connect(this->radio_v, SIGNAL(clicked(bool)), this, SLOT(actionRadioV(bool)));
213 connect(this->radio_e1, SIGNAL(clicked(bool)), this, SLOT(actionRadioE1(bool)));
214 connect(this->radio_e2, SIGNAL(clicked(bool)), this, SLOT(actionRadioE2(bool)));
215 connect(this->radio_b1, SIGNAL(clicked(bool)), this, SLOT(actionRadioB1(bool)));
216 connect(this->radio_b2, SIGNAL(clicked(bool)), this, SLOT(actionRadioB2(bool)));
217 connect(this->radio_b3, SIGNAL(clicked(bool)), this, SLOT(actionRadioB3(bool)));
218 connect(this->button_selectAll, SIGNAL(clicked()), this, SLOT(selectAll()));
219 connect(this->radio_tabify, SIGNAL(clicked(bool)), this, SLOT(organizeDocks()));
220 }
221
222 void WFPage::actionRadioV(bool state)
223 {
224 if (state == true)
225 {
226 if (dockV == NULL)
227 {
228 dockV = new QDockWidget("V", this);
229 dockV->setWidget(wfPlot_v);
230 dockV->setTitleBarWidget(titleWidgetV);
231 }
232 }
233 else
234 {
235 this->removeDockWidget(dockV);
236 }
237 organizeDocks();
238 }
239
240 void WFPage::actionRadioE1(bool state)
241 {
242 if (state == true)
243 {
244 if (dockE1 == NULL)
245 {
246 dockE1 = new QDockWidget("E1", this);
247 dockE1->setWidget(wfPlot_e1);
248 dockE1->setTitleBarWidget(titleWidgetE1);
249 }
250 }
251 else
252 {
253 this->removeDockWidget(dockE1);
254 }
255 organizeDocks();
256 }
257
258 void WFPage::actionRadioE2(bool state)
259 {
260 if (state == true)
261 {
262 if (dockE2 == NULL)
263 {
264 dockE2 = new QDockWidget("E2", this);
265 dockE2->setWidget(wfPlot_e2);
266 dockE2->setTitleBarWidget(titleWidgetE2);
267 }
268 }
269 else
270 {
271 this->removeDockWidget(dockE2);
272 }
273 organizeDocks();
274 }
275
276 void WFPage::actionRadioB1(bool state)
277 {
278 if (state == true)
279 {
280 if (dockB1 == NULL)
281 {
282 dockB1 = new QDockWidget("B1", this);
283 dockB1->setWidget(wfPlot_b1);
284 dockB1->setTitleBarWidget(titleWidgetB1);
285 }
286 }
287 else
288 {
289 this->removeDockWidget(dockB1);
290 }
291 organizeDocks();
292 }
293
294 void WFPage::actionRadioB2(bool state)
295 {
296 if (state == true)
297 {
298 if (dockB2 == NULL)
299 {
300 dockB2 = new QDockWidget("B2", this);
301 dockB2->setWidget(wfPlot_b2);
302 dockB2->setTitleBarWidget(titleWidgetB2);
303 }
304 }
305 else
306 {
307 this->removeDockWidget(dockB2);
308 }
309 organizeDocks();
310 }
311
312 void WFPage::actionRadioB3(bool state)
313 {
314 if (state == true)
315 {
316 if (dockB3 == NULL)
317 {
318 dockB3 = new QDockWidget("B3", this);
319 dockB3->setWidget(wfPlot_b3);
320 dockB3->setTitleBarWidget(titleWidgetB3);
321 }
322 }
323 else
324 {
325 this->removeDockWidget(dockB3);
326 }
327 organizeDocks();
328 }
329
330 void WFPage::buildDockList()
331 {
332 dockList.clear();
333
334 if (radio_v->isChecked())
335 {
336 dockList.append(dockV);
337 removeDockWidget(dockV);
338 }
339 if (radio_e1->isChecked())
340 {
341 dockList.append(dockE1);
342 removeDockWidget(dockE1);
343 }
344 if (radio_e2->isChecked())
345 {
346 dockList.append(dockE2);
347 removeDockWidget(dockE2);
348 }
349 if (radio_b1->isChecked())
350 {
351 dockList.append(dockB1);
352 removeDockWidget(dockB1);
353 }
354 if (radio_b2->isChecked())
355 {
356 dockList.append(dockB2);
357 removeDockWidget(dockB2);
358 }
359 if (radio_b3->isChecked())
360 {
361 dockList.append(dockB3);
362 removeDockWidget(dockB3);
363 }
364 }
365
366 void WFPage::organizeDocks()
367 {
368 if (radio_tabify->isChecked())
369 {
370 tabify();
371 }
372 else
373 {
374 unTabify();
375 }
376 wfPlot_v->resize(wfPlot_v->minimumSizeHint());
377 wfPlot_e1->resize(wfPlot_e1->minimumSizeHint());
378 wfPlot_e2->resize(wfPlot_e2->minimumSizeHint());
379 wfPlot_b1->resize(wfPlot_b1->minimumSizeHint());
380 wfPlot_b2->resize(wfPlot_b2->minimumSizeHint());
381 wfPlot_b3->resize(wfPlot_b3->minimumSizeHint());
382 this->resize(this->minimumSizeHint());
383 }
384
385 void WFPage::unTabify()
386 {
387 buildDockList();
388
389 switch(dockList.size())
390 {
391 case 0:
392 break;
393 case 1:
394 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
395 dockList.at(0)->show();
396 break;
397 case 2:
398 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
399 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
400 dockList.at(0)->show();
401 dockList.at(1)->show();
402 break;
403 case 3:
404 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
405 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
406 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(2));
407 dockList.at(0)->show();
408 dockList.at(1)->show();
409 dockList.at(2)->show();
410 break;
411 case 4:
412 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
413 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
414 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(2));
415 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
416 dockList.at(0)->show();
417 dockList.at(1)->show();
418 dockList.at(2)->show();
419 dockList.at(3)->show();
420 break;
421 case 5:
422 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
423 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
424 addDockWidget(Qt::TopDockWidgetArea, dockList.at(2));
425 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
426 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(4));
427 dockList.at(0)->show();
428 dockList.at(1)->show();
429 dockList.at(2)->show();
430 dockList.at(3)->show();
431 dockList.at(4)->show();
432 break;
433 case 6:
434 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
435 addDockWidget(Qt::TopDockWidgetArea, dockList.at(1));
436 addDockWidget(Qt::TopDockWidgetArea, dockList.at(2));
437 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(3));
438 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(4));
439 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(5));
440 dockList.at(0)->show();
441 dockList.at(1)->show();
442 dockList.at(2)->show();
443 dockList.at(3)->show();
444 dockList.at(4)->show();
445 dockList.at(5)->show();
446 break;
447 default:
448 break;
449 }
450 }
451
452 void WFPage::tabify()
453 {
454 buildDockList();
455
456 switch(dockList.size())
457 {
458 case 0:
459 break;
460 case 1:
461 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
462 dockList.at(0)->show();
463 break;
464 case 2:
465 addDockWidget(Qt::TopDockWidgetArea, dockList.at(0));
466 tabifyDockWidget(dockList.at(0), dockList.at(1));
467 dockList.at(0)->show();
468 dockList.at(1)->show();
469 break;
470 case 3:
471 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
472 tabifyDockWidget(dockList.at(0), dockList.at(1));
473 tabifyDockWidget(dockList.at(1), dockList.at(2));
474 dockList.at(0)->show();
475 dockList.at(1)->show();
476 dockList.at(2)->show();
477 break;
478 case 4:
479 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
480 tabifyDockWidget(dockList.at(0), dockList.at(1));
481 tabifyDockWidget(dockList.at(1), dockList.at(2));
482 tabifyDockWidget(dockList.at(2), dockList.at(3));
483 dockList.at(0)->show();
484 dockList.at(1)->show();
485 dockList.at(2)->show();
486 dockList.at(3)->show();
487 break;
488 case 5:
489 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
490 tabifyDockWidget(dockList.at(0), dockList.at(1));
491 tabifyDockWidget(dockList.at(1), dockList.at(2));
492 tabifyDockWidget(dockList.at(2), dockList.at(3));
493 tabifyDockWidget(dockList.at(3), dockList.at(4));
494 dockList.at(0)->show();
495 dockList.at(1)->show();
496 dockList.at(2)->show();
497 dockList.at(3)->show();
498 dockList.at(4)->show();
499 break;
500 case 6:
501 addDockWidget(Qt::BottomDockWidgetArea, dockList.at(0));
502 tabifyDockWidget(dockList.at(0), dockList.at(1));
503 tabifyDockWidget(dockList.at(1), dockList.at(2));
504 tabifyDockWidget(dockList.at(2), dockList.at(3));
505 tabifyDockWidget(dockList.at(3), dockList.at(4));
506 tabifyDockWidget(dockList.at(4), dockList.at(5));
507 dockList.at(0)->show();
508 dockList.at(1)->show();
509 dockList.at(2)->show();
510 dockList.at(3)->show();
511 dockList.at(4)->show();
512 dockList.at(5)->show();
513 break;
514 default:
515 break;
516 }
517 }
518
519 void WFPage::selectAll()
520 {
521 radio_v->click();
522 radio_e1->click();
523 radio_e2->click();
524 radio_b1->click();
525 radio_b2->click();
526 radio_b3->click();
527 }
528
529 void WFPage::storeWfrm()
530 {
531 if (logFileEn == false)
532 {
533 buildFileName();
534 label_storeWfrm->setText("Recording...");
535 logFileEn = true;
536 }
537 else
538 {
539 // disable storage
540 storageEnabled = false;
541 label_storeWfrm->setText("-");
542 logFileEn = false;
543 }
544 }
545
546 void WFPage::buildFileName()
547 {
548 QTime time;
549 QDate date;
550 QString dateTime;
551 QString prefix;
552
553 date = QDate::currentDate();
554 time = QTime::currentTime();
555
556 dateTime = QString::number( date.year() ) + "_"
557 + QString::number( date.month() ) + "_"
558 + QString::number( date.day() ) + "-"
559 + QString::number( time.hour() ) + "_"
560 + QString::number( time.minute() ) + "_"
561 + QString::number( time.second() );
562
563 prefix = defaultStorageDirectory + "/" + dateTime + "_" + pageTitle ;
564
565 if(this->logFile->isOpen()) this->logFile->close();
566 this->logFile->setFileName( prefix + ".data");
567 if(this->logFile->open(QIODevice::WriteOnly)) this->logFileStrm = new QTextStream(this->logFile);
568
569 *(this->logFileStrm) << "time V E1 E2 B1 B2 B3" << endl;
570
571 storageEnabled = true;
572
573 }
574
575 void WFPage::logFileEnDisable(bool state)
576 {
577 if(state==true)
578 {
579 this->logFileEn = true;
580 }
581 else if(state==false)
582 {
583 this->logFileEn = false;
584 }
585 }
586
587 void WFPage::closeEvent(QCloseEvent *event)
588 {
589 writeSettings();
590 event->accept();
591 }
592
593 void WFPage::readSettings()
594 {
595 QSettings settings("lpp", "lfrsgse");
596 defaultStorageDirectory = settings.value("defaultStorageDirectory", QDir::homePath()).toString();
597 }
598
599 void WFPage::writeSettings()
600 {
601 QSettings settings("lpp", "lfrsgse");
602 settings.setValue("defaultStorageDirectory", defaultStorageDirectory);
603 }
604
605 void WFPage::chooseDir()
606 {
607 defaultStorageDirectory = QFileDialog::getExistingDirectory(this,
608 "choose the directory",
609 QDir::homePath(),
610 QFileDialog::ShowDirsOnly);
611 }
612
613 void WFPage::setDefaultStorageDirectory(QString nameOfTheDirectory)
614 {
615 defaultStorageDirectory = nameOfTheDirectory;
616 }
@@ -0,0 +1,112
1 #ifndef WFPAGE_H
2 #define WFPAGE_H
3
4 #include <QMainWindow>
5 #include <QRadioButton>
6 #include <QPushButton>
7 #include <QDockWidget>
8 #include <QToolBar>
9 #include <QLabel>
10 #include <QFile>
11 #include <QTextStream>
12 #include <QFileDialog>
13 #include <QSettings>
14
15 #include <wfplot.h>
16 #include <wfdisplay_params.h>
17
18 class WFPage : public QMainWindow
19 {
20 Q_OBJECT
21 public:
22 explicit WFPage(QWidget *parent = 0, unsigned int bufferSize = 0, unsigned int xMAX = 0, unsigned int yMAX = 0);
23 ~WFPage();
24
25 void createToolBar();
26 void buildDockList();
27 void unTabify();
28 void tabify();
29 // STORE
30 void buildFileName();
31 void closeEvent(QCloseEvent *event);
32 void readSettings();
33 void writeSettings();
34
35 bool logFileEn;
36 bool storageEnabled;
37
38 QLabel *logFileName;
39 QLabel *label_storeWfrm;
40
41 QWidget *titleWidgetV;
42 QWidget *titleWidgetE1;
43 QWidget *titleWidgetE2;
44 QWidget *titleWidgetB1;
45 QWidget *titleWidgetB2;
46 QWidget *titleWidgetB3;
47
48 unsigned int localBufferSize;
49 QByteArray **dataBuffer;
50
51 QList<QDockWidget*> dockList;
52
53 QDockWidget *dockV;
54 QDockWidget *dockE1;
55 QDockWidget *dockE2;
56 QDockWidget *dockB1;
57 QDockWidget *dockB2;
58 QDockWidget *dockB3;
59
60 QRadioButton *radio_v;
61 QRadioButton *radio_e1;
62 QRadioButton *radio_e2;
63 QRadioButton *radio_b1;
64 QRadioButton *radio_b2;
65 QRadioButton *radio_b3;
66 QRadioButton *radio_tabify;
67
68 QPushButton *button_selectAll;
69 QPushButton *button_storeWfrm;
70
71 QToolBar *myToolBar;
72
73 WFPlot *wfPlot_v;
74 WFPlot *wfPlot_e1;
75 WFPlot *wfPlot_e2;
76 WFPlot *wfPlot_b1;
77 WFPlot *wfPlot_b2;
78 WFPlot *wfPlot_b3;
79
80 QFile *logFile;
81
82 QTextStream *logFileStrm;
83
84 QString pageTitle;
85 QString defaultStorageDirectory;
86
87 void displayOnPlot(short *data, unsigned char num, unsigned int coarseTime, unsigned int fineTime, double deltaT, unsigned int nbData);
88 void initDataBuffer();
89 void fillDataBuffer(short *data, unsigned char num, unsigned int coarseTime, unsigned int fineTime, double deltaT, unsigned int nbData);
90 void storeDataBuffer(unsigned int nbData);
91
92 bool allowDataStorage;
93
94 signals:
95
96 public slots:
97 void actionRadioV(bool state);
98 void actionRadioE1(bool state);
99 void actionRadioE2(bool state);
100 void actionRadioB1(bool state);
101 void actionRadioB2(bool state);
102 void actionRadioB3(bool state);
103 void organizeDocks();
104 void selectAll();
105 void storeWfrm();
106 void logFileEnDisable(bool state);
107 void chooseDir();
108 void setDefaultStorageDirectory(QString nameOfTheDirectory);
109
110 };
111
112 #endif // WFPAGE_H
@@ -0,0 +1,61
1 #include "wfplot.h"
2 #include <QFontInfo>
3 #include <wfdisplay_params.h>
4
5 WFPlot::WFPlot(QWidget *parent, unsigned int xmax, unsigned int ymax) :
6 QWidget(parent)
7 {
8 // Create Fonts
9 QFont font;
10 font = QFont(this->fontInfo().family(), FONT_SIZE_WAVEFORM_TITLE, QFont::Light);
11 customPlot = new LppMonPlot();
12 mainLayout = new QVBoxLayout();
13
14 customPlot->setXaxisRange(0, xmax);
15 customPlot->setYaxisRange(-ymax, ymax);
16 //customPlot->setTitleFont(font);
17
18 customPlot->addGraph();
19
20 mainLayout->addWidget(customPlot);
21
22 this->setLayout(mainLayout);
23 }
24
25 void WFPlot::displayOnPlot(short *data, unsigned int size)
26 {
27 QList<QVariant> qListX;
28 QList<QVariant> qListY;
29 qListX.clear();
30 qListY.clear();
31
32 for (unsigned int i=0; i<size; ++i)
33 {
34 qListX.append(i);
35 qListY.append( (double) data[i] );
36 }
37
38 customPlot->setGraphData(0, qListX, qListY);
39 //customPlot->rescaleAxis();
40 }
41
42 void WFPlot::displayOnPlotFloat(float *data, unsigned int size)
43 {
44 QList<QVariant> qListX;
45 QList<QVariant> qListY;
46 qListX.clear();
47 qListY.clear();
48
49 for (unsigned int i=0; i<size; ++i)
50 {
51 qListX.append(i);
52 qListY.append( (double) data[i] );
53 }
54
55 customPlot->setGraphData(0, qListX, qListY);
56 //customPlot->rescaleAxis();
57 }
58
59
60
61
@@ -0,0 +1,26
1 #ifndef WFPLOT_H
2 #define WFPLOT_H
3
4 #include <QWidget>
5 #include <QVBoxLayout>
6 #include <lppmonplot.h>
7
8 class WFPlot : public QWidget
9 {
10 Q_OBJECT
11 public:
12 explicit WFPlot(QWidget *parent = 0, unsigned int xmax = 0, unsigned int ymax = 0);
13
14 void displayOnPlot(short *data, unsigned int size);
15 void displayOnPlotFloat(float *data, unsigned int size);
16
17 LppMonPlot *customPlot;
18 QVBoxLayout *mainLayout;
19
20 signals:
21
22 public slots:
23
24 };
25
26 #endif // WFPLOT_H
@@ -5,6 +5,9 win32:LPPMONCFG = /opt/lppmon
5 unix:LPPMONCFG = /etc/lppmon
5 unix:LPPMONCFG = /etc/lppmon
6
6
7 SUBDIRS = \
7 SUBDIRS = \
8 rmapplugin
8 rmapplugin \
9 parameterdump \
10 wfdisplay \
11 paulcommon
9
12
10 #include( $${LPPMONCFG}/lppmonplugin.prf)
13 #include( $${LPPMONCFG}/lppmonplugin.prf)
@@ -1,6 +1,6
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.1, 2013-12-20T07:21:44. -->
3 <!-- Written by QtCreator 3.0.1, 2014-04-14T10:04:11. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -15,13 +15,13
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
@@ -58,6 +58,7
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -113,7 +114,6
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
118 </valuemap>
118 </valuemap>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
@@ -145,7 +145,6
145 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
145 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
146 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
146 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
147 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
147 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
148 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
149 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
148 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
150 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
149 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
151 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
150 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
@@ -155,8 +154,12
155 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
154 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
156 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
155 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
157 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
156 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
157 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
158 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
158 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
159 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
159 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
160 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
161 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
162 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
160 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
163 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
161 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
164 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
162 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
165 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
@@ -205,6 +208,6
205 </data>
208 </data>
206 <data>
209 <data>
207 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
210 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
208 <value type="int">14</value>
211 <value type="int">15</value>
209 </data>
212 </data>
210 </qtcreator>
213 </qtcreator>
@@ -1,7 +1,7
1 #ifndef RMAPOPERATIONS_H
1 #ifndef RMAPOPERATIONS_H
2 #define RMAPOPERATIONS_H
2 #define RMAPOPERATIONS_H
3
3
4 #include "qhexspinbox.h"
4 #include <qhexspinbox.h>
5 #include <params.h>
5 #include <params.h>
6
6
7 #define READ_WRITE_MAX_COUNTS 4096 // in words
7 #define READ_WRITE_MAX_COUNTS 4096 // in words
1 NO CONTENT: file was removed
NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (5362 lines changed) Show them Hide them
1 NO CONTENT: file was removed
NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (513 lines changed) Show them Hide them
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (580 lines changed) Show them Hide them
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (616 lines changed) Show them Hide them
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now