Added timestamps to in game chat

+ added time stamps to the in game chat
This commit is contained in:
Matt Lowe 2015-01-04 18:01:46 +01:00
parent 7476667b69
commit a1a021c99c
2 changed files with 5 additions and 4 deletions

View file

@ -96,7 +96,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
QTextCharFormat timeFormat; QTextCharFormat timeFormat;
timeFormat.setForeground(Qt::black); timeFormat.setForeground(Qt::black);
cursor.setCharFormat(timeFormat); cursor.setCharFormat(timeFormat);
cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm] ")); cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm:ss] "));
} }
QTextCharFormat senderFormat; QTextCharFormat senderFormat;

View file

@ -8,6 +8,7 @@
#include "pb/context_move_card.pb.h" #include "pb/context_move_card.pb.h"
#include "pb/context_mulligan.pb.h" #include "pb/context_mulligan.pb.h"
#include <QScrollBar> #include <QScrollBar>
#include <QDateTime>
QString MessageLogWidget::sanitizeHtml(QString dirty) const QString MessageLogWidget::sanitizeHtml(QString dirty) const
{ {
@ -797,7 +798,7 @@ void MessageLogWidget::logSetActivePlayer(Player *player)
str = tr("It is now %1's turn.", "female"); str = tr("It is now %1's turn.", "female");
else else
str = tr("It is now %1's turn.", "male"); str = tr("It is now %1's turn.", "male");
appendHtml("<br><font color=\"green\"><b>" + str.arg(player->getName()) + "</b></font><br>"); appendHtml("<br><font color=\"green\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + str.arg(player->getName()) + "</b></font><br>");
} }
void MessageLogWidget::logSetActivePhase(int phase) void MessageLogWidget::logSetActivePhase(int phase)
@ -817,7 +818,7 @@ void MessageLogWidget::logSetActivePhase(int phase)
case 9: phaseName = tr("second main phase"); break; case 9: phaseName = tr("second main phase"); break;
case 10: phaseName = tr("ending phase"); break; case 10: phaseName = tr("ending phase"); break;
} }
appendHtml("<font color=\"green\"><b>" + tr("It is now the %1.").arg(phaseName) + "</b></font>"); appendHtml("<font color=\"green\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + tr("It is now the %1.").arg(phaseName) + "</b></font>");
} }
void MessageLogWidget::containerProcessingStarted(const GameEventContext &_context) void MessageLogWidget::containerProcessingStarted(const GameEventContext &_context)
@ -876,6 +877,6 @@ void MessageLogWidget::connectToPlayer(Player *player)
} }
MessageLogWidget::MessageLogWidget(const TabSupervisor *_tabSupervisor, TabGame *_game, QWidget *parent) 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)
{ {
} }