Merge pull request #623 from AttorneyOnline/feature/debug-log
Remove MS chat and add debug log
This commit is contained in:
		
						commit
						a180600bf4
					
				@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 7c036c09ddfadc2680a2c5dbfa188dc98142a427
 | 
					Subproject commit 0d8220b1912e841ecaaa8f47198c8406e41fb5b4
 | 
				
			||||||
@ -567,6 +567,10 @@ private slots:
 | 
				
			|||||||
public slots:
 | 
					public slots:
 | 
				
			||||||
  void server_disconnected();
 | 
					  void server_disconnected();
 | 
				
			||||||
  void loading_cancelled();
 | 
					  void loading_cancelled();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					signals:
 | 
				
			||||||
 | 
					  void qt_log_message(QtMsgType type, const QMessageLogContext &context,
 | 
				
			||||||
 | 
					                      const QString &msg);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // AOAPPLICATION_H
 | 
					#endif // AOAPPLICATION_H
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,8 @@ public:
 | 
				
			|||||||
  AOTextArea(QWidget *p_parent = nullptr);
 | 
					  AOTextArea(QWidget *p_parent = nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void append_linked(QString p_message);
 | 
					  void append_linked(QString p_message);
 | 
				
			||||||
  void append_chatmessage(QString p_name, QString p_message, QString p_colur);
 | 
					  void append_chatmessage(QString p_name, QString p_message,
 | 
				
			||||||
 | 
					                          QString p_name_colour, QString p_color = QString());
 | 
				
			||||||
  void append_error(QString p_message);
 | 
					  void append_error(QString p_message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
				
			|||||||
@ -216,8 +216,12 @@ public:
 | 
				
			|||||||
  void list_music();
 | 
					  void list_music();
 | 
				
			||||||
  void list_areas();
 | 
					  void list_areas();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // these are for OOC chat
 | 
					  // Debug log (formerly master server chat log)
 | 
				
			||||||
  void append_ms_chatmessage(QString f_name, QString f_message);
 | 
					  void debug_message_handler(QtMsgType type, const QMessageLogContext &context,
 | 
				
			||||||
 | 
					                             const QString &msg);
 | 
				
			||||||
 | 
					  void append_debug_message(QString f_message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // OOC chat log
 | 
				
			||||||
  void append_server_chatmessage(QString p_name, QString p_message,
 | 
					  void append_server_chatmessage(QString p_name, QString p_message,
 | 
				
			||||||
                                 QString p_color);
 | 
					                                 QString p_color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -630,7 +634,7 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  QTextEdit *ui_ic_chatlog;
 | 
					  QTextEdit *ui_ic_chatlog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  AOTextArea *ui_ms_chatlog;
 | 
					  AOTextArea *ui_debug_log;
 | 
				
			||||||
  AOTextArea *ui_server_chatlog;
 | 
					  AOTextArea *ui_server_chatlog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QListWidget *ui_mute_list;
 | 
					  QListWidget *ui_mute_list;
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,15 @@
 | 
				
			|||||||
#include "aocaseannouncerdialog.h"
 | 
					#include "aocaseannouncerdialog.h"
 | 
				
			||||||
#include "aooptionsdialog.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)
 | 
					AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  // Create the QSettings class that points to the config.ini.
 | 
					  // 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);
 | 
					          this, &AOApplication::ms_connect_finished);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  asset_lookup_cache.reserve(2048);
 | 
					  asset_lookup_cache.reserve(2048);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  message_handler_context = this;
 | 
				
			||||||
 | 
					  original_message_handler = qInstallMessageHandler(message_handler);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AOApplication::~AOApplication()
 | 
					AOApplication::~AOApplication()
 | 
				
			||||||
@ -28,12 +40,13 @@ AOApplication::~AOApplication()
 | 
				
			|||||||
  destruct_courtroom();
 | 
					  destruct_courtroom();
 | 
				
			||||||
  delete discord;
 | 
					  delete discord;
 | 
				
			||||||
  delete configini;
 | 
					  delete configini;
 | 
				
			||||||
 | 
					  qInstallMessageHandler(original_message_handler);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AOApplication::construct_lobby()
 | 
					void AOApplication::construct_lobby()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (lobby_constructed) {
 | 
					  if (lobby_constructed) {
 | 
				
			||||||
    qDebug() << "W: lobby was attempted constructed when it already exists";
 | 
					    qWarning() << "lobby was attempted constructed when it already exists";
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -58,7 +71,7 @@ void AOApplication::construct_lobby()
 | 
				
			|||||||
void AOApplication::destruct_lobby()
 | 
					void AOApplication::destruct_lobby()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (!lobby_constructed) {
 | 
					  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;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -70,7 +83,7 @@ void AOApplication::destruct_lobby()
 | 
				
			|||||||
void AOApplication::construct_courtroom()
 | 
					void AOApplication::construct_courtroom()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (courtroom_constructed) {
 | 
					  if (courtroom_constructed) {
 | 
				
			||||||
    qDebug() << "W: courtroom was attempted constructed when it already exists";
 | 
					    qWarning() << "courtroom was attempted constructed when it already exists";
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -87,14 +100,14 @@ void AOApplication::construct_courtroom()
 | 
				
			|||||||
                     w_courtroom, &Courtroom::skip_clocks);
 | 
					                     w_courtroom, &Courtroom::skip_clocks);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    qDebug() << "W: demo server did not exist during courtroom construction";
 | 
					    qWarning() << "demo server did not exist during courtroom construction";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AOApplication::destruct_courtroom()
 | 
					void AOApplication::destruct_courtroom()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (!courtroom_constructed) {
 | 
					  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;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -232,7 +245,7 @@ void AOApplication::initBASS()
 | 
				
			|||||||
        BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr,
 | 
					        BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr,
 | 
				
			||||||
                  nullptr);
 | 
					                  nullptr);
 | 
				
			||||||
        load_bass_opus_plugin();
 | 
					        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;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,7 @@ bool AOImage::set_image(QString p_image, QString p_misc)
 | 
				
			|||||||
                             ao_app->default_theme, p_misc, "", "", is_static || !ao_app->get_animated_theme());
 | 
					                             ao_app->default_theme, p_misc, "", "", is_static || !ao_app->get_animated_theme());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!file_exists(p_image)) {
 | 
					  if (!file_exists(p_image)) {
 | 
				
			||||||
    qDebug() << "Warning: Image" << p_image << "not found! Can't set!";
 | 
					    qWarning() << "Image" << p_image << "not found! Can't set!";
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  path = p_image;
 | 
					  path = p_image;
 | 
				
			||||||
 | 
				
			|||||||
@ -437,7 +437,7 @@ void CharLayer::load_network_effects()
 | 
				
			|||||||
          continue;
 | 
					          continue;
 | 
				
			||||||
        int f_frame = frame_split.at(0).toInt();
 | 
					        int f_frame = frame_split.at(0).toInt();
 | 
				
			||||||
        if (f_frame >= max_frames || f_frame < 0) {
 | 
					        if (f_frame >= max_frames || f_frame < 0) {
 | 
				
			||||||
          qDebug() << "Warning: out of bounds" << effects_list[i] << "frame"
 | 
					          qWarning() << "out of bounds" << effects_list[i] << "frame"
 | 
				
			||||||
                   << f_frame << "out of" << max_frames << "for" << m_emote;
 | 
					                   << f_frame << "out of" << max_frames << "for" << m_emote;
 | 
				
			||||||
          continue;
 | 
					          continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -461,7 +461,7 @@ void CharLayer::load_network_effects()
 | 
				
			|||||||
void CharLayer::play_frame_effect(int p_frame)
 | 
					void CharLayer::play_frame_effect(int p_frame)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (p_frame >= movie_effects.size()) {
 | 
					  if (p_frame >= movie_effects.size()) {
 | 
				
			||||||
    qDebug() << "W: Attempted to play a frame effect bigger than the size of movie_effects";
 | 
					    qWarning() << "Attempted to play a frame effect bigger than the size of movie_effects";
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (p_frame < max_frames) {
 | 
					  if (p_frame < max_frames) {
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,7 @@ void AOTextArea::append_linked(QString p_message)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AOTextArea::append_chatmessage(QString p_name, QString p_message,
 | 
					void AOTextArea::append_chatmessage(QString p_name, QString p_message,
 | 
				
			||||||
                                    QString p_colour)
 | 
					                                    QString p_name_colour, QString p_color)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const QTextCursor old_cursor = this->textCursor();
 | 
					  const QTextCursor old_cursor = this->textCursor();
 | 
				
			||||||
  const int old_scrollbar_value = this->verticalScrollBar()->value();
 | 
					  const int old_scrollbar_value = this->verticalScrollBar()->value();
 | 
				
			||||||
@ -21,15 +21,22 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message,
 | 
				
			|||||||
  this->moveCursor(QTextCursor::End);
 | 
					  this->moveCursor(QTextCursor::End);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this->append("");
 | 
					  this->append("");
 | 
				
			||||||
  this->insertHtml("<b><font color=" + p_colour + ">" + p_name.toHtmlEscaped() +
 | 
					  if (!p_name.isEmpty()) {
 | 
				
			||||||
 | 
					    this->insertHtml("<b><font color=" + p_name_colour + ">" + p_name.toHtmlEscaped() +
 | 
				
			||||||
                     "</font></b>: ");
 | 
					                     "</font></b>: ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // cheap workarounds ahoy
 | 
					    // cheap workarounds ahoy
 | 
				
			||||||
    p_message += " ";
 | 
					    p_message += " ";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QString result = p_message.toHtmlEscaped()
 | 
					  QString result = p_message.toHtmlEscaped()
 | 
				
			||||||
                       .replace("\n", "<br>")
 | 
					                       .replace("\n", "<br>")
 | 
				
			||||||
                       .replace(url_parser_regex, "<a href='\\1'>\\1</a>");
 | 
					                       .replace(url_parser_regex, "<a href='\\1'>\\1</a>");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!p_color.isEmpty()) {
 | 
				
			||||||
 | 
					    result = "<font color=" + p_color + ">" + result + "</font>";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this->insertHtml(result);
 | 
					  this->insertHtml(result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);
 | 
					  this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);
 | 
				
			||||||
 | 
				
			|||||||
@ -82,7 +82,7 @@ void Courtroom::set_char_select()
 | 
				
			|||||||
      ao_app->get_element_dimensions("char_select", filename);
 | 
					      ao_app->get_element_dimensions("char_select", filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (f_charselect.width < 0 || f_charselect.height < 0) {
 | 
					  if (f_charselect.width < 0 || f_charselect.height < 0) {
 | 
				
			||||||
    qDebug() << "W: did not find char_select width or height in "
 | 
					    qWarning() << "did not find char_select width or height in "
 | 
				
			||||||
                "courtroom_design.ini!";
 | 
					                "courtroom_design.ini!";
 | 
				
			||||||
    this->setFixedSize(714, 668);
 | 
					    this->setFixedSize(714, 668);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -113,11 +113,13 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			|||||||
  log_timestamp = ao_app->get_log_timestamp();
 | 
					  log_timestamp = ao_app->get_log_timestamp();
 | 
				
			||||||
  log_timestamp_format = ao_app->get_log_timestamp_format();
 | 
					  log_timestamp_format = ao_app->get_log_timestamp_format();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_ms_chatlog = new AOTextArea(this);
 | 
					  ui_debug_log = new AOTextArea(this);
 | 
				
			||||||
  ui_ms_chatlog->setReadOnly(true);
 | 
					  ui_debug_log->setReadOnly(true);
 | 
				
			||||||
  ui_ms_chatlog->setOpenExternalLinks(true);
 | 
					  ui_debug_log->setOpenExternalLinks(true);
 | 
				
			||||||
  ui_ms_chatlog->hide();
 | 
					  ui_debug_log->hide();
 | 
				
			||||||
  ui_ms_chatlog->setObjectName("ui_ms_chatlog");
 | 
					  ui_debug_log->setObjectName("ui_debug_log");
 | 
				
			||||||
 | 
					  connect(ao_app, &AOApplication::qt_log_message,
 | 
				
			||||||
 | 
					          this, &Courtroom::debug_message_handler);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_server_chatlog = new AOTextArea(this);
 | 
					  ui_server_chatlog = new AOTextArea(this);
 | 
				
			||||||
  ui_server_chatlog->setReadOnly(true);
 | 
					  ui_server_chatlog->setReadOnly(true);
 | 
				
			||||||
@ -562,7 +564,7 @@ void Courtroom::set_courtroom_size()
 | 
				
			|||||||
      ao_app->get_element_dimensions("courtroom", filename);
 | 
					      ao_app->get_element_dimensions("courtroom", filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (f_courtroom.width < 0 || f_courtroom.height < 0) {
 | 
					  if (f_courtroom.width < 0 || f_courtroom.height < 0) {
 | 
				
			||||||
    qDebug() << "W: did not find courtroom width or height in " << filename;
 | 
					    qWarning() << "did not find courtroom width or height in " << filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this->setFixedSize(714, 668);
 | 
					    this->setFixedSize(714, 668);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -681,7 +683,7 @@ void Courtroom::set_widgets()
 | 
				
			|||||||
      ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini");
 | 
					      ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
					  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
				
			||||||
    qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini";
 | 
					    qWarning() << "could not find \"chat_arrow\" in courtroom_design.ini";
 | 
				
			||||||
    ui_vp_chat_arrow->hide();
 | 
					    ui_vp_chat_arrow->hide();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
@ -727,8 +729,9 @@ void Courtroom::set_widgets()
 | 
				
			|||||||
  ui_ic_chatlog->setPlaceholderText(log_goes_downwards ? "▼ " + tr("Log goes down") + " ▼"
 | 
					  ui_ic_chatlog->setPlaceholderText(log_goes_downwards ? "▼ " + tr("Log goes down") + " ▼"
 | 
				
			||||||
                                                       : "▲ " + tr("Log goes up") + " ▲");
 | 
					                                                       : "▲ " + tr("Log goes up") + " ▲");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_ms_chatlog, "ms_chatlog");
 | 
					  set_size_and_pos(ui_debug_log, "ms_chatlog"); // Old name
 | 
				
			||||||
  ui_ms_chatlog->setFrameShape(QFrame::NoFrame);
 | 
					  set_size_and_pos(ui_debug_log, "debug_log"); // New name
 | 
				
			||||||
 | 
					  ui_debug_log->setFrameShape(QFrame::NoFrame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_server_chatlog, "server_chatlog");
 | 
					  set_size_and_pos(ui_server_chatlog, "server_chatlog");
 | 
				
			||||||
  ui_server_chatlog->setFrameShape(QFrame::NoFrame);
 | 
					  ui_server_chatlog->setFrameShape(QFrame::NoFrame);
 | 
				
			||||||
@ -788,7 +791,7 @@ void Courtroom::set_widgets()
 | 
				
			|||||||
      ao_app->get_element_dimensions("music_display", "courtroom_design.ini");
 | 
					      ao_app->get_element_dimensions("music_display", "courtroom_design.ini");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
					  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
				
			||||||
    qDebug() << "W: could not find \"music_display\" in courtroom_design.ini";
 | 
					    qWarning() << "could not find \"music_display\" in courtroom_design.ini";
 | 
				
			||||||
    ui_music_display->hide();
 | 
					    ui_music_display->hide();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
@ -1141,7 +1144,7 @@ void Courtroom::set_fonts(QString p_char)
 | 
				
			|||||||
  set_font(ui_vp_showname, "", "showname", p_char);
 | 
					  set_font(ui_vp_showname, "", "showname", p_char);
 | 
				
			||||||
  set_font(ui_vp_message, "", "message", p_char);
 | 
					  set_font(ui_vp_message, "", "message", p_char);
 | 
				
			||||||
  set_font(ui_ic_chatlog, "", "ic_chatlog", p_char);
 | 
					  set_font(ui_ic_chatlog, "", "ic_chatlog", p_char);
 | 
				
			||||||
  set_font(ui_ms_chatlog, "", "ms_chatlog", p_char);
 | 
					  set_font(ui_debug_log, "", "debug_log", p_char);
 | 
				
			||||||
  set_font(ui_server_chatlog, "", "server_chatlog", p_char);
 | 
					  set_font(ui_server_chatlog, "", "server_chatlog", p_char);
 | 
				
			||||||
  set_font(ui_music_list, "", "music_list", p_char);
 | 
					  set_font(ui_music_list, "", "music_list", p_char);
 | 
				
			||||||
  set_font(ui_area_list, "", "area_list", p_char);
 | 
					  set_font(ui_area_list, "", "area_list", p_char);
 | 
				
			||||||
@ -1250,7 +1253,7 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier, QStrin
 | 
				
			|||||||
      ao_app->get_element_dimensions(p_identifier, filename, p_misc);
 | 
					      ao_app->get_element_dimensions(p_identifier, filename, p_misc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
					  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
				
			||||||
    qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename;
 | 
					    qWarning() << "could not find \"" << p_identifier << "\" in " << filename;
 | 
				
			||||||
    p_widget->hide();
 | 
					    p_widget->hide();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
@ -1284,7 +1287,7 @@ QPoint Courtroom::get_theme_pos(QString p_identifier)
 | 
				
			|||||||
      ao_app->get_element_dimensions(p_identifier, filename);
 | 
					      ao_app->get_element_dimensions(p_identifier, filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
					  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
				
			||||||
    qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename;
 | 
					    qWarning() << "could not find \"" << p_identifier << "\" in " << filename;
 | 
				
			||||||
    return QPoint(0, 0);
 | 
					    return QPoint(0, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
@ -1735,12 +1738,27 @@ void Courtroom::list_areas()
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Courtroom::append_ms_chatmessage(QString f_name, QString f_message)
 | 
					void Courtroom::debug_message_handler(QtMsgType type, const QMessageLogContext &context,
 | 
				
			||||||
 | 
					                                      const QString &msg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  ui_ms_chatlog->append_chatmessage(
 | 
					  const QMap<QtMsgType, QString> colors = {
 | 
				
			||||||
      f_name, f_message,
 | 
					    {QtDebugMsg, "debug"},
 | 
				
			||||||
      ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini")
 | 
					    {QtInfoMsg, "info"},
 | 
				
			||||||
          .name());
 | 
					    {QtWarningMsg, "warn"},
 | 
				
			||||||
 | 
					    {QtCriticalMsg, "critical"},
 | 
				
			||||||
 | 
					    {QtFatalMsg, "fatal"}
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  const QString color_id = QString("debug_log_%1_color").arg(colors.value(type, "info"));
 | 
				
			||||||
 | 
					  ui_debug_log->append_chatmessage(
 | 
				
			||||||
 | 
					      QString(), qFormatLogMessage(type, context, msg),
 | 
				
			||||||
 | 
					      QString(), ao_app->get_color(color_id, "courtroom_fonts.ini").name());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Courtroom::append_debug_message(QString f_message)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  ui_debug_log->append_chatmessage(
 | 
				
			||||||
 | 
					      QString(), f_message,
 | 
				
			||||||
 | 
					      ao_app->get_color("debug_log_color", "courtroom_fonts.ini").name());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
 | 
					void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
 | 
				
			||||||
@ -1760,7 +1778,6 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
 | 
				
			|||||||
    on_authentication_state_received(1);
 | 
					    on_authentication_state_received(1);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  ui_server_chatlog->append_chatmessage(p_name, p_message, color);
 | 
					  ui_server_chatlog->append_chatmessage(p_name, p_message, color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (ao_app->get_text_logging_enabled() && !ao_app->log_filename.isEmpty()) {
 | 
					  if (ao_app->get_text_logging_enabled() && !ao_app->log_filename.isEmpty()) {
 | 
				
			||||||
@ -2494,7 +2511,7 @@ void Courtroom::handle_emote_mod(int emote_mod, bool p_immediate)
 | 
				
			|||||||
    break;
 | 
					    break;
 | 
				
			||||||
  default:
 | 
					  default:
 | 
				
			||||||
    // This should never happen, but if it does anyway, yell in the console about it.
 | 
					    // This should never happen, but if it does anyway, yell in the console about it.
 | 
				
			||||||
    qDebug() << "W: invalid emote mod: " << QString::number(emote_mod);
 | 
					    qWarning() << "invalid emote mod: " << QString::number(emote_mod);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2734,7 +2751,7 @@ void Courtroom::initialize_chatbox()
 | 
				
			|||||||
  pos_size_type design_ini_result = ao_app->get_element_dimensions(
 | 
					  pos_size_type design_ini_result = ao_app->get_element_dimensions(
 | 
				
			||||||
      "chat_arrow", "courtroom_design.ini", p_misc);
 | 
					      "chat_arrow", "courtroom_design.ini", p_misc);
 | 
				
			||||||
  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
					  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
				
			||||||
    qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini";
 | 
					    qWarning() << "could not find \"chat_arrow\" in courtroom_design.ini";
 | 
				
			||||||
    ui_vp_chat_arrow->hide();
 | 
					    ui_vp_chat_arrow->hide();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
@ -3248,7 +3265,7 @@ void Courtroom::play_preanim(bool immediate)
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
      anim_state = 1;
 | 
					      anim_state = 1;
 | 
				
			||||||
    preanim_done();
 | 
					    preanim_done();
 | 
				
			||||||
    qDebug() << "W: could not find " + anim_to_find;
 | 
					    qWarning() << "could not find " + anim_to_find;
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  ui_vp_player_char->set_static_duration(preanim_duration);
 | 
					  ui_vp_player_char->set_static_duration(preanim_duration);
 | 
				
			||||||
@ -4194,14 +4211,14 @@ void Courtroom::on_ooc_return_pressed()
 | 
				
			|||||||
void Courtroom::on_ooc_toggle_clicked()
 | 
					void Courtroom::on_ooc_toggle_clicked()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (server_ooc) {
 | 
					  if (server_ooc) {
 | 
				
			||||||
    ui_ms_chatlog->show();
 | 
					    ui_debug_log->show();
 | 
				
			||||||
    ui_server_chatlog->hide();
 | 
					    ui_server_chatlog->hide();
 | 
				
			||||||
    ui_ooc_toggle->setText(tr("Master"));
 | 
					    ui_ooc_toggle->setText(tr("Debug"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    server_ooc = false;
 | 
					    server_ooc = false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    ui_ms_chatlog->hide();
 | 
					    ui_debug_log->hide();
 | 
				
			||||||
    ui_server_chatlog->show();
 | 
					    ui_server_chatlog->show();
 | 
				
			||||||
    ui_ooc_toggle->setText(tr("Server"));
 | 
					    ui_ooc_toggle->setText(tr("Server"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -4619,7 +4636,7 @@ void Courtroom::on_mute_list_clicked(QModelIndex p_index)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (f_cid < 0 || f_cid >= char_list.size()) {
 | 
					  if (f_cid < 0 || f_cid >= char_list.size()) {
 | 
				
			||||||
    qDebug() << "W: " << real_char << " not present in char_list";
 | 
					    qWarning() << "" << real_char << " not present in char_list";
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -4653,7 +4670,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (f_cid < -2 || f_cid >= char_list.size()) {
 | 
					  if (f_cid < -2 || f_cid >= char_list.size()) {
 | 
				
			||||||
    qDebug() << "W: " << real_char << " not present in char_list";
 | 
					    qWarning() << "" << real_char << " not present in char_list";
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -5100,7 +5117,7 @@ void Courtroom::on_text_color_changed(int p_color)
 | 
				
			|||||||
    int c = color_row_to_number.at(p_color);
 | 
					    int c = color_row_to_number.at(p_color);
 | 
				
			||||||
    QString markdown_start = color_markdown_start_list.at(c);
 | 
					    QString markdown_start = color_markdown_start_list.at(c);
 | 
				
			||||||
    if (markdown_start.isEmpty()) {
 | 
					    if (markdown_start.isEmpty()) {
 | 
				
			||||||
      qDebug() << "W: Color list dropdown selected a non-existent markdown "
 | 
					      qWarning() << "Color list dropdown selected a non-existent markdown "
 | 
				
			||||||
                  "start character";
 | 
					                  "start character";
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -116,7 +116,7 @@ void Lobby::set_widgets()
 | 
				
			|||||||
  pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
 | 
					  pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (f_lobby.width < 0 || f_lobby.height < 0) {
 | 
					  if (f_lobby.width < 0 || f_lobby.height < 0) {
 | 
				
			||||||
    qDebug() << "W: did not find lobby width or height in " << filename;
 | 
					    qWarning() << "did not find lobby width or height in " << filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Most common symptom of bad config files and missing assets.
 | 
					    // Most common symptom of bad config files and missing assets.
 | 
				
			||||||
    call_notice(
 | 
					    call_notice(
 | 
				
			||||||
@ -205,7 +205,7 @@ void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
 | 
				
			|||||||
      ao_app->get_element_dimensions(p_identifier, filename);
 | 
					      ao_app->get_element_dimensions(p_identifier, filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
					  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
				
			||||||
    qDebug() << "W: could not find " << p_identifier << " in " << filename;
 | 
					    qWarning() << "could not find " << p_identifier << " in " << filename;
 | 
				
			||||||
    p_widget->hide();
 | 
					    p_widget->hide();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  qSetMessagePattern("%{type}: %{if-category}%{category}: %{endif}%{message}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
 | 
					#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
 | 
				
			||||||
  // High-DPI support is for Qt version >=5.6.
 | 
					  // High-DPI support is for Qt version >=5.6.
 | 
				
			||||||
  // However, many Linux distros still haven't brought their stable/LTS
 | 
					  // However, many Linux distros still haven't brought their stable/LTS
 | 
				
			||||||
 | 
				
			|||||||
@ -149,7 +149,7 @@ void NetworkManager::on_srv_lookup()
 | 
				
			|||||||
                 ms_socket->state() != QAbstractSocket::HostLookupState &&
 | 
					                 ms_socket->state() != QAbstractSocket::HostLookupState &&
 | 
				
			||||||
                 ms_socket->error() != -1) {
 | 
					                 ms_socket->error() != -1) {
 | 
				
			||||||
          qDebug() << ms_socket->error();
 | 
					          qDebug() << ms_socket->error();
 | 
				
			||||||
          qWarning() << "Error connecting to master server:"
 | 
					          qCritical() << "Error connecting to master server:"
 | 
				
			||||||
                      << ms_socket->errorString();
 | 
					                      << ms_socket->errorString();
 | 
				
			||||||
          ms_socket->abort();
 | 
					          ms_socket->abort();
 | 
				
			||||||
          ms_socket->close();
 | 
					          ms_socket->close();
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,7 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
 | 
				
			|||||||
      QStringList sub_contents = i_string.split("&");
 | 
					      QStringList sub_contents = i_string.split("&");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (sub_contents.size() < 4) {
 | 
					      if (sub_contents.size() < 4) {
 | 
				
			||||||
        qDebug() << "W: malformed packet";
 | 
					        qWarning() << "malformed packet";
 | 
				
			||||||
        continue;
 | 
					        continue;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -63,7 +63,8 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
 | 
				
			|||||||
      w_lobby->append_chatmessage(f_name, f_message);
 | 
					      w_lobby->append_chatmessage(f_name, f_message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (courtroom_constructed && courtroom_loaded) {
 | 
					    if (courtroom_constructed && courtroom_loaded) {
 | 
				
			||||||
      w_courtroom->append_ms_chatmessage(f_name, f_message);
 | 
					      w_courtroom->append_server_chatmessage(tr("[Global] %1").arg(f_name),
 | 
				
			||||||
 | 
					                                             f_message, "0");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else if (header == "AO2CHECK") {
 | 
					  else if (header == "AO2CHECK") {
 | 
				
			||||||
@ -453,7 +454,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
				
			|||||||
      goto end;
 | 
					      goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (lobby_constructed)
 | 
					    if (lobby_constructed)
 | 
				
			||||||
      w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog());
 | 
					      w_courtroom->append_server_chatmessage(tr("[Global log]"),
 | 
				
			||||||
 | 
					                                             w_lobby->get_chatlog(), "0");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    w_courtroom->character_loading_finished();
 | 
					    w_courtroom->character_loading_finished();
 | 
				
			||||||
    w_courtroom->done_received();
 | 
					    w_courtroom->done_received();
 | 
				
			||||||
 | 
				
			|||||||
@ -167,7 +167,7 @@ QString AOApplication::read_file(QString filename)
 | 
				
			|||||||
  QFile f_log(filename);
 | 
					  QFile f_log(filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!f_log.open(QIODevice::ReadOnly | QIODevice::Text)) {
 | 
					  if (!f_log.open(QIODevice::ReadOnly | QIODevice::Text)) {
 | 
				
			||||||
    qDebug() << "Couldn't open" << filename;
 | 
					    qWarning() << "Couldn't open" << filename;
 | 
				
			||||||
    return "";
 | 
					    return "";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -699,7 +699,7 @@ QString AOApplication::get_emote_comment(QString p_char, int p_emote)
 | 
				
			|||||||
  QStringList result_contents = f_result.split("#");
 | 
					  QStringList result_contents = f_result.split("#");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (result_contents.size() < 4) {
 | 
					  if (result_contents.size() < 4) {
 | 
				
			||||||
    qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
 | 
					    qWarning() << "misformatted char.ini: " << p_char << ", " << p_emote;
 | 
				
			||||||
    return "normal";
 | 
					    return "normal";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return result_contents.at(0);
 | 
					  return result_contents.at(0);
 | 
				
			||||||
@ -713,7 +713,7 @@ QString AOApplication::get_pre_emote(QString p_char, int p_emote)
 | 
				
			|||||||
  QStringList result_contents = f_result.split("#");
 | 
					  QStringList result_contents = f_result.split("#");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (result_contents.size() < 4) {
 | 
					  if (result_contents.size() < 4) {
 | 
				
			||||||
    qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
 | 
					    qWarning() << "misformatted char.ini: " << p_char << ", " << p_emote;
 | 
				
			||||||
    return "";
 | 
					    return "";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return result_contents.at(1);
 | 
					  return result_contents.at(1);
 | 
				
			||||||
@ -727,7 +727,7 @@ QString AOApplication::get_emote(QString p_char, int p_emote)
 | 
				
			|||||||
  QStringList result_contents = f_result.split("#");
 | 
					  QStringList result_contents = f_result.split("#");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (result_contents.size() < 4) {
 | 
					  if (result_contents.size() < 4) {
 | 
				
			||||||
    qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
 | 
					    qWarning() << "misformatted char.ini: " << p_char << ", " << p_emote;
 | 
				
			||||||
    return "normal";
 | 
					    return "normal";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return result_contents.at(2);
 | 
					  return result_contents.at(2);
 | 
				
			||||||
@ -741,7 +741,7 @@ int AOApplication::get_emote_mod(QString p_char, int p_emote)
 | 
				
			|||||||
  QStringList result_contents = f_result.split("#");
 | 
					  QStringList result_contents = f_result.split("#");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (result_contents.size() < 4) {
 | 
					  if (result_contents.size() < 4) {
 | 
				
			||||||
    qDebug() << "W: misformatted char.ini: " << p_char << ", "
 | 
					    qWarning() << "misformatted char.ini: " << p_char << ", "
 | 
				
			||||||
             << QString::number(p_emote);
 | 
					             << QString::number(p_emote);
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user