aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-01-05 21:07:48 -0600
committerGitHub <noreply@github.com>2021-01-05 21:07:48 -0600
commit9486f44770e6830e9986a254c9b718101d6622da (patch)
tree3dc35f91622c253e9d9e7c1ac8a28976646f1092 /src
parent9adfa291913a2d262208003fb79e957037893285 (diff)
parent8aaba6633ec8b3303e0e7f24d42b96f3d5a4a90e (diff)
Merge pull request #369 from skyedeving/fix-showname-toggle
Fix timestamps when toggling showname
Diffstat (limited to 'src')
-rw-r--r--src/courtroom.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index bcff915d..a03300e2 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -2619,7 +2619,7 @@ void Courtroom::log_ic_text(QString p_name, QString p_showname,
}
void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action,
- int color)
+ int color, QDateTime timestamp)
{
QTextCharFormat bold;
QTextCharFormat normal;
@@ -2645,10 +2645,14 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action,
}
// Timestamp if we're doing that meme
- if (log_timestamp)
- ui_ic_chatlog->textCursor().insertText(
- "[" + QDateTime::currentDateTime().toString("h:mm:ss AP") + "] ",
- normal);
+ if (log_timestamp) {
+ if (timestamp.isValid()) {
+ ui_ic_chatlog->textCursor().insertText(
+ "[" + timestamp.toString("h:mm:ss AP") + "] ", normal);
+ } else {
+ qDebug() << "could not insert invalid timestamp";
+ }
+ }
// Format the name of the actor
ui_ic_chatlog->textCursor().insertText(p_name, bold);
@@ -4788,7 +4792,8 @@ void Courtroom::regenerate_ic_chatlog()
append_ic_text(item.get_message(),
ui_showname_enable->isChecked() ? item.get_showname()
: item.get_name(),
- item.get_action(), item.get_chat_color());
+ item.get_action(), item.get_chat_color(),
+ item.get_datetime().toLocalTime());
}
}