-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.cpp
52 lines (43 loc) · 2.07 KB
/
main.cpp
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
#include <QApplication>
#include <mycallback.h>
#include <mainwindow.h>
#include <hardware/emotiv/sbs2emotivdatareader.h>
#include <hardware/filereader/sbs2filedatareader.h>
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCommandLineParser parser;
QCommandLineOption dataFilePath("datafile","File to read instead of device", "filepath");
parser.addOption(dataFilePath);
parser.addHelpOption();
parser.process(app);
qDebug() << "catalogPath: "<<Sbs2Common::setDefaultCatalogPath();
qDebug() << "rootAppPath: "<<Sbs2Common::setDefaultRootAppPath();
MyCallback* myCallback = new MyCallback();
#ifndef Q_OS_ANDROID
Sbs2DataReader* sbs2DataReader = nullptr;
if (!parser.isSet(dataFilePath))
{
sbs2DataReader = Sbs2EmotivDataReader::New(myCallback,0);
}
else
{
sbs2DataReader = new Sbs2FileDataReader(myCallback,parser.value(dataFilePath));
}
#else
Sbs2DataReader* sbs2DataReader = new Sbs2FileDataReader(myCallback,"assets:/sbs2data_2018_12_01_21_07_22_Test.raw");
#endif
MainWindow* mw = new MainWindow(myCallback);
mw->setAttribute(Qt::WA_QuitOnClose);
QObject::connect(&app,SIGNAL(aboutToQuit()),mw->glwidget,SLOT(kill()));
QObject::connect(&app,SIGNAL(aboutToQuit()),sbs2DataReader,SLOT(aboutToQuit()));
QObject::connect(myCallback,SIGNAL(valueSignal(int)),mw->glwidget,SLOT(update(int)));
QObject::connect(myCallback,SIGNAL(gyroSignal(int,int)),mw->glwidget,SLOT(gyroSlot(int,int)));
QObject::connect(mw->glwidget, SIGNAL(turnFilterOn(int, int)),
myCallback, SLOT(turnFilterOn(int, int)));
QObject::connect(mw->glwidget,SIGNAL(turnFilterOff()),myCallback,SLOT(turnFilterOff()));
QObject::connect(mw->glwidget,SIGNAL(turnSpectrogramOn(int,int,int)),myCallback,SLOT(turnChannelSpectrogramOn(int,int,int)));
QObject::connect(mw->glwidget,SIGNAL(turnSpectrogramOff()),myCallback,SLOT(turnChannelSpectrogramOff()));
QObject::connect(myCallback,SIGNAL(spectrogramUpdated()),mw->glwidget,SLOT(updateSpectro()));
return app.exec();
}