From b9a6ae912308bc8f8f17ff88033131a360521e7c Mon Sep 17 00:00:00 2001 From: Alex Noir Date: Thu, 24 Mar 2022 16:08:14 +0300 Subject: [PATCH 1/2] Add ic_chatlog_timestamp_color and ic_chatlog_selftimestamp_color to courtroom_fonts.ini --- src/charselect.cpp | 2 ++ src/courtroom.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/charselect.cpp b/src/charselect.cpp index dce675a52..305fcc37b 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -191,6 +191,8 @@ void Courtroom::char_clicked(int n_char) if (n_char != -1) ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); + else + ui_ic_chat_name->setPlaceholderText("Spectator"); } void Courtroom::put_button_in_place(int starting, int chars_on_this_page) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 603b22308..6b40731f5 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3172,6 +3172,8 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, QTextCharFormat italics; QTextCharFormat own_name; QTextCharFormat other_name; + QTextCharFormat timestamp_format; + QTextCharFormat selftimestamp_format; QTextBlockFormat format; bold.setFontWeight(QFont::Bold); normal.setFontWeight(QFont::Normal); @@ -3180,6 +3182,8 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, own_name.setForeground(ao_app->get_color("ic_chatlog_selfname_color", "courtroom_fonts.ini")); other_name.setFontWeight(QFont::Bold); other_name.setForeground(ao_app->get_color("ic_chatlog_showname_color", "courtroom_fonts.ini")); + timestamp_format.setForeground(ao_app->get_color("ic_chatlog_timestamp_color", "courtroom_fonts.ini")); + selftimestamp_format.setForeground(ao_app->get_color("ic_chatlog_selftimestamp_color", "courtroom_fonts.ini")); format.setTopMargin(log_margin); const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); @@ -3198,9 +3202,11 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, // Timestamp if we're doing that meme if (log_timestamp) { + // Format the timestamp + QTextCharFormat format = selfname ? selftimestamp_format : timestamp_format; if (timestamp.isValid()) { ui_ic_chatlog->textCursor().insertText( - "[" + timestamp.toString(log_timestamp_format) + "] ", normal); + "[" + timestamp.toString(log_timestamp_format) + "] ", format); } else { qCritical() << "could not insert invalid timestamp" << timestamp; } From 1bc69e1cd3f4da99e746d6457583dde159e708a8 Mon Sep 17 00:00:00 2001 From: Alex Noir Date: Thu, 24 Mar 2022 16:16:46 +0300 Subject: [PATCH 2/2] clang tidy. clang stronk. --- src/charselect.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/charselect.cpp b/src/charselect.cpp index 305fcc37b..7b9308a4c 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -189,10 +189,12 @@ void Courtroom::char_clicked(int n_char) set_courtroom_size(); } - if (n_char != -1) + if (n_char != -1) { ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); - else + } + else { ui_ic_chat_name->setPlaceholderText("Spectator"); + } } void Courtroom::put_button_in_place(int starting, int chars_on_this_page)