Added display of message time (local time)

This commit is contained in:
Denis Davydov 2018-07-26 16:46:04 +03:00
parent 18714ddde6
commit a397b6fe2f

View File

@ -31,7 +31,8 @@ void ChatWindow::sendMessage(QString msgText)
jSend["chatID"] = chatID; jSend["chatID"] = chatID;
jSend["msgText"] = msgText; jSend["msgText"] = msgText;
network->sendDatagram(jSend, peerID); network->sendDatagram(jSend, peerID);
ui->chatEdit->append(tr("<b>You</b>: ") + msgText); QDateTime date(QDateTime::currentDateTime());
ui->chatEdit->append("[<i>" + date.toString() + "</i>] " + tr("<b>You</b>: ") + msgText);
} }
void ChatWindow::sendMsgButtonClicked() void ChatWindow::sendMsgButtonClicked()
@ -43,7 +44,8 @@ void ChatWindow::sendMsgButtonClicked()
void ChatWindow::displayMsg(QString msgText) void ChatWindow::displayMsg(QString msgText)
{ {
ui->chatEdit->append("<b>" + peerID + "</b>" + ": " + msgText); QDateTime date(QDateTime::currentDateTime());
ui->chatEdit->append("[<i>" + date.toString() + "</i>] " + "<b>" + peerID + "</b>" + ": " + msgText);
} }
void ChatWindow::leftFromChat() void ChatWindow::leftFromChat()