-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
70 lines (65 loc) · 1.91 KB
/
main.cpp
File metadata and controls
70 lines (65 loc) · 1.91 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
#include "mainwindow.h"
#include <QApplication>
/**
* \brief Me
* \param type Type of message
* \param context Mesffs redo thissage context
* \param msg Message
*/
void RovUIMessageHandler(QtMsgType type, const QMessageLogContext &context,
const QString &msg) {
QByteArray localMsg = msg.toLocal8Bit();
#ifdef __QTDEBUG__
const char *file = context.file ? context.file : "";
const char *function = context.function ? context.function : "";
#endif
switch (type) {
case QtDebugMsg:
#ifdef __QTDEBUG__
fprintf(stdout, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), file,
context.line, function);
#else
fprintf(stdout, "Debug: %s\n", localMsg.constData());
#endif
break;
case QtInfoMsg:
#ifdef __QTDEBUG__
fprintf(stdout, "Info: %s (%s:%u, %s)\n", localMsg.constData(), file,
context.line, function);
#else
fprintf(stdout, "Info: %s\n", localMsg.constData());
#endif
break;
case QtWarningMsg:
#ifdef __QTDEBUG__
fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), file,
context.line, function);
#else
fprintf(stderr, "Warning: %s\n", localMsg.constData());
#endif
break;
case QtCriticalMsg:
#ifdef __QTDEBUG__
fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(),
file, context.line, function);
#else
fprintf(stderr, "Critical: %s\n", localMsg.constData());
#endif
break;
case QtFatalMsg:
#ifdef __QTDEBUG__
fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), file,
context.line, function);
#else
fprintf(stderr, "Fatal: %s\n", localMsg.constData());
#endif
break;
}
}
int main(int argc, char *argv[]) {
qInstallMessageHandler(RovUIMessageHandler);
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}