-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (34 loc) · 1.16 KB
/
main.cpp
File metadata and controls
41 lines (34 loc) · 1.16 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
#include "logmediator.hpp"
#include "mainwindow.hpp"
#include <QApplication>
#include <QLoggingCategory>
static void _messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
std::string_view cat = context.category;
if(!cat.starts_with("qt.multimedia"))
return;
QString severity;
if(type == QtMsgType::QtFatalMsg)
severity = "[FATAL] ";
if(type == QtMsgType::QtCriticalMsg)
severity = "[CRITICAL] ";
if(type == QtMsgType::QtWarningMsg)
severity = "[WARNING] ";
if(type == QtMsgType::QtInfoMsg)
severity = "[INFO] ";
if(type == QtMsgType::QtDebugMsg)
severity = "[DEBUG] ";
QString formattedMsg = severity + qFormatLogMessage(type, context, msg);
LogMediator::instance().handleNewLogMessage(formattedMsg);
}
int main(int argc, char *argv[])
{
qInstallMessageHandler(_messageHandler);
QLoggingCategory::setFilterRules(QStringLiteral("qt.multimedia.debug=true"));
QCoreApplication::setOrganizationName("KlasterK");
QCoreApplication::setApplicationName("RecCore");
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}