|
22 | 22 |
|
23 | 23 | #include <QApplication>
|
24 | 24 | #include "mainwindow.h"
|
| 25 | +#include <stdio.h> |
| 26 | +#include <stdlib.h> |
| 27 | + |
| 28 | +void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) |
| 29 | +{ |
| 30 | + QByteArray localMsg = msg.toLocal8Bit(); |
| 31 | + if (localMsg.contains("link outline hasn't been detected!") || |
| 32 | + localMsg.contains("iCCP: known incorrect sRGB profile")) { return; } |
| 33 | + switch (type) { |
| 34 | + case QtDebugMsg: |
| 35 | + fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); |
| 36 | + break; |
| 37 | + case QtInfoMsg: |
| 38 | + fprintf(stderr, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); |
| 39 | + break; |
| 40 | + case QtWarningMsg: |
| 41 | + fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); |
| 42 | + break; |
| 43 | + case QtCriticalMsg: |
| 44 | + fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); |
| 45 | + break; |
| 46 | + case QtFatalMsg: |
| 47 | + fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); |
| 48 | + abort(); |
| 49 | + } |
| 50 | +} |
25 | 51 |
|
26 | 52 | /**
|
27 | 53 | * @brief main function
|
|
31 | 57 | */
|
32 | 58 | int main(int argc, char *argv[]) {
|
33 | 59 |
|
| 60 | + qInstallMessageHandler(msgHandler); |
34 | 61 | QApplication app(argc, argv);
|
35 | 62 | QApplication::setOrganizationName(APP);
|
36 | 63 | QApplication::setApplicationName("dracolinux");
|
|
0 commit comments