diff options
Diffstat (limited to 'src/aoapplication.cpp')
| -rw-r--r-- | src/aoapplication.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 4a5ed52a..b50cc7ad 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -8,6 +8,15 @@ #include "aocaseannouncerdialog.h" #include "aooptionsdialog.h" +static QtMessageHandler original_message_handler; +static AOApplication *message_handler_context; +void message_handler(QtMsgType type, const QMessageLogContext &context, + const QString &msg) +{ + emit message_handler_context->qt_log_message(type, context, msg); + original_message_handler(type, context, msg); +} + AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv) { // Create the QSettings class that points to the config.ini. @@ -20,6 +29,9 @@ AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv) this, &AOApplication::ms_connect_finished); asset_lookup_cache.reserve(2048); + + message_handler_context = this; + original_message_handler = qInstallMessageHandler(message_handler); } AOApplication::~AOApplication() @@ -28,12 +40,13 @@ AOApplication::~AOApplication() destruct_courtroom(); delete discord; delete configini; + qInstallMessageHandler(original_message_handler); } void AOApplication::construct_lobby() { if (lobby_constructed) { - qDebug() << "W: lobby was attempted constructed when it already exists"; + qWarning() << "lobby was attempted constructed when it already exists"; return; } @@ -58,7 +71,7 @@ void AOApplication::construct_lobby() void AOApplication::destruct_lobby() { if (!lobby_constructed) { - qDebug() << "W: lobby was attempted destructed when it did not exist"; + qWarning() << "lobby was attempted destructed when it did not exist"; return; } @@ -70,7 +83,7 @@ void AOApplication::destruct_lobby() void AOApplication::construct_courtroom() { if (courtroom_constructed) { - qDebug() << "W: courtroom was attempted constructed when it already exists"; + qWarning() << "courtroom was attempted constructed when it already exists"; return; } @@ -87,14 +100,14 @@ void AOApplication::construct_courtroom() w_courtroom, &Courtroom::skip_clocks); } else { - qDebug() << "W: demo server did not exist during courtroom construction"; + qWarning() << "demo server did not exist during courtroom construction"; } } void AOApplication::destruct_courtroom() { if (!courtroom_constructed) { - qDebug() << "W: courtroom was attempted destructed when it did not exist"; + qWarning() << "courtroom was attempted destructed when it did not exist"; return; } @@ -232,7 +245,7 @@ void AOApplication::initBASS() BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); load_bass_opus_plugin(); - qDebug() << info.name << "was set as the default audio output device."; + qInfo() << info.name << "was set as the default audio output device."; return; } } |
