aboutsummaryrefslogtreecommitdiff
path: root/src/aoapplication.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-12-30 20:31:44 -0600
committeroldmud0 <oldmud0@users.noreply.github.com>2021-12-30 20:31:44 -0600
commitee76c2ce61f6996bfae3ef027eaee8485d455c95 (patch)
treec70e266cad00d0adf27be8fa51a07e13de9828db /src/aoapplication.cpp
parentecfb791e483234308b1edacb87e499860a63e510 (diff)
parent593bd54000be14c9a1455914285c1b2549b0fa51 (diff)
Merge branch 'master' into feature/http-ms
# Conflicts: # src/networkmanager.cpp
Diffstat (limited to 'src/aoapplication.cpp')
-rw-r--r--src/aoapplication.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp
index 3d37c32f..3a91aece 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.
@@ -18,6 +27,9 @@ AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
discord = new AttorneyOnline::Discord();
asset_lookup_cache.reserve(2048);
+
+ message_handler_context = this;
+ original_message_handler = qInstallMessageHandler(message_handler);
}
AOApplication::~AOApplication()
@@ -26,12 +38,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;
}
@@ -56,7 +69,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;
}
@@ -68,7 +81,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;
}
@@ -85,14 +98,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;
}
@@ -203,7 +216,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;
}
}