-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
77 lines (62 loc) · 2.82 KB
/
main.cpp
File metadata and controls
77 lines (62 loc) · 2.82 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
#include "mainwindow.h"
#include <QApplication>
#include <QCommandLineParser>
#include <QThreadPool>
#include "camerahandler.h"
#include "processor.h"
int main(int argc, char *argv[])
{
setbuf(stdout, NULL);
QApplication a(argc, argv);
QCommandLineParser parser;
parser.addPositionalArgument("playback file",".aedat file to be played.");
QCommandLineOption minimizeOption("min","Minimize application on start.");
parser.addOption(minimizeOption);
QCommandLineOption maximizeOption("max","Maximize application on start.");
parser.addOption(maximizeOption);
QCommandLineOption minYSpeedThresholdOpt("minSpeed","Minimal fall speed threshold for fall detection.", "minSpeed");
parser.addOption(minYSpeedThresholdOpt);
QCommandLineOption maxYSpeedThresholdOpt("maxSpeed","Maximal fall speed threshold for fall detection.", "maxSpeed");
parser.addOption(maxYSpeedThresholdOpt);
QCommandLineOption fallYCenterThresholdOpt("fallY","Lower bound for y coordinate to be a valid fall (Y axis points down!).", "fallY");
parser.addOption(fallYCenterThresholdOpt);
QCommandLineOption unfallYCenterThresholdOpt("unfallY","Lower bound for y coordinate to undo a fall (Y axis points down!)", "unfallY");
parser.addOption(unfallYCenterThresholdOpt);
parser.process(a);
const QStringList args = parser.positionalArguments();
QString minYSpeed = parser.value(minYSpeedThresholdOpt);
QString maxYSpeed = parser.value(maxYSpeedThresholdOpt);
QString fallYCenter = parser.value(fallYCenterThresholdOpt);
QString unfallYCenter = parser.value(unfallYCenterThresholdOpt);
bool minimized = parser.isSet(minimizeOption);
bool maximized = parser.isSet(maximizeOption);
tSettings settings;
if(!minYSpeed.isEmpty()) {
settings.fall_detector_y_speed_min_threshold = minYSpeed.toDouble();
}
if(!maxYSpeed.isEmpty()) {
settings.fall_detector_y_speed_max_threshold = maxYSpeed.toDouble();
}
if(!fallYCenter.isEmpty()) {
settings.fall_detector_y_center_threshold_fall = fallYCenter.toDouble();
}
if(!unfallYCenter.isEmpty()) {
settings.fall_detector_y_center_threshold_unfall = unfallYCenter.toDouble();
}
qDebug("y_speed_max_threshold: %f", settings.fall_detector_y_speed_max_threshold);
qDebug("y_speed_min_threshold: %f", settings.fall_detector_y_speed_min_threshold);
qDebug("y_center_threshold_fall: %f", settings.fall_detector_y_center_threshold_fall);
qDebug("y_center_threshold_unfall: %f", settings.fall_detector_y_center_threshold_unfall);
MainWindow w(settings,nullptr);
if(minimized)
w.showMinimized();
else if(maximized)
w.showMaximized();
else
w.show();
if(args.size() >= 1) {
w.playFile(args.at(0));
}
w.setSettings(settings);
return a.exec();
}