-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.cpp
More file actions
778 lines (708 loc) · 27 KB
/
Copy pathmain.cpp
File metadata and controls
778 lines (708 loc) · 27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
/* Qt includes */
#include <QApplication>
#include <QDesktopWidget>
#include <QPixmap>
#include <QSplashScreen>
#include <QStyle>
#include <QThread>
#include <QTime>
#include <QTimer>
#include <cstdio>
#include <stdlib.h>
#include <QDebug>
/* LiveView includes */
#include "mainwindow.h"
#include "qcustomplot.h"
#include "frame_worker.h"
#include "startupOptions.h"
/* If the macros to define the development environment are not defined at compile time, use defaults */
#ifndef HOST
#define HOST "unknown location"
#endif
/* If the macros to define the version author are not defined at compile time, use defaults */
#ifndef UNAME
#define UNAME "unknown person"
#endif
// These are here for the purpose of easily finding the strings within the binary.
const volatile char* COMPILE_INFO_STR = "---------- Compile-time information (CTIF) string: ----------";
const volatile char* DATE_COMPILE_STR = " CTIF Compile Date: " __DATE__;
const volatile char* GIT_BRANCH_STR = " CTIF Git Branch: " GIT_BRANCH;
const volatile char* GIT_CURRENT_SHA1_STR = " CTIF Git SHA1: " GIT_CURRENT_SHA1;
const volatile char* SRC_DIR_STR = " CTIF Source Directory: " SRC_DIR;
const volatile char* COMPILE_INFO_END_STR = "-------------------------------------------------------------";
/*! \file */
/*! \mainpage \header View live plots of focal plane data
* Live View is a Qt frontend GUI for backend, it displays focal plane data and basic analysis
* (such as the std. dev, dark subtraction, FFT, Spectral Profile, and Video Savant-like playback). Plots are
* implemented using the QCustomPlot (http://www.qcustomplot.com) library, which generates live color maps, bar graphs,
* and line graphs within the Qt C++ environment.
* \paragraph
*
* Live View is designed to be sufficiently modular that it will plot any data with known geometry, up to a maximum word size
* of 16 bits. To implement new hardware or modify existing parameters, changes must be made to the backend software.
*
* \author This documentation and comments in Live View and backend were written by Jackie Ryan
*/
int main(int argc, char *argv[])
{
/* Step 0: Set environment variables: */
#ifndef QT_DEBUG
(void)putenv((char*)"QT_LOGGING_RULES=*=false");
#endif
// If the GUI does not scale correctly,
// this may be enabled to fix it.
// (void)putenv((char*)"QT_AUTO_SCREEN_SCALE_FACTOR=1");
/* Step 1: Setup this QApplication */
//QApplication::setGraphicsSystem("raster"); //This is intended to make 2D rendering faster
QApplication a(argc, argv);
//a.setStyle(QStyleFactory::create("Fusion"));
a.setOrganizationDomain("jpl.nasa.gov");
a.setOrganizationName("FlightView");
a.setApplicationDisplayName("FlightView");
a.setApplicationName("FlightView");
QString cmdName = QString("%1").arg(argv[0]);
QString helptext = QString("\nUsage: %1 -d --debug, -f --flight --no-gps \n"
"--no-camera --datastoragelocation /path/to/storage --gpsIP 10.0.0.6 \n"
"--gpsport 5661 \n"
"--no-stddev --stddev-n 100 --xiocam --rtpcam \n"
"--rtpnextgen \n"
"--rtpheight 480 \n"
"--rtpwidth 1280 \n"
"--rtpaddress 1.2.3.4 \n"
"--rtpinterface eth2 \n"
"--er2 --headless \n"
"--instrumentprefix AV3\n"
"--wfpreview \n"
"--wfpreviewcontinuous \n"
"--wfpreviewlocation /path/to/waterfallpreview/files/ \n"
"-v --version \n"
"--rotate (rotates image 90 degrees)\n"
"--remap (reorder pixels for some cameras)\n"
"--swap (swap spatial and spectral)\n"
"--darkreffile /path/to/dark_file.raw (uint16 frames)\n"
"--darkreffilefloat /path/to/dark_file_float.raw (single float32 frame)\n"
"--whitereffile /path/to/white_file.raw (uint16 frames)\n"
"--whitereffilefloat /path/to/white_file_float.raw (single float32 frame)\n"
"--udplogginghost 1.2.3.4\n"
"--udploggingport 10175\n"
"--zmqlogginghost 1.2.3.4\n"
"--zmqloggingport 54321\n"
"--frameskip n\n"
"--stats (show frame processing timing statistics)\n"
)\
.arg(cmdName);
QString currentArg;
startupOptionsType startupOptions;
startupOptions.debug = false;
startupOptions.flightMode = false;
startupOptions.disableCamera = false;
startupOptions.xioCam = false;
startupOptions.rtpCam = false;
startupOptions.disableGPS = false;
startupOptions.dataLocation = QString("/data");
startupOptions.gpsIP = QString("10.0.0.6");
startupOptions.gpsPort = 8111;
startupOptions.gpsPortSet = true;
startupOptions.xioDirectoryArray = (char*)calloc(4096, sizeof(char));
if(startupOptions.xioDirectoryArray == NULL)
abort();
startupOptions.targetFPS = 50.0;
bool heightSet = false;
bool widthSet = false;
bool rtpInterfaceSet = false;
bool rtpAddressSet = false;
bool haveZmqHost = false;
bool haveZmqPort = false;
// Basic CLI argument parser:
for(int c=1; c < argc; c++)
{
currentArg = QString(argv[c]).toLower();
if(currentArg == "-d" || currentArg == "--debug")
{
startupOptions.debug = true;
}
if(currentArg == "-v" || currentArg == "--version")
{
printf("%s\n", COMPILE_INFO_STR);
printf("%s\n", DATE_COMPILE_STR);
printf("%s\n", GIT_BRANCH_STR);
printf("%s\n", GIT_CURRENT_SHA1_STR);
printf(" Link to commit: https://github.com/nasa-jpl/LiveViewLegacy/tree/" GIT_CURRENT_SHA1_SHORT "\n");
printf("%s\n", SRC_DIR_STR);
printf("%s\n", COMPILE_INFO_END_STR);
exit(0);
}
if(currentArg == "-f" || currentArg == "--flight")
{
startupOptions.flightMode = true;
}
if(currentArg == "--showmore") {
startupOptions.showMore = true;
}
if(currentArg == "--no-gps")
{
startupOptions.disableGPS = true;
}
if(currentArg == "--no-camera")
{
startupOptions.disableCamera = true;
}
if(currentArg == "--er2") {
startupOptions.er2mode = true;
}
if(currentArg == "--headless") {
startupOptions.headless = true;
}
if(currentArg == "--instrumentprefix") {
if(argc > c)
{
startupOptions.instrumentPrefix = argv[c+1];
startupOptions.haveInstrumentPrefix = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--datastoragelocation")
{
if(argc > c)
{
startupOptions.dataLocation = argv[c+1];
startupOptions.dataLocationSet = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if( (currentArg == "--darkreffile") || (currentArg == "--darkreferencefile") ) {
if(argc > c)
{
// Datatype is uint16, will read entire file and average
startupOptions.darkReferenceFileLocation = argv[c+1];
startupOptions.darkRefFileSet = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if( (currentArg == "--darkreffilefloat") || (currentArg == "--darkreferencefilefloat")
|| (currentArg == "--darkreffloat") || (currentArg == "--darkreferencefloat")) {
if(argc > c)
{
// Datatype is float, use as-is
startupOptions.darkReferenceFileLocation = argv[c+1];
startupOptions.darkRefFileSet = true;
startupOptions.darkRefFileFloat = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if( (currentArg == "--whitereffile") || (currentArg == "--whitereferencefile") ) {
if(argc > c)
{
startupOptions.whitereffile = argv[c+1];
startupOptions.whitereffileSet = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if( (currentArg == "--whitereffilefloat") || (currentArg == "--whitereferencefilefloat")
|| (currentArg == "--whitereffloat") || (currentArg == "--whitereferencefloat")) {
if(argc > c)
{
startupOptions.whitereffile = argv[c+1];
startupOptions.whitereffileSet = true;
startupOptions.whiteRefFileIsFloat = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--rtpcam")
{
startupOptions.rtpCam = true;
}
if(currentArg == "--rtpnextgen") {
startupOptions.rtpNextGen = true;
}
if(currentArg == "--rtprgb") {
startupOptions.rtprgb = true;
}
if( (currentArg == "--rtpgray") || (currentArg == "--rtpgrey") ) {
startupOptions.rtprgb = false;
}
if(currentArg == "--rtpheight")
{
if(argc > c)
{
int rtpheighttemp = 0;
bool ok = false;
rtpheighttemp = QString(argv[c+1]).toUInt(&ok);
if(ok)
{
heightSet = true;
startupOptions.rtpHeight = rtpheighttemp;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--rtpwidth")
{
if(argc > c)
{
int rtpwidthtemp = 0;
bool ok = false;
rtpwidthtemp = QString(argv[c+1]).toUInt(&ok);
if(ok)
{
widthSet = true;
startupOptions.rtpWidth = rtpwidthtemp;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--frameskip") {
if(argc > c) {
int frameSkipNumber = 0;
bool ok = false;
frameSkipNumber = QString(argv[c+1]).toUInt(&ok);
if(ok) {
// insert struct here...
startupOptions.frameSkipSet = true;
startupOptions.frameSkip = frameSkipNumber;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--stats") {
startupOptions.showStats = true;
}
if(currentArg == "--rtpinterface")
{
if(argc > c)
{
startupOptions.rtpInterface = argv[c+1];
rtpInterfaceSet = true;
startupOptions.havertpInterface = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--rtpaddress")
{
if(argc > c)
{
startupOptions.rtpAddress = argv[c+1];
rtpAddressSet = true;
startupOptions.havertpAddress = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--rtpport")
{
if(argc > c)
{
int rtpPortTemp = 0;
bool ok=false;
rtpPortTemp = QString(argv[c+1]).toUInt(&ok);
if(ok)
{
startupOptions.rtpPort = rtpPortTemp;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
//
if(currentArg == "--xiocam")
{
startupOptions.xioCam = true;
}
if(currentArg == "--xioheight")
{
if(argc > c)
{
int xioheighttemp = 0;
bool ok = false;
xioheighttemp = QString(argv[c+1]).toUInt(&ok);
if(ok)
{
heightSet = true;
startupOptions.xioHeight = xioheighttemp;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--xiowidth")
{
if(argc > c)
{
int xiowidthtemp = 0;
bool ok = false;
xiowidthtemp = QString(argv[c+1]).toUInt(&ok);
if(ok)
{
widthSet = true;
startupOptions.xioWidth = xiowidthtemp;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--targetfps")
{
if(argc > c)
{
float targetfpstemp = 0;
bool ok = false;
targetfpstemp = QString(argv[c+1]).toFloat(&ok);
if(ok)
{
startupOptions.targetFPS = targetfpstemp;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--laggy") {
startupOptions.laggy = true;
std::cout << "WARNING, laggy mode enabled." << std::endl;
}
if(currentArg == "--gpsip")
{
// Only IPV4 supported, and no hostnames please, let's not depend upon DNS or resolv in the airplane...
if((argc > c) && QString(argv[c+1]).contains(QRegularExpression("(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})")))
{
startupOptions.gpsIP = argv[c+1];
startupOptions.gpsIPSet = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--gpsport")
{
if(argc > c)
{
int portTemp=0;
bool ok = false;
portTemp = QString(argv[c+1]).toInt(&ok);
if(ok)
{
startupOptions.gpsPort = portTemp;
startupOptions.gpsPortSet = true;
c++;
} else {
std::cerr << "Invalid GPS Port set." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
}
if( (currentArg == "--zmqlogginghost") || (currentArg == "--zmqhost") ) {
if(argc > c) {
startupOptions.zmqLoggingHost = argv[c+1];
haveZmqHost = true;
c++;
} else {
std::cerr << "Error, don't see ZMQ logging host specified." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if( (currentArg == "--zmqloggingport") || (currentArg == "--zmqport") ) {
if(argc > c) {
int portTemp=0;
bool ok = false;
portTemp = QString(argv[c+1]).toInt(&ok);
if( portTemp > 65535 )
ok = false;
if(ok) {
startupOptions.zmqLoggingPort = portTemp;
haveZmqPort = true;
} else {
std::cerr << "Error, don't see ZMQ logging port number specified." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
} else {
std::cerr << "Error, don't see ZMQ logging port number specified." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if( (currentArg == "--udploghost") || (currentArg == "--udplogginghost")) {
if(argc > c) {
// Only IPV4 supported, and no hostnames please, let's not depend upon DNS or resolv in the airplane...
if((argc > c) && QString(argv[c+1]).contains(QRegularExpression("(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})")))
{
startupOptions.UDPLogHost = argv[c+1];
startupOptions.UDPLogging = true;
c++;
} else {
std::cerr << "Invalid UDP Logging IP address set. Only IPV4 addresses are acceptable." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
}
if( (currentArg == "--udplogport") || (currentArg == "--udploggingport") )
{
if(argc > c)
{
int portTemp=0;
bool ok = false;
portTemp = QString(argv[c+1]).toInt(&ok);
if(ok)
{
startupOptions.UDPLogPort = portTemp;
c++;
} else {
std::cerr << "Invalid UDP Logging Port set." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
}
if( (currentArg == "--no-stddev") || (currentArg == "--no-stdev")
|| (currentArg == "--nostdev") || (currentArg == "--nostddev") )
{
startupOptions.runStdDevCalculation = false;
}
if( (currentArg == "--stddev-n") || (currentArg == "--stddevn") )
{
if(argc > c)
{
startupOptions.stdDevN = atoi(argv[c+1]);
startupOptions.stdDevNSet = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if( (currentArg == "--shm")) {
startupOptions.useSHM = true;
}
if( (currentArg == "--no-gpu") || (currentArg == "--nogpu") ) {
startupOptions.noGPU = true;
startupOptions.runStdDevCalculation = false;
}
if( currentArg == "--rotate") {
startupOptions.rotate = true;
}
if( currentArg == "--remap") {
startupOptions.remapPixels = true;
}
if( currentArg == "--swap") {
startupOptions.swapSpatialSpectral = true;
}
if(currentArg == "--wfpreview") {
startupOptions.wfPreviewEnabled = true;
}
if(currentArg == "--wfpreviewcontinuous") {
startupOptions.wfPreviewContinuousMode = true;
startupOptions.wfPreviewEnabled = true;
}
if(currentArg == "--wfpreviewlocation") {
if(argc > c)
{
startupOptions.wfPreviewLocation = argv[c+1];
startupOptions.wfPreviewlocationset = true;
c++;
} else {
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(currentArg == "--help" || currentArg == "-h" || currentArg.contains("?"))
{
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
}
if(startupOptions.rtpCam)
{
if(!rtpAddressSet)
startupOptions.rtpAddress = NULL;
if(!rtpInterfaceSet)
startupOptions.rtpInterface = NULL;
std::cout << "Debug output for RTP camera: \n";
std::cout << "rtpHeight: " << startupOptions.rtpHeight << std::endl;
std::cout << "rtpWidth: " << startupOptions.rtpWidth << std::endl;
std::cout << "rtpPort: " << startupOptions.rtpPort << std::endl;
if(startupOptions.rtpInterface != NULL)
std::cout << "rtpInterface: " << startupOptions.rtpInterface << std::endl;
if(startupOptions.rtpAddress != NULL)
std::cout << "rtpAddress: " << startupOptions.rtpAddress << std::endl;
if(startupOptions.rtpNextGen) {
std::cout << "Using RTP NextGen code" << std::endl;
}
if(widthSet && heightSet)
{
startupOptions.heightWidthSet = true;
} else {
startupOptions.heightWidthSet = false;
}
}
if(startupOptions.flightMode && !startupOptions.dataLocationSet)
{
system("xmessage \"Error, flight mode requires --datastoragelocation\"");
std::cerr << "Error, flight mode specified without data storage location." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
if(startupOptions.flightMode && startupOptions.dataLocation.isEmpty())
{
system("xmessage \"Error, flight mode requires --datastoragelocation with valid path set\"");
std::cerr << "Error, flight mode specified without complete data storage location." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
if(startupOptions.flightMode && !startupOptions.gpsIPSet && !startupOptions.disableGPS)
{
system("xmessage \"Error, flight mode requires --gpsip with GPS ip address specified.\"");
std::cerr << "Error, flight mode specified without GPS IP address." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
if(startupOptions.flightMode && startupOptions.disableGPS)
{
std::cout << "WARNING:, flight mode specified with disabled GPS." << std::endl;
}
if( startupOptions.rtpCam && ((int)heightSet + (int)widthSet != 2))
{
// XOR, only one was set
system("xmessage \"Error, RTP requires both height and width to be specified.\"");
std::cerr << "Error, RTP mode requires both height and width to be specified." << std::endl;
std::cout << helptext.toStdString() << std::endl;
exit(-1);
}
if(heightSet && widthSet)
{
startupOptions.heightWidthSet = true;
}
if(haveZmqHost && haveZmqPort) {
startupOptions.zmqLogging = true;
}
if(startupOptions.wfPreviewEnabled && (!startupOptions.wfPreviewlocationset)) {
std::cerr << "Warning, waterfall preview option enabled but --wfpreviewlocation was not set." << std::endl;
}
/* Step 2: Load the splash screen */
QString logoPath;
if(startupOptions.flightMode)
{
logoPath = ":images/aviris3-logo.png";
} else {
logoPath = ":images/aviris-logo-transparent.png";
}
QPixmap logo_pixmap(logoPath);
QSplashScreen *splash = new QSplashScreen(logo_pixmap);
if(! (startupOptions.xioCam || startupOptions.headless))
{
// On some displays, the splash screen covers the setup dialog box
splash->show();
splash->showMessage(QObject::tr(" "),
Qt::WindowStaysOnTopHint | Qt::AlignCenter | Qt::AlignBottom, Qt::black);
}
/* Step 3: Load the parallel worker object which will act as a "backend" for LiveView */
frameWorker *fw = new frameWorker(startupOptions);
QThread *workerThread = new QThread();
fw->moveToThread(workerThread);
QObject::connect(workerThread, SIGNAL(started()), fw, SLOT(captureFrames()));
/* Step 4: Display version author message in the console */
std::cout << "This version of LiveView was compiled on " << __DATE__ << " at " << __TIME__<< " using gcc " << __GNUC__ << std::endl;
std::cout << "The compilation was performed by " << UNAME << " @ " << HOST << std::endl;
/* Step 5: Open the main window (GUI/frontend) */
MainWindow w(&startupOptions, workerThread, fw);
if(!startupOptions.headless) {
w.setGeometry( QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
w.size(),
QGuiApplication::screens().at(0)->availableGeometry()
));
}
QPixmap icon_pixmap(":images/icon.png");
w.setWindowIcon(QIcon(icon_pixmap));
if(! (startupOptions.xioCam || startupOptions.headless))
splash->raise();
w.show();
if(! (startupOptions.xioCam || startupOptions.headless))
splash->raise();
splash->finish(&w);
/* Step 6: Close out the backend after the frontend is closed */
int retval = a.exec();
#ifdef VERBOSE
qDebug() << "Goodbye!";
#endif
fw->stop();
delete fw;
#ifdef VERBOSE
qDebug() << "about to exit workerThread";
#endif
workerThread->exit(0);
#ifdef VERBOSE
qDebug() << "waiting on workerThread";
#endif
workerThread->wait();
#ifdef VERBOSE
qDebug() << "deleting on workerThread";
#endif
delete workerThread;
if(startupOptions.xioDirectoryArray != NULL)
free(startupOptions.xioDirectoryArray);
return retval;
}