1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
qTox/src/chatlog/chatmessage.cpp

20 lines
688 B
C++
Raw Normal View History

2014-11-12 21:11:25 +08:00
#include "chatmessage.h"
2014-11-12 23:45:24 +08:00
#include "content/text.h"
#include "content/spinner.h"
2014-11-12 21:11:25 +08:00
2014-11-12 23:45:24 +08:00
#include <QDateTime>
ChatMessage::ChatMessage(QGraphicsScene *scene, const QString& author ,ChatLineContent *content)
: ChatLine(scene)
{
addColumn(new Text(author, true), ColumnFormat(75.0, ColumnFormat::FixedSize, 1, ColumnFormat::Right));
addColumn(content, ColumnFormat(1.0, ColumnFormat::VariableSize));
addColumn(new Spinner(QSizeF(16, 16)), ColumnFormat(50.0, ColumnFormat::FixedSize, 1, ColumnFormat::Right));
}
void ChatMessage::markAsSent(const QDateTime &time)
2014-11-12 21:11:25 +08:00
{
2014-11-12 23:45:24 +08:00
// remove the spinner and replace it by $time
replaceContent(2, new Text(time.toString("hh:mm"), true));
2014-11-12 21:11:25 +08:00
}