-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
42 lines (40 loc) · 1.3 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
#include "robot.h"
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#ifdef TEST
#include "Test/tst_sherpa.h"
#include <QTest>
QTEST_GUILESS_MAIN(tst_sherpa);
#else
#ifdef BREAKPAD
#include "client/linux/handler/exception_handler.h"
#include "Utils/config.h"
static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor,
void *context, bool succeeded) {
qInfo() << "Dump path:" << descriptor.path();
return succeeded;
}
#endif
int main(int argc, char *argv[]) {
QCoreApplication a(argc, argv);
// 设置PWD
QString applicationDirPathStr = QCoreApplication::applicationDirPath();
QDir::setCurrent(applicationDirPathStr);
#ifdef BREAKPAD
google_breakpad::MinidumpDescriptor descriptor(
Config::getDataPath("Tmp").toStdString()); // minidump文件写入到的目录
google_breakpad::ExceptionHandler eh(descriptor, NULL, dumpCallback, NULL,
true, -1);
#endif
QCoreApplication::addLibraryPath(QDir::homePath() +
"/.config/QSmartAssistant/plugins/lib");
Robot *robot = new Robot(&a);
robot->start();
a.connect(&a, &QCoreApplication::aboutToQuit, &a, [=]() {
qDebug() << "stop";
robot->stop();
});
return a.exec();
}
#endif