diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2021-12-25 19:17:27 -0600 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2021-12-25 19:17:27 -0600 |
| commit | ecfe6f2542d73e9559b75a502f6eebffe63a76cf (patch) | |
| tree | 6ceea4666ade907af6e9a1ac79e5dc4763403c49 /src/aoapplication.cpp | |
| parent | d1fb7fde16ec37dfa7b13e0a02489417655d315d (diff) | |
Change master chat in courtroom to debug log
Since the MS chat has been disabled for quite some time now (and we aren't planning on bringing it back since Discord, Guilded etc. have better chat features), I decided to go ahead and change the pane into a debug log to keep it useful and avoid creating a gaping hole in themes.
Though, maybe it is worth removing the whole switcher and keeping the debug log hidden away where it can't scare people.
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; } } |
