-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (39 loc) · 961 Bytes
/
main.cpp
File metadata and controls
44 lines (39 loc) · 961 Bytes
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
#include "main_window.h"
#include "debug.h"
void message_handler(QtMsgType type, const char *message)
{
QString text;
switch (type){
case QtDebugMsg:
text = QString("Debug: %1").arg(message);
break;
case QtWarningMsg:
text = QString("Warning: %1").arg(message);
break;
case QtCriticalMsg:
text = QString("Critical: %1").arg(message);
break;
case QtFatalMsg:
text = QString("Fatal: %1").arg(message);
break;
default:
text = QString("Unknown message type: %1").arg(message);
break;
}
QFile log("debug.log");
log.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream log_stream(&log);
log_stream << text << endl;
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
#ifdef LOG_TO_FILE
qInstallMsgHandler(message_handler);
#endif
QCoreApplication::setOrganizationName("p4programing");
QCoreApplication::setApplicationName("shex");
main_window window;
window.show();
return a.exec();
}