From a397b6fe2f0cdf3e09108498df486336e98dcb5b Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Thu, 26 Jul 2018 16:46:04 +0300 Subject: [PATCH] Added display of message time (local time) --- src/chatwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/chatwindow.cpp b/src/chatwindow.cpp index 4946160..1380326 100644 --- a/src/chatwindow.cpp +++ b/src/chatwindow.cpp @@ -31,7 +31,8 @@ void ChatWindow::sendMessage(QString msgText) jSend["chatID"] = chatID; jSend["msgText"] = msgText; network->sendDatagram(jSend, peerID); - ui->chatEdit->append(tr("You: ") + msgText); + QDateTime date(QDateTime::currentDateTime()); + ui->chatEdit->append("[" + date.toString() + "] " + tr("You: ") + msgText); } void ChatWindow::sendMsgButtonClicked() @@ -43,7 +44,8 @@ void ChatWindow::sendMsgButtonClicked() void ChatWindow::displayMsg(QString msgText) { - ui->chatEdit->append("" + peerID + "" + ": " + msgText); + QDateTime date(QDateTime::currentDateTime()); + ui->chatEdit->append("[" + date.toString() + "] " + "" + peerID + "" + ": " + msgText); } void ChatWindow::leftFromChat()