-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
68 lines (55 loc) · 1.78 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//#include <QtCore/QCoreApplication>
#include <QApplication>
#include "server.h"
#include <iostream>
#include "abstractrobot.h"
#include "robotfactory.h"
#include "config.h"
#include "visiontime.h"
#include "imagecalibrationtool.h"
using namespace std;
void myMessageHandler(QtMsgType type, const QMessageLogContext &, const QString & msg)
{
QString txt = QTime::currentTime().toString("hh:mm:ss.zzz ");
switch (type) {
case QtDebugMsg:
txt += QString("Debug: %1").arg(msg);
break;
case QtWarningMsg:
txt += QString("Warning: %1").arg(msg);
break;
case QtCriticalMsg:
txt += QString("Critical: %1").arg(msg);
break;
case QtFatalMsg:
txt += QString("Fatal: %1").arg(msg);
break;
}
// QFile outFile("~/Desktop/log.txt");
QFile outFile("/home/robot/Desktop/log.txt");
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
ts << txt << endl;
}
int main(int argc, char *argv[])
{
//Visiontime init
//VisionTime::DO()->turnOn();
VisionTime::DO()->setStartMeasuringFromFrame(100);
VisionTime::DO()->setMeasureNumberOfFrames(30);
// QCoreApplication a(argc, argv);
QApplication a(argc,argv);
Config & conf = Config::getConfig(/*argn,argv*/);
conf.setConfig(argc,argv);
// ?? cout << "new QTcpServer" << endl;
AbstractRobot * robot = RobotFactory::getRobot(conf.getRobotName());
//Slider stuff
// QApplication app(argc, argv);
// qInstallMessageHandler(myMessageHandler); // text file logging
ImageCalibrationTool *window = new ImageCalibrationTool();
window->setWindowTitle(QString::fromUtf8("Botmaster 2k18 Image Calibration tool"));
window->show();
//Slider stuff end
robot->go();
return a.exec();
}