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>
|
|
|
|
|
2014-11-16 19:40:44 +08:00
|
|
|
ChatMessage::ChatMessage(QGraphicsScene* scene, const QString& rawMessage)
|
2014-11-12 23:45:24 +08:00
|
|
|
: ChatLine(scene)
|
2014-11-16 19:40:44 +08:00
|
|
|
, rawString(rawMessage)
|
2014-11-12 23:45:24 +08:00
|
|
|
{
|
2014-11-16 19:40:44 +08:00
|
|
|
// 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));
|
2014-11-12 23:45:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2014-11-16 19:40:44 +08:00
|
|
|
replaceContent(2, new Text(time.toString("hh:mm")));
|
2014-11-12 21:11:25 +08:00
|
|
|
}
|
2014-11-14 01:27:32 +08:00
|
|
|
|
|
|
|
QString ChatMessage::toString() const
|
|
|
|
{
|
2014-11-16 19:40:44 +08:00
|
|
|
return rawString;
|
2014-11-14 01:27:32 +08:00
|
|
|
}
|