From a1a021c99c4fcbfeadba5469681fceb5f950ccf9 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Sun, 4 Jan 2015 18:01:46 +0100 Subject: [PATCH] Added timestamps to in game chat + added time stamps to the in game chat --- cockatrice/src/chatview.cpp | 2 +- cockatrice/src/messagelogwidget.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/chatview.cpp b/cockatrice/src/chatview.cpp index f2b8485c..6ad34bc1 100644 --- a/cockatrice/src/chatview.cpp +++ b/cockatrice/src/chatview.cpp @@ -96,7 +96,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use QTextCharFormat timeFormat; timeFormat.setForeground(Qt::black); cursor.setCharFormat(timeFormat); - cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm] ")); + cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm:ss] ")); } QTextCharFormat senderFormat; diff --git a/cockatrice/src/messagelogwidget.cpp b/cockatrice/src/messagelogwidget.cpp index a25a3cd0..3f894595 100644 --- a/cockatrice/src/messagelogwidget.cpp +++ b/cockatrice/src/messagelogwidget.cpp @@ -8,6 +8,7 @@ #include "pb/context_move_card.pb.h" #include "pb/context_mulligan.pb.h" #include +#include QString MessageLogWidget::sanitizeHtml(QString dirty) const { @@ -797,7 +798,7 @@ void MessageLogWidget::logSetActivePlayer(Player *player) str = tr("It is now %1's turn.", "female"); else str = tr("It is now %1's turn.", "male"); - appendHtml("
" + str.arg(player->getName()) + "
"); + appendHtml("
" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + str.arg(player->getName()) + "
"); } void MessageLogWidget::logSetActivePhase(int phase) @@ -817,7 +818,7 @@ void MessageLogWidget::logSetActivePhase(int phase) case 9: phaseName = tr("second main phase"); break; case 10: phaseName = tr("ending phase"); break; } - appendHtml("" + tr("It is now the %1.").arg(phaseName) + ""); + appendHtml("" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + tr("It is now the %1.").arg(phaseName) + ""); } void MessageLogWidget::containerProcessingStarted(const GameEventContext &_context) @@ -876,6 +877,6 @@ void MessageLogWidget::connectToPlayer(Player *player) } MessageLogWidget::MessageLogWidget(const TabSupervisor *_tabSupervisor, TabGame *_game, QWidget *parent) - : ChatView(_tabSupervisor, _game, false, parent), currentContext(MessageContext_None) + : ChatView(_tabSupervisor, _game, true, parent), currentContext(MessageContext_None) { }